amber-cli.js 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308
  1. /* ====================================================================
  2. |
  3. | Amber Smalltalk
  4. | http://amber-lang.net
  5. |
  6. ======================================================================
  7. ======================================================================
  8. |
  9. | Copyright (c) 2010-2011
  10. | Nicolas Petton <petton.nicolas@gmail.com>
  11. |
  12. | Amber is released under the MIT license
  13. |
  14. | Permission is hereby granted, free of charge, to any person obtaining
  15. | a copy of this software and associated documentation files (the
  16. | 'Software'), to deal in the Software without restriction, including
  17. | without limitation the rights to use, copy, modify, merge, publish,
  18. | distribute, sublicense, and/or sell copies of the Software, and to
  19. | permit persons to whom the Software is furnished to do so, subject to
  20. | the following conditions:
  21. |
  22. | The above copyright notice and this permission notice shall be
  23. | included in all copies or substantial portions of the Software.
  24. |
  25. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  26. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  28. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  29. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  30. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  31. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  32. |
  33. ==================================================================== */
  34. /* Make sure that console is defined */
  35. if(typeof console === "undefined") {
  36. this.console = {
  37. log: function() {},
  38. warn: function() {},
  39. info: function() {},
  40. debug: function() {},
  41. error: function() {}
  42. };
  43. }
  44. /* Array extensions */
  45. Array.prototype.addElement = function(el) {
  46. if(typeof el === 'undefined') { return; }
  47. if(this.indexOf(el) == -1) {
  48. this.push(el);
  49. }
  50. };
  51. Array.prototype.removeElement = function(el) {
  52. var i = this.indexOf(el);
  53. if (i !== -1) { this.splice(i, 1); }
  54. };
  55. /* Smalltalk constructors definition */
  56. function SmalltalkObject() {}
  57. function SmalltalkBehavior() {}
  58. function SmalltalkClass() {}
  59. function SmalltalkMetaclass() {
  60. this.meta = true;
  61. }
  62. function SmalltalkPackage() {}
  63. function SmalltalkMethod() {}
  64. function SmalltalkNil() {}
  65. function SmalltalkOrganizer() {
  66. }
  67. function SmalltalkPackageOrganizer() {
  68. this.elements = [];
  69. }
  70. function SmalltalkClassOrganizer() {
  71. this.elements = [];
  72. }
  73. function inherits(child, parent) {
  74. child.prototype = Object.create(parent.prototype, {
  75. constructor: { value: child,
  76. enumerable: false, configurable: true, writable: true }
  77. });
  78. }
  79. inherits(SmalltalkBehavior, SmalltalkObject);
  80. inherits(SmalltalkClass, SmalltalkBehavior);
  81. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  82. inherits(SmalltalkNil, SmalltalkObject);
  83. inherits(SmalltalkMethod, SmalltalkObject);
  84. inherits(SmalltalkPackage, SmalltalkObject);
  85. inherits(SmalltalkOrganizer, SmalltalkObject);
  86. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  87. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  88. function Smalltalk() {
  89. var st = this;
  90. /* This is the current call context object. While it is publicly available,
  91. Use smalltalk.getThisContext() instead which will answer a safe copy of
  92. the current context */
  93. st.thisContext = undefined;
  94. /* List of all reserved words in JavaScript. They may not be used as variables
  95. in Smalltalk. */
  96. // list of reserved JavaScript keywords as of
  97. // http://es5.github.com/#x7.6.1.1
  98. // and
  99. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  100. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  101. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  102. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  103. 'try', 'typeof', 'var', 'void', 'while', 'with',
  104. // ES5: future use: http://es5.github.com/#x7.6.1.2
  105. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  106. // ES5: future use in strict mode
  107. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  108. 'public', 'static', 'yield'];
  109. st.globalJsVariables = ['jQuery', 'window', 'document', 'process', 'global'];
  110. var initialized = false;
  111. /* Smalltalk classes */
  112. var classes = [];
  113. var wrappedClasses = [];
  114. /* Method not implemented handlers */
  115. var dnu = {
  116. methods: [],
  117. selectors: [],
  118. get: function (string) {
  119. var index = this.selectors.indexOf(string);
  120. if(index !== -1) {
  121. return this.methods[index];
  122. }
  123. this.selectors.push(string);
  124. var selector = st.selector(string);
  125. var method = {jsSelector: selector, fn: this.createHandler(selector)};
  126. this.methods.push(method);
  127. return method;
  128. },
  129. /* Dnu handler method */
  130. createHandler: function (selector) {
  131. return function () {
  132. var args = Array.prototype.slice.call(arguments);
  133. return messageNotUnderstood(this, selector, args);
  134. };
  135. }
  136. };
  137. /* Answer all method selectors based on dnu handlers */
  138. st.allSelectors = function() {
  139. return dnu.selectors;
  140. };
  141. /* Unique ID number generator */
  142. var oid = 0;
  143. st.nextId = function() {
  144. oid += 1;
  145. return oid;
  146. };
  147. /* We hold all Packages in a separate Object */
  148. st.packages = {};
  149. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  150. function pkg(spec) {
  151. var that = new SmalltalkPackage();
  152. that.pkgName = spec.pkgName;
  153. that.organization = new SmalltalkPackageOrganizer();
  154. that.properties = spec.properties || {};
  155. return that;
  156. }
  157. /* Smalltalk class creation. A class is an instance of an automatically
  158. created metaclass object. Newly created classes (not their metaclass)
  159. should be added to the smalltalk object, see smalltalk.addClass().
  160. Superclass linking is *not* handled here, see smalltalk.init() */
  161. function klass(spec) {
  162. spec = spec || {};
  163. var meta = metaclass(spec);
  164. var that = meta.instanceClass;
  165. that.fn = spec.fn || function() {};
  166. setupClass(that, spec);
  167. that.className = spec.className;
  168. that.wrapped = spec.wrapped || false;
  169. meta.className = spec.className + ' class';
  170. if(spec.superclass) {
  171. that.superclass = spec.superclass;
  172. meta.superclass = spec.superclass.klass;
  173. }
  174. return that;
  175. }
  176. function metaclass(spec) {
  177. spec = spec || {};
  178. var that = new SmalltalkMetaclass();
  179. inherits(
  180. that.fn = function() {},
  181. spec.superclass ? spec.superclass.klass.fn : SmalltalkClass
  182. );
  183. that.instanceClass = new that.fn();
  184. setupClass(that);
  185. return that;
  186. }
  187. function setupClass(klass, spec) {
  188. spec = spec || {};
  189. klass.iVarNames = spec.iVarNames || [];
  190. klass.pkg = spec.pkg;
  191. Object.defineProperty(klass, "toString", {
  192. value: function() { return 'Smalltalk ' + this.className; },
  193. enumerable:false, configurable: true, writable: false
  194. });
  195. klass.organization = new SmalltalkClassOrganizer();
  196. klass.organization.theClass = klass;
  197. Object.defineProperty(klass, "methods", {
  198. value: {},
  199. enumerable: false, configurable: true, writable: true
  200. });
  201. wireKlass(klass);
  202. }
  203. /* Smalltalk method object. To add a method to a class,
  204. use smalltalk.addMethod() */
  205. st.method = function(spec) {
  206. var that = new SmalltalkMethod();
  207. that.selector = spec.selector;
  208. that.jsSelector = spec.jsSelector;
  209. that.args = spec.args || {};
  210. that.category = spec.category;
  211. that.source = spec.source;
  212. that.messageSends = spec.messageSends || [];
  213. that.referencedClasses = spec.referencedClasses || [];
  214. that.fn = spec.fn;
  215. return that;
  216. };
  217. /* Initialize a class in its class hierarchy. Handle both classes and
  218. metaclasses. */
  219. st.init = function(klass) {
  220. st.initClass(klass);
  221. if(klass.klass && !klass.meta) {
  222. st.initClass(klass.klass);
  223. }
  224. };
  225. st.initClass = function(klass) {
  226. if(klass.wrapped) {
  227. copySuperclass(klass);
  228. } else {
  229. installSuperclass(klass);
  230. }
  231. if(klass === st.Object || klass.wrapped) {
  232. installDnuHandlers(klass);
  233. }
  234. };
  235. function wireKlass(klass) {
  236. Object.defineProperty(klass.fn.prototype, "klass", {
  237. value: klass,
  238. enumerable: false, configurable: true, writable: true
  239. });
  240. }
  241. function installSuperclass(klass) {
  242. // only if the klass has not been initialized yet.
  243. if(klass.fn.prototype._yourself) { return; }
  244. if(klass.superclass && klass.superclass !== nil) {
  245. inherits(klass.fn, klass.superclass.fn);
  246. wireKlass(klass);
  247. reinstallMethods(klass);
  248. }
  249. }
  250. function copySuperclass(klass, superclass) {
  251. for (superclass = superclass || klass.superclass;
  252. superclass && superclass !== nil;
  253. superclass = superclass.superclass) {
  254. for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) {
  255. installMethodIfAbsent(superclass.methods[keys[i]], klass);
  256. }
  257. }
  258. }
  259. function installMethod(method, klass) {
  260. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  261. value: method.fn,
  262. enumerable: false, configurable: true, writable: true
  263. });
  264. }
  265. function installMethodIfAbsent(method, klass) {
  266. if(!klass.fn.prototype[method.jsSelector]) {
  267. installMethod(method, klass);
  268. }
  269. }
  270. function reinstallMethods(klass) {
  271. for(var keys = Object.keys(klass.methods), i=0; i<keys.length; i++) {
  272. installMethod(klass.methods[keys[i]], klass);
  273. }
  274. }
  275. function installDnuHandlers(klass) {
  276. var m = dnu.methods;
  277. for(var i=0; i<m.length; i++) {
  278. installMethodIfAbsent(m[i], klass);
  279. }
  280. }
  281. function installNewDnuHandler(newHandler) {
  282. installMethodIfAbsent(newHandler, st.Object);
  283. for(var i = 0; i < wrappedClasses.length; i++) {
  284. installMethodIfAbsent(newHandler, wrappedClasses[i]);
  285. }
  286. }
  287. /* Answer all registered Packages as Array */
  288. // TODO: Remove this hack
  289. st.packages.all = function() {
  290. var packages = [];
  291. for(var i in st.packages) {
  292. if(!st.packages.hasOwnProperty(i) || typeof(st.packages[i]) === "function") continue;
  293. packages.push(st.packages[i]);
  294. }
  295. return packages;
  296. };
  297. /* Answer all registered Smalltalk classes */
  298. //TODO: remove the function and make smalltalk.classes an array
  299. st.classes = function() {
  300. return classes;
  301. };
  302. st.wrappedClasses = function() {
  303. return wrappedClasses;
  304. };
  305. /* Answer the direct subclasses of klass. */
  306. st.subclasses = function(klass) {
  307. var subclasses = [];
  308. var classes = st.classes();
  309. for(var i=0; i < classes.length; i++) {
  310. var c = classes[i];
  311. if(c.fn) {
  312. //Classes
  313. if(c.superclass === klass) {
  314. subclasses.push(c);
  315. }
  316. c = c.klass;
  317. //Metaclasses
  318. if(c && c.superclass === klass) {
  319. subclasses.push(c);
  320. }
  321. }
  322. }
  323. return subclasses;
  324. };
  325. st.allSubclasses = function(klass) {
  326. var result, subclasses;
  327. result = subclasses = st.subclasses(klass);
  328. subclasses.forEach(function(subclass) {
  329. result.push.apply(result, st.allSubclasses(subclass));
  330. });
  331. return result;
  332. };
  333. /* Create a new class wrapping a JavaScript constructor, and add it to the
  334. global smalltalk object. Package is lazily created if it does not exist with given name. */
  335. st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
  336. if(wrapped !== false) {
  337. wrapped = true;
  338. }
  339. var pkg = st.addPackage(pkgName);
  340. st[className] = klass({
  341. className: className,
  342. superclass: superclass,
  343. pkg: pkg,
  344. fn: fn,
  345. wrapped: wrapped
  346. });
  347. classes.addElement(st[className]);
  348. if(wrapped) {
  349. wrappedClasses.addElement(st[className]);
  350. }
  351. pkg.organization.elements.addElement(st[className]);
  352. };
  353. /* Create an alias for an existing class */
  354. st.alias = function(klass, alias) {
  355. st[alias] = klass;
  356. };
  357. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  358. If pkgName is null or empty we return nil, which is an allowed package for a class.
  359. If package already exists we still update the properties of it. */
  360. st.addPackage = function(pkgName, properties) {
  361. if(!pkgName) {return nil;}
  362. if(!(st.packages[pkgName])) {
  363. st.packages[pkgName] = pkg({
  364. pkgName: pkgName,
  365. properties: properties
  366. });
  367. } else {
  368. if(properties) {
  369. st.packages[pkgName].properties = properties;
  370. }
  371. }
  372. return st.packages[pkgName];
  373. };
  374. /* Add a class to the smalltalk object, creating a new one if needed.
  375. A Package is lazily created if it does not exist with given name. */
  376. st.addClass = function(className, superclass, iVarNames, pkgName) {
  377. var pkg = st.addPackage(pkgName);
  378. if (superclass == nil) { superclass = null; }
  379. if(st[className] && st[className].superclass == superclass) {
  380. st[className].superclass = superclass;
  381. st[className].iVarNames = iVarNames;
  382. st[className].pkg = pkg || st[className].pkg;
  383. } else {
  384. if(st[className]) {
  385. st.removeClass(st[className]);
  386. }
  387. st[className] = klass({
  388. className: className,
  389. superclass: superclass,
  390. pkg: pkg,
  391. iVarNames: iVarNames
  392. });
  393. }
  394. classes.addElement(st[className]);
  395. pkg.organization.elements.addElement(st[className]);
  396. };
  397. st.removeClass = function(klass) {
  398. klass.pkg.organization.elements.removeElement(klass);
  399. classes.removeElement(klass);
  400. delete st[klass.className];
  401. };
  402. /* Add/remove a method to/from a class */
  403. /* This is a temporary version of addMethod() for backward compatibility */
  404. st.addMethod = function(method_exJsSelector, klass_exMethod, exKlass) {
  405. if (typeof method_exJsSelector === "string") { //legacy
  406. if (method_exJsSelector !== st.selector(klass_exMethod.selector)) {
  407. console.log("DISCREPANCY: arg, in_method");
  408. console.log(method_exJsSelector);
  409. console.log(st.selector(klass_exMethod.selector));
  410. klass_exMethod.jsSelector = method_exJsSelector;
  411. }
  412. return new_addMethod(klass_exMethod, exKlass);
  413. }
  414. return new_addMethod(method_exJsSelector, klass_exMethod);
  415. };
  416. // later, st.addMethod can be this:
  417. function new_addMethod(method, klass) {
  418. if (!(method.jsSelector)) {
  419. method.jsSelector = st.selector(method.selector);
  420. }
  421. installMethod(method, klass);
  422. klass.methods[method.selector] = method;
  423. method.methodClass = klass;
  424. // During the bootstrap, #addCompiledMethod is not used.
  425. // Therefore we populate the organizer here too
  426. klass.organization.elements.addElement(method.category);
  427. // If already initialized (else it will be done later anyway),
  428. // re-initialize all subclasses to ensure the new method
  429. // propagation (for wrapped classes, not using the prototype
  430. // chain.
  431. if(initialized) {
  432. st.allSubclasses(klass).forEach(function(subclass) {
  433. st.initClass(subclass);
  434. });
  435. }
  436. for(var i=0; i<method.messageSends.length; i++) {
  437. var dnuHandler = dnu.get(method.messageSends[i]);
  438. if(initialized) {
  439. installNewDnuHandler(dnuHandler);
  440. }
  441. }
  442. }
  443. st.removeMethod = function(method) {
  444. var protocol = method.category;
  445. var klass = method.methodClass;
  446. delete klass.fn.prototype[st.selector(method.selector)];
  447. delete klass.methods[method.selector];
  448. var selectors = Object.keys(klass.methods);
  449. // Do *not* delete protocols from here.
  450. // This is handled by #removeCompiledMethod
  451. };
  452. /* Handles unhandled errors during message sends */
  453. // simply send the message and handle #dnu:
  454. st.send = function(receiver, selector, args, klass) {
  455. var method;
  456. if(receiver === null) {
  457. receiver = nil;
  458. }
  459. method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  460. if(method) {
  461. return method.apply(receiver, args);
  462. } else {
  463. return messageNotUnderstood(receiver, selector, args);
  464. }
  465. };
  466. st.withContext = function(worker, setup) {
  467. if(st.thisContext) {
  468. st.thisContext.pc++;
  469. return inContext(worker, setup);
  470. } else {
  471. try {
  472. return inContext(worker, setup);
  473. } catch(error) {
  474. if(error.smalltalkError) {
  475. handleError(error);
  476. } else {
  477. var errorWrapper = st.JavaScriptException._on_(error);
  478. try {errorWrapper._signal();} catch(ex) {}
  479. errorWrapper._context_(st.getThisContext());
  480. handleError(errorWrapper);
  481. }
  482. // Reset the context stack in any case
  483. st.thisContext = undefined;
  484. // Throw the exception anyway, as we want to stop
  485. // the execution to avoid infinite loops
  486. // Update: do not throw the exception. It's really annoying.
  487. // throw error;
  488. }
  489. }
  490. };
  491. function inContext(worker, setup) {
  492. var context = pushContext(setup);
  493. var result = worker(context);
  494. popContext(context);
  495. return result;
  496. }
  497. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  498. (See the Smalltalk class ErrorHandler and its subclasses */
  499. function handleError(error) {
  500. st.ErrorHandler._current()._handleError_(error);
  501. }
  502. /* Handles #dnu: *and* JavaScript method calls.
  503. if the receiver has no klass, we consider it a JS object (outside of the
  504. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  505. function messageNotUnderstood(receiver, selector, args) {
  506. /* Handles JS method calls. */
  507. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  508. return callJavaScriptMethod(receiver, selector, args);
  509. }
  510. /* Handles not understood messages. Also see the Amber counter-part
  511. Object>>doesNotUnderstand: */
  512. return receiver._doesNotUnderstand_(
  513. st.Message._new()
  514. ._selector_(st.convertSelector(selector))
  515. ._arguments_(args)
  516. );
  517. }
  518. /* Call a method of a JS object, or answer a property if it exists.
  519. Else try wrapping a JSObjectProxy around the receiver.
  520. If the object property is a function, then call it, except if it starts with
  521. an uppercase character (we probably want to answer the function itself in this
  522. case and send it #new from Amber).
  523. Converts keyword-based selectors by using the first
  524. keyword only, but keeping all message arguments.
  525. Example:
  526. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  527. function callJavaScriptMethod(receiver, selector, args) {
  528. var jsSelector = selector._asJavaScriptSelector();
  529. var jsProperty = receiver[jsSelector];
  530. if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  531. return jsProperty.apply(receiver, args);
  532. } else if(jsProperty !== undefined) {
  533. if(args[0]) {
  534. receiver[jsSelector] = args[0];
  535. return nil;
  536. } else {
  537. return jsProperty;
  538. }
  539. }
  540. return st.send(st.JSObjectProxy._on_(receiver), selector, args);
  541. }
  542. /* Handle thisContext pseudo variable */
  543. st.getThisContext = function() {
  544. if(st.thisContext) {
  545. st.thisContext.init();
  546. return st.thisContext;
  547. } else {
  548. return nil;
  549. }
  550. };
  551. function pushContext(setup) {
  552. st.thisContext = new SmalltalkMethodContext(smalltalk.thisContext, setup);
  553. return st.thisContext;
  554. }
  555. function popContext(context) {
  556. st.thisContext = context.homeContext;
  557. }
  558. /* Convert a Smalltalk selector into a JS selector */
  559. st.selector = function(string) {
  560. var selector = '_' + string;
  561. selector = selector.replace(/:/g, '_');
  562. selector = selector.replace(/[\&]/g, '_and');
  563. selector = selector.replace(/[\|]/g, '_or');
  564. selector = selector.replace(/[+]/g, '_plus');
  565. selector = selector.replace(/-/g, '_minus');
  566. selector = selector.replace(/[*]/g ,'_star');
  567. selector = selector.replace(/[\/]/g ,'_slash');
  568. selector = selector.replace(/[\\]/g ,'_backslash');
  569. selector = selector.replace(/[\~]/g ,'_tild');
  570. selector = selector.replace(/>/g ,'_gt');
  571. selector = selector.replace(/</g ,'_lt');
  572. selector = selector.replace(/=/g ,'_eq');
  573. selector = selector.replace(/,/g ,'_comma');
  574. selector = selector.replace(/[@]/g ,'_at');
  575. return selector;
  576. };
  577. /* Convert a string to a valid smalltalk selector.
  578. if you modify the following functions, also change String>>asSelector
  579. accordingly */
  580. st.convertSelector = function(selector) {
  581. if(selector.match(/__/)) {
  582. return convertBinarySelector(selector);
  583. } else {
  584. return convertKeywordSelector(selector);
  585. }
  586. };
  587. function convertKeywordSelector(selector) {
  588. return selector.replace(/^_/, '').replace(/_/g, ':');
  589. }
  590. function convertBinarySelector(selector) {
  591. return selector
  592. .replace(/^_/, '')
  593. .replace(/_and/g, '&')
  594. .replace(/_or/g, '|')
  595. .replace(/_plus/g, '+')
  596. .replace(/_minus/g, '-')
  597. .replace(/_star/g, '*')
  598. .replace(/_slash/g, '/')
  599. .replace(/_backslash/g, '\\')
  600. .replace(/_tild/g, '~')
  601. .replace(/_gt/g, '>')
  602. .replace(/_lt/g, '<')
  603. .replace(/_eq/g, '=')
  604. .replace(/_comma/g, ',')
  605. .replace(/_at/g, '@');
  606. }
  607. /* Converts a JavaScript object to valid Smalltalk Object */
  608. st.readJSObject = function(js) {
  609. var object = js;
  610. var readObject = (js.constructor === Object);
  611. var readArray = (js.constructor === Array);
  612. if(readObject) {
  613. object = st.Dictionary._new();
  614. }
  615. for(var i in js) {
  616. if(readObject) {
  617. object._at_put_(i, st.readJSObject(js[i]));
  618. }
  619. if(readArray) {
  620. object[i] = st.readJSObject(js[i]);
  621. }
  622. }
  623. return object;
  624. };
  625. /* Boolean assertion */
  626. st.assert = function(shouldBeBoolean) {
  627. if ((undefined !== shouldBeBoolean) && (shouldBeBoolean.klass === smalltalk.Boolean)) {
  628. return (shouldBeBoolean == true);
  629. } else {
  630. smalltalk.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  631. }
  632. };
  633. /* Backward compatibility with Amber 0.9.1 */
  634. st.symbolFor = function(aString) { return aString; };
  635. /* Smalltalk initialization. Called on page load */
  636. st.initialize = function() {
  637. if(initialized) { return; }
  638. classes.forEach(function(klass) {
  639. st.init(klass);
  640. });
  641. classes.forEach(function(klass) {
  642. klass._initialize();
  643. });
  644. initialized = true;
  645. };
  646. }
  647. inherits(Smalltalk, SmalltalkObject);
  648. function SmalltalkMethodContext(home, setup) {
  649. this.homeContext = home;
  650. this.setup = setup || function() {};
  651. this.pc = 0;
  652. }
  653. // Fallbacks
  654. SmalltalkMethodContext.prototype.locals = {};
  655. SmalltalkMethodContext.prototype.receiver = null;
  656. SmalltalkMethodContext.prototype.selector = null;
  657. SmalltalkMethodContext.prototype.lookupClass = null;
  658. inherits(SmalltalkMethodContext, SmalltalkObject);
  659. SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
  660. this.receiver = receiver;
  661. this.selector = selector;
  662. this.locals = locals || {};
  663. this.lookupClass = lookupClass;
  664. };
  665. SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx) {
  666. this.locals = locals || {};
  667. this.outerContext = ctx;
  668. };
  669. SmalltalkMethodContext.prototype.init = function() {
  670. var home = this.homeContext;
  671. if(home) {
  672. home = home.init();
  673. }
  674. this.setup(this);
  675. };
  676. SmalltalkMethodContext.prototype.method = function() {
  677. var method;
  678. var lookup = this.lookupClass || this.receiver.klass;
  679. while(!method && lookup) {
  680. method = lookup.methods[smalltalk.convertSelector(this.selector)];
  681. lookup = lookup.superclass;
  682. }
  683. return method;
  684. };
  685. // TODO: this is just wrong :)
  686. SmalltalkMethodContext.prototype.resume = function() {
  687. //Brutally set the receiver as thisContext, then re-enter the function
  688. smalltalk.thisContext = this;
  689. return this.method.apply(receiver, temps);
  690. };
  691. /* Global Smalltalk objects. */
  692. var nil = new SmalltalkNil();
  693. var smalltalk = new Smalltalk();
  694. if(this.jQuery) {
  695. this.jQuery.allowJavaScriptCalls = true;
  696. }
  697. /*
  698. * Answer the smalltalk representation of o.
  699. * Used in message sends
  700. */
  701. var _st = function(o) {
  702. if(o == null) {return nil;}
  703. if(o.klass) {return o;}
  704. return smalltalk.JSObjectProxy._on_(o);
  705. };
  706. /***************************************** BOOTSTRAP ******************************************/
  707. smalltalk.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, undefined, false);
  708. smalltalk.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, smalltalk.Object, false);
  709. smalltalk.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, smalltalk.Behavior, false);
  710. smalltalk.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, smalltalk.Behavior, false);
  711. smalltalk.Object.klass.superclass = smalltalk.Class;
  712. smalltalk.wrapClassName("Smalltalk", "Kernel-Objects", Smalltalk, smalltalk.Object, false);
  713. smalltalk.wrapClassName("Package", "Kernel-Objects", SmalltalkPackage, smalltalk.Object, false);
  714. smalltalk.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, smalltalk.Object, false);
  715. smalltalk.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, smalltalk.Object, false);
  716. smalltalk.wrapClassName("PackageOrganizer", "Kernel-Objects", SmalltalkPackageOrganizer, smalltalk.Organizer, false);
  717. smalltalk.wrapClassName("ClassOrganizer", "Kernel-Objects", SmalltalkClassOrganizer, smalltalk.Organizer, false);
  718. smalltalk.wrapClassName("Number", "Kernel-Objects", Number, smalltalk.Object);
  719. smalltalk.wrapClassName("BlockClosure", "Kernel-Methods", Function, smalltalk.Object);
  720. smalltalk.wrapClassName("Boolean", "Kernel-Objects", Boolean, smalltalk.Object);
  721. smalltalk.wrapClassName("Date", "Kernel-Objects", Date, smalltalk.Object);
  722. smalltalk.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, smalltalk.Object, false);
  723. smalltalk.addClass("Collection", smalltalk.Object, null, "Kernel-Collections");
  724. smalltalk.addClass("IndexableCollection", smalltalk.Collection, null, "Kernel-Collections");
  725. smalltalk.addClass("SequenceableCollection", smalltalk.IndexableCollection, null, "Kernel-Collections");
  726. smalltalk.addClass("CharacterArray", smalltalk.SequenceableCollection, null, "Kernel-Collections");
  727. smalltalk.wrapClassName("String", "Kernel-Collections", String, smalltalk.CharacterArray);
  728. smalltalk.wrapClassName("Array", "Kernel-Collections", Array, smalltalk.SequenceableCollection);
  729. smalltalk.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, smalltalk.Object);
  730. smalltalk.wrapClassName("Error", "Kernel-Exceptions", Error, smalltalk.Object);
  731. smalltalk.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, smalltalk.Object, false);
  732. /* Alias definitions */
  733. smalltalk.alias(smalltalk.Array, "OrderedCollection");
  734. smalltalk.alias(smalltalk.Date, "Time");
  735. smalltalk.addPackage('Kernel-Objects');
  736. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  737. 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.";
  738. smalltalk.addMethod(
  739. smalltalk.method({
  740. selector: "->",
  741. category: 'converting',
  742. fn: function (anObject){
  743. var self=this;
  744. function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
  745. return smalltalk.withContext(function($ctx1) {
  746. var $1;
  747. $1=_st($Association())._key_value_(self,anObject);
  748. return $1;
  749. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},smalltalk.Object)})},
  750. args: ["anObject"],
  751. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  752. messageSends: ["key:value:"],
  753. referencedClasses: ["Association"]
  754. }),
  755. smalltalk.Object);
  756. smalltalk.addMethod(
  757. smalltalk.method({
  758. selector: "=",
  759. category: 'comparing',
  760. fn: function (anObject){
  761. var self=this;
  762. return smalltalk.withContext(function($ctx1) {
  763. var $1;
  764. $1=self.__eq_eq(anObject);
  765. return $1;
  766. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},smalltalk.Object)})},
  767. args: ["anObject"],
  768. source: "= anObject\x0a\x09^self == anObject",
  769. messageSends: ["=="],
  770. referencedClasses: []
  771. }),
  772. smalltalk.Object);
  773. smalltalk.addMethod(
  774. smalltalk.method({
  775. selector: "==",
  776. category: 'comparing',
  777. fn: function (anObject){
  778. var self=this;
  779. return smalltalk.withContext(function($ctx1) {
  780. var $1;
  781. $1=_st(self._identityHash()).__eq(_st(anObject)._identityHash());
  782. return $1;
  783. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},smalltalk.Object)})},
  784. args: ["anObject"],
  785. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  786. messageSends: ["=", "identityHash"],
  787. referencedClasses: []
  788. }),
  789. smalltalk.Object);
  790. smalltalk.addMethod(
  791. smalltalk.method({
  792. selector: "asJSON",
  793. category: 'converting',
  794. fn: function (){
  795. var self=this;
  796. var variables;
  797. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  798. return smalltalk.withContext(function($ctx1) {
  799. var $1;
  800. variables=_st($HashedCollection())._new();
  801. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  802. return smalltalk.withContext(function($ctx2) {
  803. return _st(variables)._at_put_(each,_st(self._instVarAt_(each))._asJSON());
  804. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  805. $1=variables;
  806. return $1;
  807. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},smalltalk.Object)})},
  808. args: [],
  809. 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",
  810. messageSends: ["new", "do:", "at:put:", "asJSON", "instVarAt:", "allInstanceVariableNames", "class"],
  811. referencedClasses: ["HashedCollection"]
  812. }),
  813. smalltalk.Object);
  814. smalltalk.addMethod(
  815. smalltalk.method({
  816. selector: "asJSONString",
  817. category: 'converting',
  818. fn: function (){
  819. var self=this;
  820. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  821. return smalltalk.withContext(function($ctx1) {
  822. var $1;
  823. $1=_st($JSON())._stringify_(self._asJSON());
  824. return $1;
  825. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},smalltalk.Object)})},
  826. args: [],
  827. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  828. messageSends: ["stringify:", "asJSON"],
  829. referencedClasses: ["JSON"]
  830. }),
  831. smalltalk.Object);
  832. smalltalk.addMethod(
  833. smalltalk.method({
  834. selector: "asJavascript",
  835. category: 'converting',
  836. fn: function (){
  837. var self=this;
  838. return smalltalk.withContext(function($ctx1) {
  839. var $1;
  840. $1=self._asString();
  841. return $1;
  842. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Object)})},
  843. args: [],
  844. source: "asJavascript\x0a\x09^self asString",
  845. messageSends: ["asString"],
  846. referencedClasses: []
  847. }),
  848. smalltalk.Object);
  849. smalltalk.addMethod(
  850. smalltalk.method({
  851. selector: "asString",
  852. category: 'converting',
  853. fn: function (){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. var $1;
  857. $1=self._printString();
  858. return $1;
  859. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Object)})},
  860. args: [],
  861. source: "asString\x0a\x09^self printString",
  862. messageSends: ["printString"],
  863. referencedClasses: []
  864. }),
  865. smalltalk.Object);
  866. smalltalk.addMethod(
  867. smalltalk.method({
  868. selector: "basicAt:",
  869. category: 'accessing',
  870. fn: function (aString){
  871. var self=this;
  872. return smalltalk.withContext(function($ctx1) {
  873. return self[aString];
  874. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},smalltalk.Object)})},
  875. args: ["aString"],
  876. source: "basicAt: aString\x0a\x09<return self[aString]>",
  877. messageSends: [],
  878. referencedClasses: []
  879. }),
  880. smalltalk.Object);
  881. smalltalk.addMethod(
  882. smalltalk.method({
  883. selector: "basicAt:put:",
  884. category: 'accessing',
  885. fn: function (aString,anObject){
  886. var self=this;
  887. return smalltalk.withContext(function($ctx1) {
  888. return self[aString] = anObject;
  889. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  890. args: ["aString", "anObject"],
  891. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  892. messageSends: [],
  893. referencedClasses: []
  894. }),
  895. smalltalk.Object);
  896. smalltalk.addMethod(
  897. smalltalk.method({
  898. selector: "basicDelete:",
  899. category: 'accessing',
  900. fn: function (aString){
  901. var self=this;
  902. return smalltalk.withContext(function($ctx1) {
  903. delete self[aString]; return aString;
  904. return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},smalltalk.Object)})},
  905. args: ["aString"],
  906. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  907. messageSends: [],
  908. referencedClasses: []
  909. }),
  910. smalltalk.Object);
  911. smalltalk.addMethod(
  912. smalltalk.method({
  913. selector: "basicPerform:",
  914. category: 'message handling',
  915. fn: function (aString){
  916. var self=this;
  917. return smalltalk.withContext(function($ctx1) {
  918. var $1;
  919. $1=self._basicPerform_withArguments_(aString,[]);
  920. return $1;
  921. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},smalltalk.Object)})},
  922. args: ["aString"],
  923. source: "basicPerform: aString\x0a\x09^self basicPerform: aString withArguments: #()",
  924. messageSends: ["basicPerform:withArguments:"],
  925. referencedClasses: []
  926. }),
  927. smalltalk.Object);
  928. smalltalk.addMethod(
  929. smalltalk.method({
  930. selector: "basicPerform:withArguments:",
  931. category: 'message handling',
  932. fn: function (aString,aCollection){
  933. var self=this;
  934. return smalltalk.withContext(function($ctx1) {
  935. return self[aString].apply(self, aCollection);;
  936. return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  937. args: ["aString", "aCollection"],
  938. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  939. messageSends: [],
  940. referencedClasses: []
  941. }),
  942. smalltalk.Object);
  943. smalltalk.addMethod(
  944. smalltalk.method({
  945. selector: "class",
  946. category: 'accessing',
  947. fn: function (){
  948. var self=this;
  949. return smalltalk.withContext(function($ctx1) {
  950. return self.klass;
  951. return self}, function($ctx1) {$ctx1.fill(self,"class",{},smalltalk.Object)})},
  952. args: [],
  953. source: "class\x0a\x09<return self.klass>",
  954. messageSends: [],
  955. referencedClasses: []
  956. }),
  957. smalltalk.Object);
  958. smalltalk.addMethod(
  959. smalltalk.method({
  960. selector: "copy",
  961. category: 'copying',
  962. fn: function (){
  963. var self=this;
  964. return smalltalk.withContext(function($ctx1) {
  965. var $1;
  966. $1=_st(self._shallowCopy())._postCopy();
  967. return $1;
  968. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Object)})},
  969. args: [],
  970. source: "copy\x0a\x09^self shallowCopy postCopy",
  971. messageSends: ["postCopy", "shallowCopy"],
  972. referencedClasses: []
  973. }),
  974. smalltalk.Object);
  975. smalltalk.addMethod(
  976. smalltalk.method({
  977. selector: "deepCopy",
  978. category: 'copying',
  979. fn: function (){
  980. var self=this;
  981. return smalltalk.withContext(function($ctx1) {
  982. var copy = self.klass._new();
  983. for(var i in self) {
  984. if(/^@.+/.test(i)) {
  985. copy[i] = self[i]._deepCopy();
  986. }
  987. }
  988. return copy;
  989. ;
  990. return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Object)})},
  991. args: [],
  992. 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>",
  993. messageSends: [],
  994. referencedClasses: []
  995. }),
  996. smalltalk.Object);
  997. smalltalk.addMethod(
  998. smalltalk.method({
  999. selector: "deprecatedAPI",
  1000. category: 'error handling',
  1001. fn: function (){
  1002. var self=this;
  1003. return smalltalk.withContext(function($ctx1) {
  1004. _st(console)._warn_(_st(_st(_st(_st(smalltalk.getThisContext()._home())._asString()).__comma(" is deprecated! (in ")).__comma(_st(_st(smalltalk.getThisContext()._home())._home())._asString())).__comma(")"));
  1005. return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},smalltalk.Object)})},
  1006. args: [],
  1007. 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, ')'",
  1008. messageSends: ["warn:", ",", "asString", "home"],
  1009. referencedClasses: []
  1010. }),
  1011. smalltalk.Object);
  1012. smalltalk.addMethod(
  1013. smalltalk.method({
  1014. selector: "doesNotUnderstand:",
  1015. category: 'error handling',
  1016. fn: function (aMessage){
  1017. var self=this;
  1018. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1019. return smalltalk.withContext(function($ctx1) {
  1020. var $1,$2;
  1021. $1=_st($MessageNotUnderstood())._new();
  1022. _st($1)._receiver_(self);
  1023. _st($1)._message_(aMessage);
  1024. $2=_st($1)._signal();
  1025. return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.Object)})},
  1026. args: ["aMessage"],
  1027. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1028. messageSends: ["receiver:", "new", "message:", "signal"],
  1029. referencedClasses: ["MessageNotUnderstood"]
  1030. }),
  1031. smalltalk.Object);
  1032. smalltalk.addMethod(
  1033. smalltalk.method({
  1034. selector: "error:",
  1035. category: 'error handling',
  1036. fn: function (aString){
  1037. var self=this;
  1038. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1039. return smalltalk.withContext(function($ctx1) {
  1040. _st($Error())._signal_(aString);
  1041. return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},smalltalk.Object)})},
  1042. args: ["aString"],
  1043. source: "error: aString\x0a\x09Error signal: aString",
  1044. messageSends: ["signal:"],
  1045. referencedClasses: ["Error"]
  1046. }),
  1047. smalltalk.Object);
  1048. smalltalk.addMethod(
  1049. smalltalk.method({
  1050. selector: "halt",
  1051. category: 'error handling',
  1052. fn: function (){
  1053. var self=this;
  1054. return smalltalk.withContext(function($ctx1) {
  1055. self._error_("Halt encountered");
  1056. return self}, function($ctx1) {$ctx1.fill(self,"halt",{},smalltalk.Object)})},
  1057. args: [],
  1058. source: "halt\x0a\x09self error: 'Halt encountered'",
  1059. messageSends: ["error:"],
  1060. referencedClasses: []
  1061. }),
  1062. smalltalk.Object);
  1063. smalltalk.addMethod(
  1064. smalltalk.method({
  1065. selector: "identityHash",
  1066. category: 'accessing',
  1067. fn: function (){
  1068. var self=this;
  1069. return smalltalk.withContext(function($ctx1) {
  1070. var hash=self.identityHash;
  1071. if (hash) return hash;
  1072. hash=smalltalk.nextId();
  1073. Object.defineProperty(self, 'identityHash', {value:hash});
  1074. return hash;
  1075. ;
  1076. return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Object)})},
  1077. args: [],
  1078. 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>",
  1079. messageSends: [],
  1080. referencedClasses: []
  1081. }),
  1082. smalltalk.Object);
  1083. smalltalk.addMethod(
  1084. smalltalk.method({
  1085. selector: "ifNil:",
  1086. category: 'testing',
  1087. fn: function (aBlock){
  1088. var self=this;
  1089. return smalltalk.withContext(function($ctx1) {
  1090. var $1;
  1091. $1=self;
  1092. return $1;
  1093. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.Object)})},
  1094. args: ["aBlock"],
  1095. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  1096. messageSends: [],
  1097. referencedClasses: []
  1098. }),
  1099. smalltalk.Object);
  1100. smalltalk.addMethod(
  1101. smalltalk.method({
  1102. selector: "ifNil:ifNotNil:",
  1103. category: 'testing',
  1104. fn: function (aBlock,anotherBlock){
  1105. var self=this;
  1106. return smalltalk.withContext(function($ctx1) {
  1107. var $1;
  1108. $1=_st(anotherBlock)._value_(self);
  1109. return $1;
  1110. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1111. args: ["aBlock", "anotherBlock"],
  1112. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value: self",
  1113. messageSends: ["value:"],
  1114. referencedClasses: []
  1115. }),
  1116. smalltalk.Object);
  1117. smalltalk.addMethod(
  1118. smalltalk.method({
  1119. selector: "ifNotNil:",
  1120. category: 'testing',
  1121. fn: function (aBlock){
  1122. var self=this;
  1123. return smalltalk.withContext(function($ctx1) {
  1124. var $1;
  1125. $1=_st(aBlock)._value_(self);
  1126. return $1;
  1127. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.Object)})},
  1128. args: ["aBlock"],
  1129. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
  1130. messageSends: ["value:"],
  1131. referencedClasses: []
  1132. }),
  1133. smalltalk.Object);
  1134. smalltalk.addMethod(
  1135. smalltalk.method({
  1136. selector: "ifNotNil:ifNil:",
  1137. category: 'testing',
  1138. fn: function (aBlock,anotherBlock){
  1139. var self=this;
  1140. return smalltalk.withContext(function($ctx1) {
  1141. var $1;
  1142. $1=_st(aBlock)._value_(self);
  1143. return $1;
  1144. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1145. args: ["aBlock", "anotherBlock"],
  1146. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
  1147. messageSends: ["value:"],
  1148. referencedClasses: []
  1149. }),
  1150. smalltalk.Object);
  1151. smalltalk.addMethod(
  1152. smalltalk.method({
  1153. selector: "initialize",
  1154. category: 'initialization',
  1155. fn: function (){
  1156. var self=this;
  1157. return smalltalk.withContext(function($ctx1) {
  1158. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object)})},
  1159. args: [],
  1160. source: "initialize",
  1161. messageSends: [],
  1162. referencedClasses: []
  1163. }),
  1164. smalltalk.Object);
  1165. smalltalk.addMethod(
  1166. smalltalk.method({
  1167. selector: "inspect",
  1168. category: 'inspecting',
  1169. fn: function (){
  1170. var self=this;
  1171. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  1172. return smalltalk.withContext(function($ctx1) {
  1173. _st($InspectorHandler())._inspect_(self);
  1174. return self}, function($ctx1) {$ctx1.fill(self,"inspect",{},smalltalk.Object)})},
  1175. args: [],
  1176. source: "inspect\x0a\x09InspectorHandler inspect: self",
  1177. messageSends: ["inspect:"],
  1178. referencedClasses: ["InspectorHandler"]
  1179. }),
  1180. smalltalk.Object);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "inspectOn:",
  1184. category: 'inspecting',
  1185. fn: function (anInspector){
  1186. var self=this;
  1187. var variables;
  1188. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1189. return smalltalk.withContext(function($ctx1) {
  1190. var $1,$2;
  1191. variables=_st($Dictionary())._new();
  1192. _st(variables)._at_put_("#self",self);
  1193. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  1194. return smalltalk.withContext(function($ctx2) {
  1195. return _st(variables)._at_put_(each,self._instVarAt_(each));
  1196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1197. $1=anInspector;
  1198. _st($1)._setLabel_(self._printString());
  1199. $2=_st($1)._setVariables_(variables);
  1200. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.Object)})},
  1201. args: ["anInspector"],
  1202. 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",
  1203. messageSends: ["new", "at:put:", "do:", "instVarAt:", "allInstanceVariableNames", "class", "setLabel:", "printString", "setVariables:"],
  1204. referencedClasses: ["Dictionary"]
  1205. }),
  1206. smalltalk.Object);
  1207. smalltalk.addMethod(
  1208. smalltalk.method({
  1209. selector: "instVarAt:",
  1210. category: 'accessing',
  1211. fn: function (aString){
  1212. var self=this;
  1213. return smalltalk.withContext(function($ctx1) {
  1214. return self['@'+aString] ;
  1215. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},smalltalk.Object)})},
  1216. args: ["aString"],
  1217. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1218. messageSends: [],
  1219. referencedClasses: []
  1220. }),
  1221. smalltalk.Object);
  1222. smalltalk.addMethod(
  1223. smalltalk.method({
  1224. selector: "instVarAt:put:",
  1225. category: 'accessing',
  1226. fn: function (aString,anObject){
  1227. var self=this;
  1228. return smalltalk.withContext(function($ctx1) {
  1229. self['@' + aString] = anObject ;
  1230. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  1231. args: ["aString", "anObject"],
  1232. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1233. messageSends: [],
  1234. referencedClasses: []
  1235. }),
  1236. smalltalk.Object);
  1237. smalltalk.addMethod(
  1238. smalltalk.method({
  1239. selector: "isBehavior",
  1240. category: 'testing',
  1241. fn: function (){
  1242. var self=this;
  1243. return smalltalk.withContext(function($ctx1) {
  1244. return false;
  1245. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Object)})},
  1246. args: [],
  1247. source: "isBehavior\x0a\x09^ false",
  1248. messageSends: [],
  1249. referencedClasses: []
  1250. }),
  1251. smalltalk.Object);
  1252. smalltalk.addMethod(
  1253. smalltalk.method({
  1254. selector: "isBoolean",
  1255. category: 'testing',
  1256. fn: function (){
  1257. var self=this;
  1258. return smalltalk.withContext(function($ctx1) {
  1259. return false;
  1260. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Object)})},
  1261. args: [],
  1262. source: "isBoolean\x0a\x09^ false",
  1263. messageSends: [],
  1264. referencedClasses: []
  1265. }),
  1266. smalltalk.Object);
  1267. smalltalk.addMethod(
  1268. smalltalk.method({
  1269. selector: "isClass",
  1270. category: 'testing',
  1271. fn: function (){
  1272. var self=this;
  1273. return smalltalk.withContext(function($ctx1) {
  1274. return false;
  1275. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Object)})},
  1276. args: [],
  1277. source: "isClass\x0a\x09^false",
  1278. messageSends: [],
  1279. referencedClasses: []
  1280. }),
  1281. smalltalk.Object);
  1282. smalltalk.addMethod(
  1283. smalltalk.method({
  1284. selector: "isCompiledMethod",
  1285. category: 'testing',
  1286. fn: function (){
  1287. var self=this;
  1288. return smalltalk.withContext(function($ctx1) {
  1289. return false;
  1290. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.Object)})},
  1291. args: [],
  1292. source: "isCompiledMethod\x0a\x09^ false",
  1293. messageSends: [],
  1294. referencedClasses: []
  1295. }),
  1296. smalltalk.Object);
  1297. smalltalk.addMethod(
  1298. smalltalk.method({
  1299. selector: "isImmutable",
  1300. category: 'testing',
  1301. fn: function (){
  1302. var self=this;
  1303. return smalltalk.withContext(function($ctx1) {
  1304. return false;
  1305. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Object)})},
  1306. args: [],
  1307. source: "isImmutable\x0a\x09^ false",
  1308. messageSends: [],
  1309. referencedClasses: []
  1310. }),
  1311. smalltalk.Object);
  1312. smalltalk.addMethod(
  1313. smalltalk.method({
  1314. selector: "isKindOf:",
  1315. category: 'testing',
  1316. fn: function (aClass){
  1317. var self=this;
  1318. return smalltalk.withContext(function($ctx1) {
  1319. var $2,$1;
  1320. $2=self._isMemberOf_(aClass);
  1321. if(smalltalk.assert($2)){
  1322. $1=true;
  1323. } else {
  1324. $1=_st(self._class())._inheritsFrom_(aClass);
  1325. };
  1326. return $1;
  1327. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},smalltalk.Object)})},
  1328. args: ["aClass"],
  1329. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: [self class inheritsFrom: aClass]",
  1330. messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"],
  1331. referencedClasses: []
  1332. }),
  1333. smalltalk.Object);
  1334. smalltalk.addMethod(
  1335. smalltalk.method({
  1336. selector: "isMemberOf:",
  1337. category: 'testing',
  1338. fn: function (aClass){
  1339. var self=this;
  1340. return smalltalk.withContext(function($ctx1) {
  1341. var $1;
  1342. $1=_st(self._class()).__eq(aClass);
  1343. return $1;
  1344. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},smalltalk.Object)})},
  1345. args: ["aClass"],
  1346. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  1347. messageSends: ["=", "class"],
  1348. referencedClasses: []
  1349. }),
  1350. smalltalk.Object);
  1351. smalltalk.addMethod(
  1352. smalltalk.method({
  1353. selector: "isMetaclass",
  1354. category: 'testing',
  1355. fn: function (){
  1356. var self=this;
  1357. return smalltalk.withContext(function($ctx1) {
  1358. return false;
  1359. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Object)})},
  1360. args: [],
  1361. source: "isMetaclass\x0a\x09^false",
  1362. messageSends: [],
  1363. referencedClasses: []
  1364. }),
  1365. smalltalk.Object);
  1366. smalltalk.addMethod(
  1367. smalltalk.method({
  1368. selector: "isNil",
  1369. category: 'testing',
  1370. fn: function (){
  1371. var self=this;
  1372. return smalltalk.withContext(function($ctx1) {
  1373. return false;
  1374. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.Object)})},
  1375. args: [],
  1376. source: "isNil\x0a\x09^false",
  1377. messageSends: [],
  1378. referencedClasses: []
  1379. }),
  1380. smalltalk.Object);
  1381. smalltalk.addMethod(
  1382. smalltalk.method({
  1383. selector: "isNumber",
  1384. category: 'testing',
  1385. fn: function (){
  1386. var self=this;
  1387. return smalltalk.withContext(function($ctx1) {
  1388. return false;
  1389. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Object)})},
  1390. args: [],
  1391. source: "isNumber\x0a\x09^false",
  1392. messageSends: [],
  1393. referencedClasses: []
  1394. }),
  1395. smalltalk.Object);
  1396. smalltalk.addMethod(
  1397. smalltalk.method({
  1398. selector: "isPackage",
  1399. category: 'testing',
  1400. fn: function (){
  1401. var self=this;
  1402. return smalltalk.withContext(function($ctx1) {
  1403. return false;
  1404. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Object)})},
  1405. args: [],
  1406. source: "isPackage\x0a\x09^ false",
  1407. messageSends: [],
  1408. referencedClasses: []
  1409. }),
  1410. smalltalk.Object);
  1411. smalltalk.addMethod(
  1412. smalltalk.method({
  1413. selector: "isParseFailure",
  1414. category: 'testing',
  1415. fn: function (){
  1416. var self=this;
  1417. return smalltalk.withContext(function($ctx1) {
  1418. return false;
  1419. }, function($ctx1) {$ctx1.fill(self,"isParseFailure",{},smalltalk.Object)})},
  1420. args: [],
  1421. source: "isParseFailure\x0a\x09^false",
  1422. messageSends: [],
  1423. referencedClasses: []
  1424. }),
  1425. smalltalk.Object);
  1426. smalltalk.addMethod(
  1427. smalltalk.method({
  1428. selector: "isString",
  1429. category: 'testing',
  1430. fn: function (){
  1431. var self=this;
  1432. return smalltalk.withContext(function($ctx1) {
  1433. return false;
  1434. }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.Object)})},
  1435. args: [],
  1436. source: "isString\x0a\x09^false",
  1437. messageSends: [],
  1438. referencedClasses: []
  1439. }),
  1440. smalltalk.Object);
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "isSymbol",
  1444. category: 'testing',
  1445. fn: function (){
  1446. var self=this;
  1447. return smalltalk.withContext(function($ctx1) {
  1448. return false;
  1449. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{},smalltalk.Object)})},
  1450. args: [],
  1451. source: "isSymbol\x0a\x09^false",
  1452. messageSends: [],
  1453. referencedClasses: []
  1454. }),
  1455. smalltalk.Object);
  1456. smalltalk.addMethod(
  1457. smalltalk.method({
  1458. selector: "notNil",
  1459. category: 'testing',
  1460. fn: function (){
  1461. var self=this;
  1462. return smalltalk.withContext(function($ctx1) {
  1463. var $1;
  1464. $1=_st(self._isNil())._not();
  1465. return $1;
  1466. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.Object)})},
  1467. args: [],
  1468. source: "notNil\x0a\x09^self isNil not",
  1469. messageSends: ["not", "isNil"],
  1470. referencedClasses: []
  1471. }),
  1472. smalltalk.Object);
  1473. smalltalk.addMethod(
  1474. smalltalk.method({
  1475. selector: "perform:",
  1476. category: 'message handling',
  1477. fn: function (aString){
  1478. var self=this;
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $1;
  1481. $1=self._perform_withArguments_(aString,[]);
  1482. return $1;
  1483. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},smalltalk.Object)})},
  1484. args: ["aString"],
  1485. source: "perform: aString\x0a\x09^self perform: aString withArguments: #()",
  1486. messageSends: ["perform:withArguments:"],
  1487. referencedClasses: []
  1488. }),
  1489. smalltalk.Object);
  1490. smalltalk.addMethod(
  1491. smalltalk.method({
  1492. selector: "perform:withArguments:",
  1493. category: 'message handling',
  1494. fn: function (aString,aCollection){
  1495. var self=this;
  1496. return smalltalk.withContext(function($ctx1) {
  1497. return smalltalk.send(self, aString._asSelector(), aCollection);
  1498. return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  1499. args: ["aString", "aCollection"],
  1500. source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
  1501. messageSends: [],
  1502. referencedClasses: []
  1503. }),
  1504. smalltalk.Object);
  1505. smalltalk.addMethod(
  1506. smalltalk.method({
  1507. selector: "postCopy",
  1508. category: 'copying',
  1509. fn: function (){
  1510. var self=this;
  1511. return smalltalk.withContext(function($ctx1) {
  1512. return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},smalltalk.Object)})},
  1513. args: [],
  1514. source: "postCopy",
  1515. messageSends: [],
  1516. referencedClasses: []
  1517. }),
  1518. smalltalk.Object);
  1519. smalltalk.addMethod(
  1520. smalltalk.method({
  1521. selector: "printOn:",
  1522. category: 'printing',
  1523. fn: function (aStream){
  1524. var self=this;
  1525. return smalltalk.withContext(function($ctx1) {
  1526. var $1,$3,$2;
  1527. $1=aStream;
  1528. $3=_st(_st(_st(self._class())._name())._first())._isVowel();
  1529. if(smalltalk.assert($3)){
  1530. $2="an ";
  1531. } else {
  1532. $2="a ";
  1533. };
  1534. _st($1)._nextPutAll_($2);
  1535. _st(aStream)._nextPutAll_(_st(self._class())._name());
  1536. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Object)})},
  1537. args: ["aStream"],
  1538. 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",
  1539. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"],
  1540. referencedClasses: []
  1541. }),
  1542. smalltalk.Object);
  1543. smalltalk.addMethod(
  1544. smalltalk.method({
  1545. selector: "printString",
  1546. category: 'printing',
  1547. fn: function (){
  1548. var self=this;
  1549. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1550. return smalltalk.withContext(function($ctx1) {
  1551. var $1;
  1552. $1=_st($String())._streamContents_((function(stream){
  1553. return smalltalk.withContext(function($ctx2) {
  1554. return self._printOn_(stream);
  1555. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  1556. return $1;
  1557. }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.Object)})},
  1558. args: [],
  1559. source: "printString\x0a\x09\x22Answer a String representation of the receiver.\x22\x0a\x0a\x09^ String streamContents: [ :stream | self printOn: stream ]",
  1560. messageSends: ["streamContents:", "printOn:"],
  1561. referencedClasses: ["String"]
  1562. }),
  1563. smalltalk.Object);
  1564. smalltalk.addMethod(
  1565. smalltalk.method({
  1566. selector: "putOn:",
  1567. category: 'streaming',
  1568. fn: function (aStream){
  1569. var self=this;
  1570. return smalltalk.withContext(function($ctx1) {
  1571. _st(aStream)._nextPut_(self);
  1572. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Object)})},
  1573. args: ["aStream"],
  1574. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  1575. messageSends: ["nextPut:"],
  1576. referencedClasses: []
  1577. }),
  1578. smalltalk.Object);
  1579. smalltalk.addMethod(
  1580. smalltalk.method({
  1581. selector: "respondsTo:",
  1582. category: 'testing',
  1583. fn: function (aSelector){
  1584. var self=this;
  1585. return smalltalk.withContext(function($ctx1) {
  1586. var $1;
  1587. $1=_st(self._class())._canUnderstand_(aSelector);
  1588. return $1;
  1589. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},smalltalk.Object)})},
  1590. args: ["aSelector"],
  1591. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  1592. messageSends: ["canUnderstand:", "class"],
  1593. referencedClasses: []
  1594. }),
  1595. smalltalk.Object);
  1596. smalltalk.addMethod(
  1597. smalltalk.method({
  1598. selector: "shallowCopy",
  1599. category: 'copying',
  1600. fn: function (){
  1601. var self=this;
  1602. return smalltalk.withContext(function($ctx1) {
  1603. var copy = self.klass._new();
  1604. for(var i in self) {
  1605. if(/^@.+/.test(i)) {
  1606. copy[i] = self[i];
  1607. }
  1608. }
  1609. return copy;
  1610. ;
  1611. return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Object)})},
  1612. args: [],
  1613. 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>",
  1614. messageSends: [],
  1615. referencedClasses: []
  1616. }),
  1617. smalltalk.Object);
  1618. smalltalk.addMethod(
  1619. smalltalk.method({
  1620. selector: "shouldNotImplement",
  1621. category: 'error handling',
  1622. fn: function (){
  1623. var self=this;
  1624. return smalltalk.withContext(function($ctx1) {
  1625. self._error_("This method should not be implemented in ".__comma(_st(self._class())._name()));
  1626. return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},smalltalk.Object)})},
  1627. args: [],
  1628. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  1629. messageSends: ["error:", ",", "name", "class"],
  1630. referencedClasses: []
  1631. }),
  1632. smalltalk.Object);
  1633. smalltalk.addMethod(
  1634. smalltalk.method({
  1635. selector: "size",
  1636. category: 'accessing',
  1637. fn: function (){
  1638. var self=this;
  1639. return smalltalk.withContext(function($ctx1) {
  1640. self._error_("Object not indexable");
  1641. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Object)})},
  1642. args: [],
  1643. source: "size\x0a\x09self error: 'Object not indexable'",
  1644. messageSends: ["error:"],
  1645. referencedClasses: []
  1646. }),
  1647. smalltalk.Object);
  1648. smalltalk.addMethod(
  1649. smalltalk.method({
  1650. selector: "subclassResponsibility",
  1651. category: 'error handling',
  1652. fn: function (){
  1653. var self=this;
  1654. return smalltalk.withContext(function($ctx1) {
  1655. self._error_("This method is a responsibility of a subclass");
  1656. return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},smalltalk.Object)})},
  1657. args: [],
  1658. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  1659. messageSends: ["error:"],
  1660. referencedClasses: []
  1661. }),
  1662. smalltalk.Object);
  1663. smalltalk.addMethod(
  1664. smalltalk.method({
  1665. selector: "test",
  1666. category: 'converting',
  1667. fn: function (){
  1668. var self=this;
  1669. var a;
  1670. return smalltalk.withContext(function($ctx1) {
  1671. a=(1);
  1672. self._halt();
  1673. return self}, function($ctx1) {$ctx1.fill(self,"test",{a:a},smalltalk.Object)})},
  1674. args: [],
  1675. source: "test\x0a\x09| a |\x0a\x09a := 1.\x0a\x09self halt",
  1676. messageSends: ["halt"],
  1677. referencedClasses: []
  1678. }),
  1679. smalltalk.Object);
  1680. smalltalk.addMethod(
  1681. smalltalk.method({
  1682. selector: "throw:",
  1683. category: 'error handling',
  1684. fn: function (anObject){
  1685. var self=this;
  1686. return smalltalk.withContext(function($ctx1) {
  1687. throw anObject ;
  1688. return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},smalltalk.Object)})},
  1689. args: ["anObject"],
  1690. source: "throw: anObject\x0a\x09< throw anObject >",
  1691. messageSends: [],
  1692. referencedClasses: []
  1693. }),
  1694. smalltalk.Object);
  1695. smalltalk.addMethod(
  1696. smalltalk.method({
  1697. selector: "try:catch:",
  1698. category: 'error handling',
  1699. fn: function (aBlock,anotherBlock){
  1700. var self=this;
  1701. return smalltalk.withContext(function($ctx1) {
  1702. try{return aBlock._value()} catch(e) {return anotherBlock._value_(e)};
  1703. return self}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1704. args: ["aBlock", "anotherBlock"],
  1705. source: "try: aBlock catch: anotherBlock\x0a\x09<try{return aBlock._value()} catch(e) {return anotherBlock._value_(e)}>",
  1706. messageSends: [],
  1707. referencedClasses: []
  1708. }),
  1709. smalltalk.Object);
  1710. smalltalk.addMethod(
  1711. smalltalk.method({
  1712. selector: "value",
  1713. category: 'accessing',
  1714. fn: function (){
  1715. var self=this;
  1716. return smalltalk.withContext(function($ctx1) {
  1717. return self.valueOf();
  1718. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Object)})},
  1719. args: [],
  1720. source: "value\x0a\x09<return self.valueOf()>",
  1721. messageSends: [],
  1722. referencedClasses: []
  1723. }),
  1724. smalltalk.Object);
  1725. smalltalk.addMethod(
  1726. smalltalk.method({
  1727. selector: "yourself",
  1728. category: 'accessing',
  1729. fn: function (){
  1730. var self=this;
  1731. return smalltalk.withContext(function($ctx1) {
  1732. var $1;
  1733. $1=self;
  1734. return $1;
  1735. }, function($ctx1) {$ctx1.fill(self,"yourself",{},smalltalk.Object)})},
  1736. args: [],
  1737. source: "yourself\x0a\x09^self",
  1738. messageSends: [],
  1739. referencedClasses: []
  1740. }),
  1741. smalltalk.Object);
  1742. smalltalk.addMethod(
  1743. smalltalk.method({
  1744. selector: "~=",
  1745. category: 'comparing',
  1746. fn: function (anObject){
  1747. var self=this;
  1748. return smalltalk.withContext(function($ctx1) {
  1749. var $1;
  1750. $1=_st(self.__eq(anObject)).__eq(false);
  1751. return $1;
  1752. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},smalltalk.Object)})},
  1753. args: ["anObject"],
  1754. source: "~= anObject\x0a\x09^(self = anObject) = false",
  1755. messageSends: ["="],
  1756. referencedClasses: []
  1757. }),
  1758. smalltalk.Object);
  1759. smalltalk.addMethod(
  1760. smalltalk.method({
  1761. selector: "~~",
  1762. category: 'comparing',
  1763. fn: function (anObject){
  1764. var self=this;
  1765. return smalltalk.withContext(function($ctx1) {
  1766. var $1;
  1767. $1=_st(self.__eq_eq(anObject)).__eq(false);
  1768. return $1;
  1769. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},smalltalk.Object)})},
  1770. args: ["anObject"],
  1771. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  1772. messageSends: ["=", "=="],
  1773. referencedClasses: []
  1774. }),
  1775. smalltalk.Object);
  1776. smalltalk.addMethod(
  1777. smalltalk.method({
  1778. selector: "heliosClass",
  1779. category: 'helios',
  1780. fn: function (){
  1781. var self=this;
  1782. return smalltalk.withContext(function($ctx1) {
  1783. return "class";
  1784. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Object.klass)})},
  1785. args: [],
  1786. 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'",
  1787. messageSends: [],
  1788. referencedClasses: []
  1789. }),
  1790. smalltalk.Object.klass);
  1791. smalltalk.addMethod(
  1792. smalltalk.method({
  1793. selector: "initialize",
  1794. category: 'initialization',
  1795. fn: function (){
  1796. var self=this;
  1797. return smalltalk.withContext(function($ctx1) {
  1798. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object.klass)})},
  1799. args: [],
  1800. source: "initialize\x0a\x09\x22no op\x22",
  1801. messageSends: [],
  1802. referencedClasses: []
  1803. }),
  1804. smalltalk.Object.klass);
  1805. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  1806. 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: [ ... ]";
  1807. smalltalk.addMethod(
  1808. smalltalk.method({
  1809. selector: "&",
  1810. category: 'controlling',
  1811. fn: function (aBoolean){
  1812. var self=this;
  1813. return smalltalk.withContext(function($ctx1) {
  1814. if(self == true) {
  1815. return aBoolean;
  1816. } else {
  1817. return false;
  1818. }
  1819. ;
  1820. return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1821. args: ["aBoolean"],
  1822. 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>",
  1823. messageSends: [],
  1824. referencedClasses: []
  1825. }),
  1826. smalltalk.Boolean);
  1827. smalltalk.addMethod(
  1828. smalltalk.method({
  1829. selector: "=",
  1830. category: 'comparing',
  1831. fn: function (aBoolean){
  1832. var self=this;
  1833. return smalltalk.withContext(function($ctx1) {
  1834. if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {
  1835. return false;
  1836. }
  1837. return Boolean(self == true) == aBoolean
  1838. ;
  1839. return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1840. args: ["aBoolean"],
  1841. 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>",
  1842. messageSends: [],
  1843. referencedClasses: []
  1844. }),
  1845. smalltalk.Boolean);
  1846. smalltalk.addMethod(
  1847. smalltalk.method({
  1848. selector: "==",
  1849. category: 'comparing',
  1850. fn: function (aBoolean){
  1851. var self=this;
  1852. return smalltalk.withContext(function($ctx1) {
  1853. var $1;
  1854. $1=self.__eq(aBoolean);
  1855. return $1;
  1856. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1857. args: ["aBoolean"],
  1858. source: "== aBoolean\x0a\x09^self = aBoolean",
  1859. messageSends: ["="],
  1860. referencedClasses: []
  1861. }),
  1862. smalltalk.Boolean);
  1863. smalltalk.addMethod(
  1864. smalltalk.method({
  1865. selector: "and:",
  1866. category: 'controlling',
  1867. fn: function (aBlock){
  1868. var self=this;
  1869. return smalltalk.withContext(function($ctx1) {
  1870. var $2,$1;
  1871. $2=self.__eq(true);
  1872. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1873. return smalltalk.withContext(function($ctx2) {
  1874. return false;
  1875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1876. return $1;
  1877. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},smalltalk.Boolean)})},
  1878. args: ["aBlock"],
  1879. source: "and: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [false]",
  1880. messageSends: ["ifTrue:ifFalse:", "="],
  1881. referencedClasses: []
  1882. }),
  1883. smalltalk.Boolean);
  1884. smalltalk.addMethod(
  1885. smalltalk.method({
  1886. selector: "asBit",
  1887. category: 'converting',
  1888. fn: function (){
  1889. var self=this;
  1890. return smalltalk.withContext(function($ctx1) {
  1891. var $2,$1;
  1892. $2=self;
  1893. if(smalltalk.assert($2)){
  1894. $1=(1);
  1895. } else {
  1896. $1=(0);
  1897. };
  1898. return $1;
  1899. }, function($ctx1) {$ctx1.fill(self,"asBit",{},smalltalk.Boolean)})},
  1900. args: [],
  1901. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  1902. messageSends: ["ifTrue:ifFalse:"],
  1903. referencedClasses: []
  1904. }),
  1905. smalltalk.Boolean);
  1906. smalltalk.addMethod(
  1907. smalltalk.method({
  1908. selector: "asJSON",
  1909. category: 'converting',
  1910. fn: function (){
  1911. var self=this;
  1912. return smalltalk.withContext(function($ctx1) {
  1913. var $1;
  1914. $1=self;
  1915. return $1;
  1916. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Boolean)})},
  1917. args: [],
  1918. source: "asJSON\x0a\x09^self",
  1919. messageSends: [],
  1920. referencedClasses: []
  1921. }),
  1922. smalltalk.Boolean);
  1923. smalltalk.addMethod(
  1924. smalltalk.method({
  1925. selector: "asString",
  1926. category: 'converting',
  1927. fn: function (){
  1928. var self=this;
  1929. return smalltalk.withContext(function($ctx1) {
  1930. return self.toString() ;
  1931. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Boolean)})},
  1932. args: [],
  1933. source: "asString\x0a\x09< return self.toString() >",
  1934. messageSends: [],
  1935. referencedClasses: []
  1936. }),
  1937. smalltalk.Boolean);
  1938. smalltalk.addMethod(
  1939. smalltalk.method({
  1940. selector: "deepCopy",
  1941. category: 'copying',
  1942. fn: function (){
  1943. var self=this;
  1944. return smalltalk.withContext(function($ctx1) {
  1945. var $1;
  1946. $1=self;
  1947. return $1;
  1948. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Boolean)})},
  1949. args: [],
  1950. source: "deepCopy\x0a\x09^self",
  1951. messageSends: [],
  1952. referencedClasses: []
  1953. }),
  1954. smalltalk.Boolean);
  1955. smalltalk.addMethod(
  1956. smalltalk.method({
  1957. selector: "ifFalse:",
  1958. category: 'controlling',
  1959. fn: function (aBlock){
  1960. var self=this;
  1961. return smalltalk.withContext(function($ctx1) {
  1962. var $2,$1;
  1963. $2=self;
  1964. $1=_st($2)._ifTrue_ifFalse_((function(){
  1965. return smalltalk.withContext(function($ctx2) {
  1966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1967. return $1;
  1968. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},smalltalk.Boolean)})},
  1969. args: ["aBlock"],
  1970. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  1971. messageSends: ["ifTrue:ifFalse:"],
  1972. referencedClasses: []
  1973. }),
  1974. smalltalk.Boolean);
  1975. smalltalk.addMethod(
  1976. smalltalk.method({
  1977. selector: "ifFalse:ifTrue:",
  1978. category: 'controlling',
  1979. fn: function (aBlock,anotherBlock){
  1980. var self=this;
  1981. return smalltalk.withContext(function($ctx1) {
  1982. var $2,$1;
  1983. $2=self;
  1984. $1=_st($2)._ifTrue_ifFalse_(anotherBlock,aBlock);
  1985. return $1;
  1986. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  1987. args: ["aBlock", "anotherBlock"],
  1988. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  1989. messageSends: ["ifTrue:ifFalse:"],
  1990. referencedClasses: []
  1991. }),
  1992. smalltalk.Boolean);
  1993. smalltalk.addMethod(
  1994. smalltalk.method({
  1995. selector: "ifTrue:",
  1996. category: 'controlling',
  1997. fn: function (aBlock){
  1998. var self=this;
  1999. return smalltalk.withContext(function($ctx1) {
  2000. var $2,$1;
  2001. $2=self;
  2002. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  2003. return smalltalk.withContext(function($ctx2) {
  2004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2005. return $1;
  2006. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},smalltalk.Boolean)})},
  2007. args: ["aBlock"],
  2008. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  2009. messageSends: ["ifTrue:ifFalse:"],
  2010. referencedClasses: []
  2011. }),
  2012. smalltalk.Boolean);
  2013. smalltalk.addMethod(
  2014. smalltalk.method({
  2015. selector: "ifTrue:ifFalse:",
  2016. category: 'controlling',
  2017. fn: function (aBlock,anotherBlock){
  2018. var self=this;
  2019. return smalltalk.withContext(function($ctx1) {
  2020. if(self == true) {
  2021. return aBlock._value();
  2022. } else {
  2023. return anotherBlock._value();
  2024. }
  2025. ;
  2026. return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  2027. args: ["aBlock", "anotherBlock"],
  2028. 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>",
  2029. messageSends: [],
  2030. referencedClasses: []
  2031. }),
  2032. smalltalk.Boolean);
  2033. smalltalk.addMethod(
  2034. smalltalk.method({
  2035. selector: "isBoolean",
  2036. category: 'testing',
  2037. fn: function (){
  2038. var self=this;
  2039. return smalltalk.withContext(function($ctx1) {
  2040. return true;
  2041. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Boolean)})},
  2042. args: [],
  2043. source: "isBoolean\x0a\x09^ true",
  2044. messageSends: [],
  2045. referencedClasses: []
  2046. }),
  2047. smalltalk.Boolean);
  2048. smalltalk.addMethod(
  2049. smalltalk.method({
  2050. selector: "isImmutable",
  2051. category: 'testing',
  2052. fn: function (){
  2053. var self=this;
  2054. return smalltalk.withContext(function($ctx1) {
  2055. return true;
  2056. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Boolean)})},
  2057. args: [],
  2058. source: "isImmutable\x0a\x09^ true",
  2059. messageSends: [],
  2060. referencedClasses: []
  2061. }),
  2062. smalltalk.Boolean);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "not",
  2066. category: 'controlling',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. var $1;
  2071. $1=self.__eq(false);
  2072. return $1;
  2073. }, function($ctx1) {$ctx1.fill(self,"not",{},smalltalk.Boolean)})},
  2074. args: [],
  2075. source: "not\x0a\x09^self = false",
  2076. messageSends: ["="],
  2077. referencedClasses: []
  2078. }),
  2079. smalltalk.Boolean);
  2080. smalltalk.addMethod(
  2081. smalltalk.method({
  2082. selector: "or:",
  2083. category: 'controlling',
  2084. fn: function (aBlock){
  2085. var self=this;
  2086. return smalltalk.withContext(function($ctx1) {
  2087. var $2,$1;
  2088. $2=self.__eq(true);
  2089. $1=_st($2)._ifTrue_ifFalse_((function(){
  2090. return smalltalk.withContext(function($ctx2) {
  2091. return true;
  2092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  2093. return $1;
  2094. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},smalltalk.Boolean)})},
  2095. args: ["aBlock"],
  2096. source: "or: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: aBlock",
  2097. messageSends: ["ifTrue:ifFalse:", "="],
  2098. referencedClasses: []
  2099. }),
  2100. smalltalk.Boolean);
  2101. smalltalk.addMethod(
  2102. smalltalk.method({
  2103. selector: "printOn:",
  2104. category: 'printing',
  2105. fn: function (aStream){
  2106. var self=this;
  2107. return smalltalk.withContext(function($ctx1) {
  2108. _st(aStream)._nextPutAll_(self._asString());
  2109. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Boolean)})},
  2110. args: ["aStream"],
  2111. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2112. messageSends: ["nextPutAll:", "asString"],
  2113. referencedClasses: []
  2114. }),
  2115. smalltalk.Boolean);
  2116. smalltalk.addMethod(
  2117. smalltalk.method({
  2118. selector: "shallowCopy",
  2119. category: 'copying',
  2120. fn: function (){
  2121. var self=this;
  2122. return smalltalk.withContext(function($ctx1) {
  2123. var $1;
  2124. $1=self;
  2125. return $1;
  2126. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Boolean)})},
  2127. args: [],
  2128. source: "shallowCopy\x0a\x09^self",
  2129. messageSends: [],
  2130. referencedClasses: []
  2131. }),
  2132. smalltalk.Boolean);
  2133. smalltalk.addMethod(
  2134. smalltalk.method({
  2135. selector: "|",
  2136. category: 'controlling',
  2137. fn: function (aBoolean){
  2138. var self=this;
  2139. return smalltalk.withContext(function($ctx1) {
  2140. if(self == true) {
  2141. return true;
  2142. } else {
  2143. return aBoolean;
  2144. }
  2145. ;
  2146. return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},smalltalk.Boolean)})},
  2147. args: ["aBoolean"],
  2148. 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>",
  2149. messageSends: [],
  2150. referencedClasses: []
  2151. }),
  2152. smalltalk.Boolean);
  2153. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  2154. 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.).";
  2155. smalltalk.addMethod(
  2156. smalltalk.method({
  2157. selector: "+",
  2158. category: 'arithmetic',
  2159. fn: function (aDate){
  2160. var self=this;
  2161. return smalltalk.withContext(function($ctx1) {
  2162. return self + aDate;
  2163. return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},smalltalk.Date)})},
  2164. args: ["aDate"],
  2165. source: "+ aDate\x0a\x09<return self + aDate>",
  2166. messageSends: [],
  2167. referencedClasses: []
  2168. }),
  2169. smalltalk.Date);
  2170. smalltalk.addMethod(
  2171. smalltalk.method({
  2172. selector: "-",
  2173. category: 'arithmetic',
  2174. fn: function (aDate){
  2175. var self=this;
  2176. return smalltalk.withContext(function($ctx1) {
  2177. return self - aDate;
  2178. return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},smalltalk.Date)})},
  2179. args: ["aDate"],
  2180. source: "- aDate\x0a\x09<return self - aDate>",
  2181. messageSends: [],
  2182. referencedClasses: []
  2183. }),
  2184. smalltalk.Date);
  2185. smalltalk.addMethod(
  2186. smalltalk.method({
  2187. selector: "<",
  2188. category: 'comparing',
  2189. fn: function (aDate){
  2190. var self=this;
  2191. return smalltalk.withContext(function($ctx1) {
  2192. return self < aDate;
  2193. return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},smalltalk.Date)})},
  2194. args: ["aDate"],
  2195. source: "< aDate\x0a\x09<return self < aDate>",
  2196. messageSends: [],
  2197. referencedClasses: []
  2198. }),
  2199. smalltalk.Date);
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "<=",
  2203. category: 'comparing',
  2204. fn: function (aDate){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. return self <= aDate;
  2208. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},smalltalk.Date)})},
  2209. args: ["aDate"],
  2210. source: "<= aDate\x0a\x09<return self <= aDate>",
  2211. messageSends: [],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.Date);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: ">",
  2218. category: 'comparing',
  2219. fn: function (aDate){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. return self > aDate;
  2223. return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},smalltalk.Date)})},
  2224. args: ["aDate"],
  2225. source: "> aDate\x0a\x09<return self >> aDate>",
  2226. messageSends: [],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.Date);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: ">=",
  2233. category: 'comparing',
  2234. fn: function (aDate){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. return self >= aDate;
  2238. return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},smalltalk.Date)})},
  2239. args: ["aDate"],
  2240. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2241. messageSends: [],
  2242. referencedClasses: []
  2243. }),
  2244. smalltalk.Date);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "asDateString",
  2248. category: 'converting',
  2249. fn: function (){
  2250. var self=this;
  2251. return smalltalk.withContext(function($ctx1) {
  2252. return self.toDateString();
  2253. return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},smalltalk.Date)})},
  2254. args: [],
  2255. source: "asDateString\x0a\x09<return self.toDateString()>",
  2256. messageSends: [],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.Date);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "asLocaleString",
  2263. category: 'converting',
  2264. fn: function (){
  2265. var self=this;
  2266. return smalltalk.withContext(function($ctx1) {
  2267. return self.toLocaleString();
  2268. return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},smalltalk.Date)})},
  2269. args: [],
  2270. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2271. messageSends: [],
  2272. referencedClasses: []
  2273. }),
  2274. smalltalk.Date);
  2275. smalltalk.addMethod(
  2276. smalltalk.method({
  2277. selector: "asMilliseconds",
  2278. category: 'converting',
  2279. fn: function (){
  2280. var self=this;
  2281. return smalltalk.withContext(function($ctx1) {
  2282. var $1;
  2283. $1=self._time();
  2284. return $1;
  2285. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},smalltalk.Date)})},
  2286. args: [],
  2287. source: "asMilliseconds\x0a\x09^self time",
  2288. messageSends: ["time"],
  2289. referencedClasses: []
  2290. }),
  2291. smalltalk.Date);
  2292. smalltalk.addMethod(
  2293. smalltalk.method({
  2294. selector: "asNumber",
  2295. category: 'converting',
  2296. fn: function (){
  2297. var self=this;
  2298. return smalltalk.withContext(function($ctx1) {
  2299. var $1;
  2300. $1=self._asMilliseconds();
  2301. return $1;
  2302. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.Date)})},
  2303. args: [],
  2304. source: "asNumber\x0a\x09^self asMilliseconds",
  2305. messageSends: ["asMilliseconds"],
  2306. referencedClasses: []
  2307. }),
  2308. smalltalk.Date);
  2309. smalltalk.addMethod(
  2310. smalltalk.method({
  2311. selector: "asString",
  2312. category: 'converting',
  2313. fn: function (){
  2314. var self=this;
  2315. return smalltalk.withContext(function($ctx1) {
  2316. return self.toString();
  2317. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Date)})},
  2318. args: [],
  2319. source: "asString\x0a\x09<return self.toString()>",
  2320. messageSends: [],
  2321. referencedClasses: []
  2322. }),
  2323. smalltalk.Date);
  2324. smalltalk.addMethod(
  2325. smalltalk.method({
  2326. selector: "asTimeString",
  2327. category: 'converting',
  2328. fn: function (){
  2329. var self=this;
  2330. return smalltalk.withContext(function($ctx1) {
  2331. return self.toTimeString();
  2332. return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},smalltalk.Date)})},
  2333. args: [],
  2334. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2335. messageSends: [],
  2336. referencedClasses: []
  2337. }),
  2338. smalltalk.Date);
  2339. smalltalk.addMethod(
  2340. smalltalk.method({
  2341. selector: "day",
  2342. category: 'accessing',
  2343. fn: function (){
  2344. var self=this;
  2345. return smalltalk.withContext(function($ctx1) {
  2346. var $1;
  2347. $1=self._dayOfWeek();
  2348. return $1;
  2349. }, function($ctx1) {$ctx1.fill(self,"day",{},smalltalk.Date)})},
  2350. args: [],
  2351. source: "day\x0a\x09^self dayOfWeek",
  2352. messageSends: ["dayOfWeek"],
  2353. referencedClasses: []
  2354. }),
  2355. smalltalk.Date);
  2356. smalltalk.addMethod(
  2357. smalltalk.method({
  2358. selector: "day:",
  2359. category: 'accessing',
  2360. fn: function (aNumber){
  2361. var self=this;
  2362. return smalltalk.withContext(function($ctx1) {
  2363. self._dayOfWeek_(aNumber);
  2364. return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},smalltalk.Date)})},
  2365. args: ["aNumber"],
  2366. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2367. messageSends: ["dayOfWeek:"],
  2368. referencedClasses: []
  2369. }),
  2370. smalltalk.Date);
  2371. smalltalk.addMethod(
  2372. smalltalk.method({
  2373. selector: "dayOfMonth",
  2374. category: 'accessing',
  2375. fn: function (){
  2376. var self=this;
  2377. return smalltalk.withContext(function($ctx1) {
  2378. return self.getDate();
  2379. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},smalltalk.Date)})},
  2380. args: [],
  2381. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2382. messageSends: [],
  2383. referencedClasses: []
  2384. }),
  2385. smalltalk.Date);
  2386. smalltalk.addMethod(
  2387. smalltalk.method({
  2388. selector: "dayOfMonth:",
  2389. category: 'accessing',
  2390. fn: function (aNumber){
  2391. var self=this;
  2392. return smalltalk.withContext(function($ctx1) {
  2393. self.setDate(aNumber);
  2394. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},smalltalk.Date)})},
  2395. args: ["aNumber"],
  2396. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2397. messageSends: [],
  2398. referencedClasses: []
  2399. }),
  2400. smalltalk.Date);
  2401. smalltalk.addMethod(
  2402. smalltalk.method({
  2403. selector: "dayOfWeek",
  2404. category: 'accessing',
  2405. fn: function (){
  2406. var self=this;
  2407. return smalltalk.withContext(function($ctx1) {
  2408. return self.getDay() + 1;
  2409. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},smalltalk.Date)})},
  2410. args: [],
  2411. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2412. messageSends: [],
  2413. referencedClasses: []
  2414. }),
  2415. smalltalk.Date);
  2416. smalltalk.addMethod(
  2417. smalltalk.method({
  2418. selector: "dayOfWeek:",
  2419. category: 'accessing',
  2420. fn: function (aNumber){
  2421. var self=this;
  2422. return smalltalk.withContext(function($ctx1) {
  2423. return self.setDay(aNumber - 1);
  2424. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},smalltalk.Date)})},
  2425. args: ["aNumber"],
  2426. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2427. messageSends: [],
  2428. referencedClasses: []
  2429. }),
  2430. smalltalk.Date);
  2431. smalltalk.addMethod(
  2432. smalltalk.method({
  2433. selector: "hours",
  2434. category: 'accessing',
  2435. fn: function (){
  2436. var self=this;
  2437. return smalltalk.withContext(function($ctx1) {
  2438. return self.getHours();
  2439. return self}, function($ctx1) {$ctx1.fill(self,"hours",{},smalltalk.Date)})},
  2440. args: [],
  2441. source: "hours\x0a\x09<return self.getHours()>",
  2442. messageSends: [],
  2443. referencedClasses: []
  2444. }),
  2445. smalltalk.Date);
  2446. smalltalk.addMethod(
  2447. smalltalk.method({
  2448. selector: "hours:",
  2449. category: 'accessing',
  2450. fn: function (aNumber){
  2451. var self=this;
  2452. return smalltalk.withContext(function($ctx1) {
  2453. self.setHours(aNumber);
  2454. return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},smalltalk.Date)})},
  2455. args: ["aNumber"],
  2456. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2457. messageSends: [],
  2458. referencedClasses: []
  2459. }),
  2460. smalltalk.Date);
  2461. smalltalk.addMethod(
  2462. smalltalk.method({
  2463. selector: "milliseconds",
  2464. category: 'accessing',
  2465. fn: function (){
  2466. var self=this;
  2467. return smalltalk.withContext(function($ctx1) {
  2468. return self.getMilliseconds();
  2469. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},smalltalk.Date)})},
  2470. args: [],
  2471. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2472. messageSends: [],
  2473. referencedClasses: []
  2474. }),
  2475. smalltalk.Date);
  2476. smalltalk.addMethod(
  2477. smalltalk.method({
  2478. selector: "milliseconds:",
  2479. category: 'accessing',
  2480. fn: function (aNumber){
  2481. var self=this;
  2482. return smalltalk.withContext(function($ctx1) {
  2483. self.setMilliseconds(aNumber);
  2484. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},smalltalk.Date)})},
  2485. args: ["aNumber"],
  2486. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  2487. messageSends: [],
  2488. referencedClasses: []
  2489. }),
  2490. smalltalk.Date);
  2491. smalltalk.addMethod(
  2492. smalltalk.method({
  2493. selector: "minutes",
  2494. category: 'accessing',
  2495. fn: function (){
  2496. var self=this;
  2497. return smalltalk.withContext(function($ctx1) {
  2498. return self.getMinutes();
  2499. return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},smalltalk.Date)})},
  2500. args: [],
  2501. source: "minutes\x0a\x09<return self.getMinutes()>",
  2502. messageSends: [],
  2503. referencedClasses: []
  2504. }),
  2505. smalltalk.Date);
  2506. smalltalk.addMethod(
  2507. smalltalk.method({
  2508. selector: "minutes:",
  2509. category: 'accessing',
  2510. fn: function (aNumber){
  2511. var self=this;
  2512. return smalltalk.withContext(function($ctx1) {
  2513. self.setMinutes(aNumber);
  2514. return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},smalltalk.Date)})},
  2515. args: ["aNumber"],
  2516. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  2517. messageSends: [],
  2518. referencedClasses: []
  2519. }),
  2520. smalltalk.Date);
  2521. smalltalk.addMethod(
  2522. smalltalk.method({
  2523. selector: "month",
  2524. category: 'accessing',
  2525. fn: function (){
  2526. var self=this;
  2527. return smalltalk.withContext(function($ctx1) {
  2528. return self.getMonth() + 1;
  2529. return self}, function($ctx1) {$ctx1.fill(self,"month",{},smalltalk.Date)})},
  2530. args: [],
  2531. source: "month\x0a\x09<return self.getMonth() + 1>",
  2532. messageSends: [],
  2533. referencedClasses: []
  2534. }),
  2535. smalltalk.Date);
  2536. smalltalk.addMethod(
  2537. smalltalk.method({
  2538. selector: "month:",
  2539. category: 'accessing',
  2540. fn: function (aNumber){
  2541. var self=this;
  2542. return smalltalk.withContext(function($ctx1) {
  2543. self.setMonth(aNumber - 1);
  2544. return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},smalltalk.Date)})},
  2545. args: ["aNumber"],
  2546. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  2547. messageSends: [],
  2548. referencedClasses: []
  2549. }),
  2550. smalltalk.Date);
  2551. smalltalk.addMethod(
  2552. smalltalk.method({
  2553. selector: "printOn:",
  2554. category: 'printing',
  2555. fn: function (aStream){
  2556. var self=this;
  2557. return smalltalk.withContext(function($ctx1) {
  2558. _st(aStream)._nextPutAll_(self._asString());
  2559. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Date)})},
  2560. args: ["aStream"],
  2561. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2562. messageSends: ["nextPutAll:", "asString"],
  2563. referencedClasses: []
  2564. }),
  2565. smalltalk.Date);
  2566. smalltalk.addMethod(
  2567. smalltalk.method({
  2568. selector: "seconds",
  2569. category: 'accessing',
  2570. fn: function (){
  2571. var self=this;
  2572. return smalltalk.withContext(function($ctx1) {
  2573. return self.getSeconds();
  2574. return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},smalltalk.Date)})},
  2575. args: [],
  2576. source: "seconds\x0a\x09<return self.getSeconds()>",
  2577. messageSends: [],
  2578. referencedClasses: []
  2579. }),
  2580. smalltalk.Date);
  2581. smalltalk.addMethod(
  2582. smalltalk.method({
  2583. selector: "seconds:",
  2584. category: 'accessing',
  2585. fn: function (aNumber){
  2586. var self=this;
  2587. return smalltalk.withContext(function($ctx1) {
  2588. self.setSeconds(aNumber);
  2589. return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},smalltalk.Date)})},
  2590. args: ["aNumber"],
  2591. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  2592. messageSends: [],
  2593. referencedClasses: []
  2594. }),
  2595. smalltalk.Date);
  2596. smalltalk.addMethod(
  2597. smalltalk.method({
  2598. selector: "time",
  2599. category: 'accessing',
  2600. fn: function (){
  2601. var self=this;
  2602. return smalltalk.withContext(function($ctx1) {
  2603. return self.getTime();
  2604. return self}, function($ctx1) {$ctx1.fill(self,"time",{},smalltalk.Date)})},
  2605. args: [],
  2606. source: "time\x0a\x09<return self.getTime()>",
  2607. messageSends: [],
  2608. referencedClasses: []
  2609. }),
  2610. smalltalk.Date);
  2611. smalltalk.addMethod(
  2612. smalltalk.method({
  2613. selector: "time:",
  2614. category: 'accessing',
  2615. fn: function (aNumber){
  2616. var self=this;
  2617. return smalltalk.withContext(function($ctx1) {
  2618. self.setTime(aNumber);
  2619. return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},smalltalk.Date)})},
  2620. args: ["aNumber"],
  2621. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  2622. messageSends: [],
  2623. referencedClasses: []
  2624. }),
  2625. smalltalk.Date);
  2626. smalltalk.addMethod(
  2627. smalltalk.method({
  2628. selector: "year",
  2629. category: 'accessing',
  2630. fn: function (){
  2631. var self=this;
  2632. return smalltalk.withContext(function($ctx1) {
  2633. return self.getFullYear();
  2634. return self}, function($ctx1) {$ctx1.fill(self,"year",{},smalltalk.Date)})},
  2635. args: [],
  2636. source: "year\x0a\x09<return self.getFullYear()>",
  2637. messageSends: [],
  2638. referencedClasses: []
  2639. }),
  2640. smalltalk.Date);
  2641. smalltalk.addMethod(
  2642. smalltalk.method({
  2643. selector: "year:",
  2644. category: 'accessing',
  2645. fn: function (aNumber){
  2646. var self=this;
  2647. return smalltalk.withContext(function($ctx1) {
  2648. self.setFullYear(aNumber);
  2649. return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},smalltalk.Date)})},
  2650. args: ["aNumber"],
  2651. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  2652. messageSends: [],
  2653. referencedClasses: []
  2654. }),
  2655. smalltalk.Date);
  2656. smalltalk.addMethod(
  2657. smalltalk.method({
  2658. selector: "fromMilliseconds:",
  2659. category: 'instance creation',
  2660. fn: function (aNumber){
  2661. var self=this;
  2662. return smalltalk.withContext(function($ctx1) {
  2663. var $1;
  2664. $1=self._new_(aNumber);
  2665. return $1;
  2666. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  2667. args: ["aNumber"],
  2668. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  2669. messageSends: ["new:"],
  2670. referencedClasses: []
  2671. }),
  2672. smalltalk.Date.klass);
  2673. smalltalk.addMethod(
  2674. smalltalk.method({
  2675. selector: "fromSeconds:",
  2676. category: 'instance creation',
  2677. fn: function (aNumber){
  2678. var self=this;
  2679. return smalltalk.withContext(function($ctx1) {
  2680. var $1;
  2681. $1=self._fromMilliseconds_(_st(aNumber).__star((1000)));
  2682. return $1;
  2683. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  2684. args: ["aNumber"],
  2685. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  2686. messageSends: ["fromMilliseconds:", "*"],
  2687. referencedClasses: []
  2688. }),
  2689. smalltalk.Date.klass);
  2690. smalltalk.addMethod(
  2691. smalltalk.method({
  2692. selector: "fromString:",
  2693. category: 'instance creation',
  2694. fn: function (aString){
  2695. var self=this;
  2696. return smalltalk.withContext(function($ctx1) {
  2697. var $1;
  2698. $1=self._new_(aString);
  2699. return $1;
  2700. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.Date.klass)})},
  2701. args: ["aString"],
  2702. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  2703. messageSends: ["new:"],
  2704. referencedClasses: []
  2705. }),
  2706. smalltalk.Date.klass);
  2707. smalltalk.addMethod(
  2708. smalltalk.method({
  2709. selector: "heliosClass",
  2710. category: 'helios',
  2711. fn: function (){
  2712. var self=this;
  2713. return smalltalk.withContext(function($ctx1) {
  2714. return "magnitude";
  2715. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Date.klass)})},
  2716. args: [],
  2717. source: "heliosClass\x0a\x09^ 'magnitude'",
  2718. messageSends: [],
  2719. referencedClasses: []
  2720. }),
  2721. smalltalk.Date.klass);
  2722. smalltalk.addMethod(
  2723. smalltalk.method({
  2724. selector: "millisecondsToRun:",
  2725. category: 'instance creation',
  2726. fn: function (aBlock){
  2727. var self=this;
  2728. var t;
  2729. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  2730. return smalltalk.withContext(function($ctx1) {
  2731. var $1;
  2732. t=_st($Date())._now();
  2733. _st(aBlock)._value();
  2734. $1=_st(_st($Date())._now()).__minus(t);
  2735. return $1;
  2736. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},smalltalk.Date.klass)})},
  2737. args: ["aBlock"],
  2738. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  2739. messageSends: ["now", "value", "-"],
  2740. referencedClasses: ["Date"]
  2741. }),
  2742. smalltalk.Date.klass);
  2743. smalltalk.addMethod(
  2744. smalltalk.method({
  2745. selector: "new:",
  2746. category: 'instance creation',
  2747. fn: function (anObject){
  2748. var self=this;
  2749. return smalltalk.withContext(function($ctx1) {
  2750. return new Date(anObject);
  2751. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},smalltalk.Date.klass)})},
  2752. args: ["anObject"],
  2753. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  2754. messageSends: [],
  2755. referencedClasses: []
  2756. }),
  2757. smalltalk.Date.klass);
  2758. smalltalk.addMethod(
  2759. smalltalk.method({
  2760. selector: "now",
  2761. category: 'instance creation',
  2762. fn: function (){
  2763. var self=this;
  2764. return smalltalk.withContext(function($ctx1) {
  2765. var $1;
  2766. $1=self._today();
  2767. return $1;
  2768. }, function($ctx1) {$ctx1.fill(self,"now",{},smalltalk.Date.klass)})},
  2769. args: [],
  2770. source: "now\x0a\x09^self today",
  2771. messageSends: ["today"],
  2772. referencedClasses: []
  2773. }),
  2774. smalltalk.Date.klass);
  2775. smalltalk.addMethod(
  2776. smalltalk.method({
  2777. selector: "today",
  2778. category: 'instance creation',
  2779. fn: function (){
  2780. var self=this;
  2781. return smalltalk.withContext(function($ctx1) {
  2782. var $1;
  2783. $1=self._new();
  2784. return $1;
  2785. }, function($ctx1) {$ctx1.fill(self,"today",{},smalltalk.Date.klass)})},
  2786. args: [],
  2787. source: "today\x0a\x09^self new",
  2788. messageSends: ["new"],
  2789. referencedClasses: []
  2790. }),
  2791. smalltalk.Date.klass);
  2792. smalltalk.addClass('Environment', smalltalk.Object, [], 'Kernel-Objects');
  2793. 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.";
  2794. smalltalk.addMethod(
  2795. smalltalk.method({
  2796. selector: "addInstVarNamed:to:",
  2797. category: 'compiling',
  2798. fn: function (aString,aClass){
  2799. var self=this;
  2800. return smalltalk.withContext(function($ctx1) {
  2801. var $1,$2;
  2802. $1=_st(_st(aClass)._instanceVariableNames())._copy();
  2803. _st($1)._add_(aString);
  2804. $2=_st($1)._yourself();
  2805. _st(self._classBuilder())._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),_st(aClass)._name(),$2,_st(_st(aClass)._package())._name());
  2806. return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  2807. args: ["aString", "aClass"],
  2808. 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",
  2809. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package", "classBuilder"],
  2810. referencedClasses: []
  2811. }),
  2812. smalltalk.Environment);
  2813. smalltalk.addMethod(
  2814. smalltalk.method({
  2815. selector: "allSelectors",
  2816. category: 'accessing',
  2817. fn: function (){
  2818. var self=this;
  2819. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2820. return smalltalk.withContext(function($ctx1) {
  2821. var $1;
  2822. $1=_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value();
  2823. return $1;
  2824. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Environment)})},
  2825. args: [],
  2826. source: "allSelectors\x0a\x09^ (Smalltalk current at: 'allSelectors') value",
  2827. messageSends: ["value", "at:", "current"],
  2828. referencedClasses: ["Smalltalk"]
  2829. }),
  2830. smalltalk.Environment);
  2831. smalltalk.addMethod(
  2832. smalltalk.method({
  2833. selector: "availableClassNames",
  2834. category: 'accessing',
  2835. fn: function (){
  2836. var self=this;
  2837. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2838. return smalltalk.withContext(function($ctx1) {
  2839. var $1;
  2840. $1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
  2841. return smalltalk.withContext(function($ctx2) {
  2842. return _st(each)._name();
  2843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2844. return $1;
  2845. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.Environment)})},
  2846. args: [],
  2847. source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]",
  2848. messageSends: ["collect:", "name", "classes", "current"],
  2849. referencedClasses: ["Smalltalk"]
  2850. }),
  2851. smalltalk.Environment);
  2852. smalltalk.addMethod(
  2853. smalltalk.method({
  2854. selector: "availablePackageNames",
  2855. category: 'accessing',
  2856. fn: function (){
  2857. var self=this;
  2858. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2859. return smalltalk.withContext(function($ctx1) {
  2860. var $1;
  2861. $1=_st(_st(_st($Smalltalk())._current())._packages())._collect_((function(each){
  2862. return smalltalk.withContext(function($ctx2) {
  2863. return _st(each)._name();
  2864. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2865. return $1;
  2866. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.Environment)})},
  2867. args: [],
  2868. source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]",
  2869. messageSends: ["collect:", "name", "packages", "current"],
  2870. referencedClasses: ["Smalltalk"]
  2871. }),
  2872. smalltalk.Environment);
  2873. smalltalk.addMethod(
  2874. smalltalk.method({
  2875. selector: "availableProtocolsFor:",
  2876. category: 'accessing',
  2877. fn: function (aClass){
  2878. var self=this;
  2879. var protocols;
  2880. return smalltalk.withContext(function($ctx1) {
  2881. var $1,$2;
  2882. protocols=_st(aClass)._protocols();
  2883. $1=_st(aClass)._superclass();
  2884. if(($receiver = $1) == nil || $receiver == undefined){
  2885. $1;
  2886. } else {
  2887. _st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
  2888. };
  2889. $2=_st(_st(protocols)._asSet())._asArray();
  2890. return $2;
  2891. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.Environment)})},
  2892. args: ["aClass"],
  2893. 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",
  2894. messageSends: ["protocols", "ifNotNil:", "addAll:", "availableProtocolsFor:", "superclass", "asArray", "asSet"],
  2895. referencedClasses: []
  2896. }),
  2897. smalltalk.Environment);
  2898. smalltalk.addMethod(
  2899. smalltalk.method({
  2900. selector: "classBuilder",
  2901. category: 'accessing',
  2902. fn: function (){
  2903. var self=this;
  2904. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  2905. return smalltalk.withContext(function($ctx1) {
  2906. var $1;
  2907. $1=_st($ClassBuilder())._new();
  2908. return $1;
  2909. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},smalltalk.Environment)})},
  2910. args: [],
  2911. source: "classBuilder\x0a\x09^ ClassBuilder new",
  2912. messageSends: ["new"],
  2913. referencedClasses: ["ClassBuilder"]
  2914. }),
  2915. smalltalk.Environment);
  2916. smalltalk.addMethod(
  2917. smalltalk.method({
  2918. selector: "classNamed:",
  2919. category: 'accessing',
  2920. fn: function (aString){
  2921. var self=this;
  2922. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2923. return smalltalk.withContext(function($ctx1) {
  2924. var $2,$1;
  2925. $2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol());
  2926. if(($receiver = $2) == nil || $receiver == undefined){
  2927. $1=self._error_("Invalid class name");
  2928. } else {
  2929. $1=$2;
  2930. };
  2931. return $1;
  2932. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.Environment)})},
  2933. args: ["aString"],
  2934. source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  2935. messageSends: ["ifNil:", "error:", "at:", "asSymbol", "current"],
  2936. referencedClasses: ["Smalltalk"]
  2937. }),
  2938. smalltalk.Environment);
  2939. smalltalk.addMethod(
  2940. smalltalk.method({
  2941. selector: "classes",
  2942. category: 'accessing',
  2943. fn: function (){
  2944. var self=this;
  2945. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2946. return smalltalk.withContext(function($ctx1) {
  2947. var $1;
  2948. $1=_st(_st($Smalltalk())._current())._classes();
  2949. return $1;
  2950. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Environment)})},
  2951. args: [],
  2952. source: "classes\x0a\x09^ Smalltalk current classes",
  2953. messageSends: ["classes", "current"],
  2954. referencedClasses: ["Smalltalk"]
  2955. }),
  2956. smalltalk.Environment);
  2957. smalltalk.addMethod(
  2958. smalltalk.method({
  2959. selector: "commitPackage:",
  2960. category: 'actions',
  2961. fn: function (aPackage){
  2962. var self=this;
  2963. return smalltalk.withContext(function($ctx1) {
  2964. _st(aPackage)._commit();
  2965. return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},smalltalk.Environment)})},
  2966. args: ["aPackage"],
  2967. source: "commitPackage: aPackage\x0a\x09aPackage commit",
  2968. messageSends: ["commit"],
  2969. referencedClasses: []
  2970. }),
  2971. smalltalk.Environment);
  2972. smalltalk.addMethod(
  2973. smalltalk.method({
  2974. selector: "compileClassComment:for:",
  2975. category: 'compiling',
  2976. fn: function (aString,aClass){
  2977. var self=this;
  2978. return smalltalk.withContext(function($ctx1) {
  2979. _st(aClass)._comment_(aString);
  2980. return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  2981. args: ["aString", "aClass"],
  2982. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  2983. messageSends: ["comment:"],
  2984. referencedClasses: []
  2985. }),
  2986. smalltalk.Environment);
  2987. smalltalk.addMethod(
  2988. smalltalk.method({
  2989. selector: "compileClassDefinition:",
  2990. category: 'compiling',
  2991. fn: function (aString){
  2992. var self=this;
  2993. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  2994. return smalltalk.withContext(function($ctx1) {
  2995. self._eval_on_(aString,_st($DoIt())._new());
  2996. return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},smalltalk.Environment)})},
  2997. args: ["aString"],
  2998. source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new",
  2999. messageSends: ["eval:on:", "new"],
  3000. referencedClasses: ["DoIt"]
  3001. }),
  3002. smalltalk.Environment);
  3003. smalltalk.addMethod(
  3004. smalltalk.method({
  3005. selector: "compileMethod:for:protocol:",
  3006. category: 'compiling',
  3007. fn: function (sourceCode,class_,protocol){
  3008. var self=this;
  3009. return smalltalk.withContext(function($ctx1) {
  3010. var $1;
  3011. $1=_st(class_)._compile_category_(sourceCode,protocol);
  3012. return $1;
  3013. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},smalltalk.Environment)})},
  3014. args: ["sourceCode", "class", "protocol"],
  3015. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09category: protocol",
  3016. messageSends: ["compile:category:"],
  3017. referencedClasses: []
  3018. }),
  3019. smalltalk.Environment);
  3020. smalltalk.addMethod(
  3021. smalltalk.method({
  3022. selector: "copyClass:to:",
  3023. category: 'actions',
  3024. fn: function (aClass,aClassName){
  3025. var self=this;
  3026. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3027. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  3028. return smalltalk.withContext(function($ctx1) {
  3029. var $1;
  3030. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  3031. if(($receiver = $1) == nil || $receiver == undefined){
  3032. $1;
  3033. } else {
  3034. self._error_(_st("A class named ".__comma(aClassName)).__comma(" already exists"));
  3035. };
  3036. _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  3037. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
  3038. args: ["aClass", "aClassName"],
  3039. 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",
  3040. messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "copyClass:named:", "new"],
  3041. referencedClasses: ["Smalltalk", "ClassBuilder"]
  3042. }),
  3043. smalltalk.Environment);
  3044. smalltalk.addMethod(
  3045. smalltalk.method({
  3046. selector: "eval:on:",
  3047. category: 'actions',
  3048. fn: function (aString,aReceiver){
  3049. var self=this;
  3050. var compiler;
  3051. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  3052. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3053. return smalltalk.withContext(function($ctx1) {
  3054. var $1,$2;
  3055. var $early={};
  3056. try {
  3057. compiler=_st($Compiler())._new();
  3058. _st((function(){
  3059. return smalltalk.withContext(function($ctx2) {
  3060. return _st(compiler)._parseExpression_(aString);
  3061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  3062. return smalltalk.withContext(function($ctx2) {
  3063. $1=_st(window)._alert_(_st(ex)._messageText());
  3064. throw $early=[$1];
  3065. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  3066. $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver);
  3067. return $2;
  3068. }
  3069. catch(e) {if(e===$early)return e[0]; throw e}
  3070. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler},smalltalk.Environment)})},
  3071. args: ["aString", "aReceiver"],
  3072. source: "eval: aString on: aReceiver\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ window alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
  3073. messageSends: ["new", "on:do:", "alert:", "messageText", "parseExpression:", "evaluateExpression:on:"],
  3074. referencedClasses: ["Compiler", "Error"]
  3075. }),
  3076. smalltalk.Environment);
  3077. smalltalk.addMethod(
  3078. smalltalk.method({
  3079. selector: "evaluate:on:do:",
  3080. category: 'error handling',
  3081. fn: function (aBlock,anErrorClass,exceptionBlock){
  3082. var self=this;
  3083. return smalltalk.withContext(function($ctx1) {
  3084. var $1;
  3085. self._try_catch_(aBlock,(function(exception){
  3086. return smalltalk.withContext(function($ctx2) {
  3087. $1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
  3088. if(smalltalk.assert($1)){
  3089. return _st(exceptionBlock)._value_(exception);
  3090. } else {
  3091. return _st(exception)._signal();
  3092. };
  3093. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})}));
  3094. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},smalltalk.Environment)})},
  3095. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  3096. 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 ] ]",
  3097. messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:", "classNamed:", "name"],
  3098. referencedClasses: []
  3099. }),
  3100. smalltalk.Environment);
  3101. smalltalk.addMethod(
  3102. smalltalk.method({
  3103. selector: "inspect:",
  3104. category: 'actions',
  3105. fn: function (anObject){
  3106. var self=this;
  3107. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  3108. return smalltalk.withContext(function($ctx1) {
  3109. _st(_st($InspectorHandler())._inspector())._inspect_(anObject);
  3110. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Environment)})},
  3111. args: ["anObject"],
  3112. source: "inspect: anObject\x0a\x09InspectorHandler inspector inspect: anObject",
  3113. messageSends: ["inspect:", "inspector"],
  3114. referencedClasses: ["InspectorHandler"]
  3115. }),
  3116. smalltalk.Environment);
  3117. smalltalk.addMethod(
  3118. smalltalk.method({
  3119. selector: "moveClass:toPackage:",
  3120. category: 'actions',
  3121. fn: function (aClass,aPackageName){
  3122. var self=this;
  3123. var package_;
  3124. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  3125. return smalltalk.withContext(function($ctx1) {
  3126. var $1,$2,$3;
  3127. package_=_st($Package())._named_(aPackageName);
  3128. $1=package_;
  3129. if(($receiver = $1) == nil || $receiver == undefined){
  3130. self._error_("Invalid package name");
  3131. } else {
  3132. $1;
  3133. };
  3134. $2=_st(package_).__eq_eq(_st(aClass)._package());
  3135. if(smalltalk.assert($2)){
  3136. $3=self;
  3137. return $3;
  3138. };
  3139. _st(aClass)._package_(package_);
  3140. return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},smalltalk.Environment)})},
  3141. args: ["aClass", "aPackageName"],
  3142. 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",
  3143. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
  3144. referencedClasses: ["Package"]
  3145. }),
  3146. smalltalk.Environment);
  3147. smalltalk.addMethod(
  3148. smalltalk.method({
  3149. selector: "moveMethod:toClass:",
  3150. category: 'actions',
  3151. fn: function (aMethod,aClassName){
  3152. var self=this;
  3153. var destinationClass;
  3154. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3155. return smalltalk.withContext(function($ctx1) {
  3156. var $1,$2,$3;
  3157. destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol());
  3158. $1=destinationClass;
  3159. if(($receiver = $1) == nil || $receiver == undefined){
  3160. self._error_("Invalid class name");
  3161. } else {
  3162. $1;
  3163. };
  3164. $2=_st(destinationClass).__eq_eq(_st(aMethod)._methodClass());
  3165. if(smalltalk.assert($2)){
  3166. $3=self;
  3167. return $3;
  3168. };
  3169. _st(destinationClass)._compile_category_(_st(aMethod)._source(),_st(aMethod)._protocol());
  3170. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  3171. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},smalltalk.Environment)})},
  3172. args: ["aMethod", "aClassName"],
  3173. 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",
  3174. messageSends: ["at:", "asSymbol", "current", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:category:", "source", "protocol", "removeCompiledMethod:"],
  3175. referencedClasses: ["Smalltalk"]
  3176. }),
  3177. smalltalk.Environment);
  3178. smalltalk.addMethod(
  3179. smalltalk.method({
  3180. selector: "moveMethod:toProtocol:",
  3181. category: 'actions',
  3182. fn: function (aMethod,aProtocol){
  3183. var self=this;
  3184. return smalltalk.withContext(function($ctx1) {
  3185. _st(aMethod)._category_(aProtocol);
  3186. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},smalltalk.Environment)})},
  3187. args: ["aMethod", "aProtocol"],
  3188. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod category: aProtocol",
  3189. messageSends: ["category:"],
  3190. referencedClasses: []
  3191. }),
  3192. smalltalk.Environment);
  3193. smalltalk.addMethod(
  3194. smalltalk.method({
  3195. selector: "packages",
  3196. category: 'accessing',
  3197. fn: function (){
  3198. var self=this;
  3199. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3200. return smalltalk.withContext(function($ctx1) {
  3201. var $1;
  3202. $1=_st(_st($Smalltalk())._current())._packages();
  3203. return $1;
  3204. }, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Environment)})},
  3205. args: [],
  3206. source: "packages\x0a\x09^ Smalltalk current packages",
  3207. messageSends: ["packages", "current"],
  3208. referencedClasses: ["Smalltalk"]
  3209. }),
  3210. smalltalk.Environment);
  3211. smalltalk.addMethod(
  3212. smalltalk.method({
  3213. selector: "registerErrorHandler:",
  3214. category: 'actions',
  3215. fn: function (anErrorHandler){
  3216. var self=this;
  3217. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  3218. return smalltalk.withContext(function($ctx1) {
  3219. _st($ErrorHandler())._setCurrent_(anErrorHandler);
  3220. return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},smalltalk.Environment)})},
  3221. args: ["anErrorHandler"],
  3222. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler setCurrent: anErrorHandler",
  3223. messageSends: ["setCurrent:"],
  3224. referencedClasses: ["ErrorHandler"]
  3225. }),
  3226. smalltalk.Environment);
  3227. smalltalk.addMethod(
  3228. smalltalk.method({
  3229. selector: "registerInspector:",
  3230. category: 'actions',
  3231. fn: function (anInspector){
  3232. var self=this;
  3233. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  3234. return smalltalk.withContext(function($ctx1) {
  3235. _st($InspectorHandler())._register_(anInspector);
  3236. return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},smalltalk.Environment)})},
  3237. args: ["anInspector"],
  3238. source: "registerInspector: anInspector\x0a\x09InspectorHandler register: anInspector",
  3239. messageSends: ["register:"],
  3240. referencedClasses: ["InspectorHandler"]
  3241. }),
  3242. smalltalk.Environment);
  3243. smalltalk.addMethod(
  3244. smalltalk.method({
  3245. selector: "registerProgressHandler:",
  3246. category: 'actions',
  3247. fn: function (aProgressHandler){
  3248. var self=this;
  3249. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  3250. return smalltalk.withContext(function($ctx1) {
  3251. _st($ProgressHandler())._setCurrent_(aProgressHandler);
  3252. return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},smalltalk.Environment)})},
  3253. args: ["aProgressHandler"],
  3254. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler setCurrent: aProgressHandler",
  3255. messageSends: ["setCurrent:"],
  3256. referencedClasses: ["ProgressHandler"]
  3257. }),
  3258. smalltalk.Environment);
  3259. smalltalk.addMethod(
  3260. smalltalk.method({
  3261. selector: "removeClass:",
  3262. category: 'actions',
  3263. fn: function (aClass){
  3264. var self=this;
  3265. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3266. return smalltalk.withContext(function($ctx1) {
  3267. _st(_st($Smalltalk())._current())._removeClass_(aClass);
  3268. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Environment)})},
  3269. args: ["aClass"],
  3270. source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass",
  3271. messageSends: ["removeClass:", "current"],
  3272. referencedClasses: ["Smalltalk"]
  3273. }),
  3274. smalltalk.Environment);
  3275. smalltalk.addMethod(
  3276. smalltalk.method({
  3277. selector: "removeMethod:",
  3278. category: 'actions',
  3279. fn: function (aMethod){
  3280. var self=this;
  3281. return smalltalk.withContext(function($ctx1) {
  3282. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  3283. return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},smalltalk.Environment)})},
  3284. args: ["aMethod"],
  3285. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  3286. messageSends: ["removeCompiledMethod:", "methodClass"],
  3287. referencedClasses: []
  3288. }),
  3289. smalltalk.Environment);
  3290. smalltalk.addMethod(
  3291. smalltalk.method({
  3292. selector: "removeProtocol:from:",
  3293. category: 'actions',
  3294. fn: function (aString,aClass){
  3295. var self=this;
  3296. return smalltalk.withContext(function($ctx1) {
  3297. _st(_st(_st(aClass)._methods())._select_((function(each){
  3298. return smalltalk.withContext(function($ctx2) {
  3299. return _st(_st(each)._protocol()).__eq(aString);
  3300. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){
  3301. return smalltalk.withContext(function($ctx2) {
  3302. return _st(aClass)._removeCompiledMethod_(each);
  3303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3304. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  3305. args: ["aString", "aClass"],
  3306. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  3307. messageSends: ["do:", "removeCompiledMethod:", "select:", "=", "protocol", "methods"],
  3308. referencedClasses: []
  3309. }),
  3310. smalltalk.Environment);
  3311. smalltalk.addMethod(
  3312. smalltalk.method({
  3313. selector: "renameClass:to:",
  3314. category: 'actions',
  3315. fn: function (aClass,aClassName){
  3316. var self=this;
  3317. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3318. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  3319. return smalltalk.withContext(function($ctx1) {
  3320. var $1;
  3321. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  3322. if(($receiver = $1) == nil || $receiver == undefined){
  3323. $1;
  3324. } else {
  3325. self._error_(_st("A class named ".__comma(aClassName)).__comma(" already exists"));
  3326. };
  3327. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  3328. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
  3329. args: ["aClass", "aClassName"],
  3330. 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",
  3331. messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "renameClass:to:", "new"],
  3332. referencedClasses: ["Smalltalk", "ClassBuilder"]
  3333. }),
  3334. smalltalk.Environment);
  3335. smalltalk.addMethod(
  3336. smalltalk.method({
  3337. selector: "renameProtocol:to:in:",
  3338. category: 'actions',
  3339. fn: function (aString,anotherString,aClass){
  3340. var self=this;
  3341. return smalltalk.withContext(function($ctx1) {
  3342. _st(_st(_st(aClass)._methods())._select_((function(each){
  3343. return smalltalk.withContext(function($ctx2) {
  3344. return _st(_st(each)._protocol()).__eq(aString);
  3345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){
  3346. return smalltalk.withContext(function($ctx2) {
  3347. return _st(each)._protocol_(anotherString);
  3348. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3349. return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},smalltalk.Environment)})},
  3350. args: ["aString", "anotherString", "aClass"],
  3351. 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 ]",
  3352. messageSends: ["do:", "protocol:", "select:", "=", "protocol", "methods"],
  3353. referencedClasses: []
  3354. }),
  3355. smalltalk.Environment);
  3356. smalltalk.addMethod(
  3357. smalltalk.method({
  3358. selector: "setClassCommentOf:to:",
  3359. category: 'actions',
  3360. fn: function (aClass,aString){
  3361. var self=this;
  3362. return smalltalk.withContext(function($ctx1) {
  3363. _st(aClass)._comment_(aString);
  3364. return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},smalltalk.Environment)})},
  3365. args: ["aClass", "aString"],
  3366. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  3367. messageSends: ["comment:"],
  3368. referencedClasses: []
  3369. }),
  3370. smalltalk.Environment);
  3371. smalltalk.addMethod(
  3372. smalltalk.method({
  3373. selector: "systemAnnouncer",
  3374. category: 'accessing',
  3375. fn: function (){
  3376. var self=this;
  3377. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3378. return smalltalk.withContext(function($ctx1) {
  3379. var $1;
  3380. $1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current();
  3381. return $1;
  3382. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},smalltalk.Environment)})},
  3383. args: [],
  3384. source: "systemAnnouncer\x0a\x09^ (Smalltalk current at: #SystemAnnouncer) current",
  3385. messageSends: ["current", "at:"],
  3386. referencedClasses: ["Smalltalk"]
  3387. }),
  3388. smalltalk.Environment);
  3389. smalltalk.addClass('InspectorHandler', smalltalk.Object, [], 'Kernel-Objects');
  3390. 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.";
  3391. smalltalk.InspectorHandler.klass.iVarNames = ['inspector'];
  3392. smalltalk.addMethod(
  3393. smalltalk.method({
  3394. selector: "inspect:",
  3395. category: 'registration',
  3396. fn: function (anObject){
  3397. var self=this;
  3398. return smalltalk.withContext(function($ctx1) {
  3399. var $1;
  3400. $1=_st(self._inspector())._inspect_(anObject);
  3401. return $1;
  3402. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.InspectorHandler.klass)})},
  3403. args: ["anObject"],
  3404. source: "inspect: anObject\x0a\x09^ self inspector inspect: anObject",
  3405. messageSends: ["inspect:", "inspector"],
  3406. referencedClasses: []
  3407. }),
  3408. smalltalk.InspectorHandler.klass);
  3409. smalltalk.addMethod(
  3410. smalltalk.method({
  3411. selector: "inspector",
  3412. category: 'accessing',
  3413. fn: function (){
  3414. var self=this;
  3415. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  3416. return smalltalk.withContext(function($ctx1) {
  3417. var $2,$1;
  3418. $2=self["@inspector"];
  3419. if(($receiver = $2) == nil || $receiver == undefined){
  3420. self["@inspector"]=$Transcript();
  3421. $1=self["@inspector"];
  3422. } else {
  3423. $1=$2;
  3424. };
  3425. return $1;
  3426. }, function($ctx1) {$ctx1.fill(self,"inspector",{},smalltalk.InspectorHandler.klass)})},
  3427. args: [],
  3428. source: "inspector\x0a\x09^ inspector ifNil: [ inspector := Transcript ]",
  3429. messageSends: ["ifNil:"],
  3430. referencedClasses: ["Transcript"]
  3431. }),
  3432. smalltalk.InspectorHandler.klass);
  3433. smalltalk.addMethod(
  3434. smalltalk.method({
  3435. selector: "register:",
  3436. category: 'registration',
  3437. fn: function (anInspector){
  3438. var self=this;
  3439. return smalltalk.withContext(function($ctx1) {
  3440. self["@inspector"]=anInspector;
  3441. return self}, function($ctx1) {$ctx1.fill(self,"register:",{anInspector:anInspector},smalltalk.InspectorHandler.klass)})},
  3442. args: ["anInspector"],
  3443. source: "register: anInspector\x0a\x09inspector := anInspector",
  3444. messageSends: [],
  3445. referencedClasses: []
  3446. }),
  3447. smalltalk.InspectorHandler.klass);
  3448. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  3449. 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`.";
  3450. smalltalk.addMethod(
  3451. smalltalk.method({
  3452. selector: "addObjectVariablesTo:",
  3453. category: 'proxy',
  3454. fn: function (aDictionary){
  3455. var self=this;
  3456. return smalltalk.withContext(function($ctx1) {
  3457. for(var i in self['@jsObject']) {
  3458. aDictionary._at_put_(i, self['@jsObject'][i]);
  3459. }
  3460. ;
  3461. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},smalltalk.JSObjectProxy)})},
  3462. args: ["aDictionary"],
  3463. 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>",
  3464. messageSends: [],
  3465. referencedClasses: []
  3466. }),
  3467. smalltalk.JSObjectProxy);
  3468. smalltalk.addMethod(
  3469. smalltalk.method({
  3470. selector: "at:",
  3471. category: 'accessing',
  3472. fn: function (aString){
  3473. var self=this;
  3474. return smalltalk.withContext(function($ctx1) {
  3475. return self['@jsObject'][aString];
  3476. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.JSObjectProxy)})},
  3477. args: ["aString"],
  3478. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  3479. messageSends: [],
  3480. referencedClasses: []
  3481. }),
  3482. smalltalk.JSObjectProxy);
  3483. smalltalk.addMethod(
  3484. smalltalk.method({
  3485. selector: "at:ifAbsent:",
  3486. category: 'accessing',
  3487. fn: function (aString,aBlock){
  3488. var self=this;
  3489. return smalltalk.withContext(function($ctx1) {
  3490. var obj = self['@jsObject'];
  3491. return aString in obj ? obj[aString] : aBlock._value();
  3492. ;
  3493. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  3494. args: ["aString", "aBlock"],
  3495. 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>",
  3496. messageSends: [],
  3497. referencedClasses: []
  3498. }),
  3499. smalltalk.JSObjectProxy);
  3500. smalltalk.addMethod(
  3501. smalltalk.method({
  3502. selector: "at:ifPresent:",
  3503. category: 'accessing',
  3504. fn: function (aString,aBlock){
  3505. var self=this;
  3506. return smalltalk.withContext(function($ctx1) {
  3507. var obj = self['@jsObject'];
  3508. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  3509. ;
  3510. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  3511. args: ["aString", "aBlock"],
  3512. 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>",
  3513. messageSends: [],
  3514. referencedClasses: []
  3515. }),
  3516. smalltalk.JSObjectProxy);
  3517. smalltalk.addMethod(
  3518. smalltalk.method({
  3519. selector: "at:ifPresent:ifAbsent:",
  3520. category: 'accessing',
  3521. fn: function (aString,aBlock,anotherBlock){
  3522. var self=this;
  3523. return smalltalk.withContext(function($ctx1) {
  3524. var obj = self['@jsObject'];
  3525. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  3526. ;
  3527. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSObjectProxy)})},
  3528. args: ["aString", "aBlock", "anotherBlock"],
  3529. 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>",
  3530. messageSends: [],
  3531. referencedClasses: []
  3532. }),
  3533. smalltalk.JSObjectProxy);
  3534. smalltalk.addMethod(
  3535. smalltalk.method({
  3536. selector: "at:put:",
  3537. category: 'accessing',
  3538. fn: function (aString,anObject){
  3539. var self=this;
  3540. return smalltalk.withContext(function($ctx1) {
  3541. self['@jsObject'][aString] = anObject;
  3542. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.JSObjectProxy)})},
  3543. args: ["aString", "anObject"],
  3544. source: "at: aString put: anObject\x0a\x09<self['@jsObject'][aString] = anObject>",
  3545. messageSends: [],
  3546. referencedClasses: []
  3547. }),
  3548. smalltalk.JSObjectProxy);
  3549. smalltalk.addMethod(
  3550. smalltalk.method({
  3551. selector: "doesNotUnderstand:",
  3552. category: 'proxy',
  3553. fn: function (aMessage){
  3554. var self=this;
  3555. return smalltalk.withContext(function($ctx1) {
  3556. var $2,$1;
  3557. $2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
  3558. if(($receiver = $2) == nil || $receiver == undefined){
  3559. $1=smalltalk.Object.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
  3560. } else {
  3561. var jsSelector;
  3562. jsSelector=$receiver;
  3563. $1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  3564. };
  3565. return $1;
  3566. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.JSObjectProxy)})},
  3567. args: ["aMessage"],
  3568. 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 ]",
  3569. messageSends: ["ifNil:ifNotNil:", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments", "lookupProperty:", "asJavaScriptSelector", "selector"],
  3570. referencedClasses: []
  3571. }),
  3572. smalltalk.JSObjectProxy);
  3573. smalltalk.addMethod(
  3574. smalltalk.method({
  3575. selector: "forwardMessage:withArguments:",
  3576. category: 'proxy',
  3577. fn: function (aString,anArray){
  3578. var self=this;
  3579. return smalltalk.withContext(function($ctx1) {
  3580. return smalltalk.send(self._jsObject(), aString, anArray);
  3581. ;
  3582. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},smalltalk.JSObjectProxy)})},
  3583. args: ["aString", "anArray"],
  3584. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
  3585. messageSends: [],
  3586. referencedClasses: []
  3587. }),
  3588. smalltalk.JSObjectProxy);
  3589. smalltalk.addMethod(
  3590. smalltalk.method({
  3591. selector: "inspectOn:",
  3592. category: 'proxy',
  3593. fn: function (anInspector){
  3594. var self=this;
  3595. var variables;
  3596. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3597. return smalltalk.withContext(function($ctx1) {
  3598. variables=_st($Dictionary())._new();
  3599. _st(variables)._at_put_("#self",self._jsObject());
  3600. _st(anInspector)._setLabel_(self._printString());
  3601. self._addObjectVariablesTo_(variables);
  3602. _st(anInspector)._setVariables_(variables);
  3603. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.JSObjectProxy)})},
  3604. args: ["anInspector"],
  3605. 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",
  3606. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  3607. referencedClasses: ["Dictionary"]
  3608. }),
  3609. smalltalk.JSObjectProxy);
  3610. smalltalk.addMethod(
  3611. smalltalk.method({
  3612. selector: "jsObject",
  3613. category: 'accessing',
  3614. fn: function (){
  3615. var self=this;
  3616. return smalltalk.withContext(function($ctx1) {
  3617. var $1;
  3618. $1=self["@jsObject"];
  3619. return $1;
  3620. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})},
  3621. args: [],
  3622. source: "jsObject\x0a\x09^jsObject",
  3623. messageSends: [],
  3624. referencedClasses: []
  3625. }),
  3626. smalltalk.JSObjectProxy);
  3627. smalltalk.addMethod(
  3628. smalltalk.method({
  3629. selector: "jsObject:",
  3630. category: 'accessing',
  3631. fn: function (aJSObject){
  3632. var self=this;
  3633. return smalltalk.withContext(function($ctx1) {
  3634. self["@jsObject"]=aJSObject;
  3635. return self}, function($ctx1) {$ctx1.fill(self,"jsObject:",{aJSObject:aJSObject},smalltalk.JSObjectProxy)})},
  3636. args: ["aJSObject"],
  3637. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  3638. messageSends: [],
  3639. referencedClasses: []
  3640. }),
  3641. smalltalk.JSObjectProxy);
  3642. smalltalk.addMethod(
  3643. smalltalk.method({
  3644. selector: "keysAndValuesDo:",
  3645. category: 'enumerating',
  3646. fn: function (aBlock){
  3647. var self=this;
  3648. return smalltalk.withContext(function($ctx1) {
  3649. var o = self['@jsObject'];
  3650. for(var i in o) {
  3651. aBlock._value_value_(i, o[i]);
  3652. }
  3653. ;
  3654. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.JSObjectProxy)})},
  3655. args: ["aBlock"],
  3656. 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>",
  3657. messageSends: [],
  3658. referencedClasses: []
  3659. }),
  3660. smalltalk.JSObjectProxy);
  3661. smalltalk.addMethod(
  3662. smalltalk.method({
  3663. selector: "lookupProperty:",
  3664. category: 'accessing',
  3665. fn: function (aString){
  3666. var self=this;
  3667. return smalltalk.withContext(function($ctx1) {
  3668. return aString in self._jsObject() ? aString : nil;
  3669. return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},smalltalk.JSObjectProxy)})},
  3670. args: ["aString"],
  3671. 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>",
  3672. messageSends: [],
  3673. referencedClasses: []
  3674. }),
  3675. smalltalk.JSObjectProxy);
  3676. smalltalk.addMethod(
  3677. smalltalk.method({
  3678. selector: "printOn:",
  3679. category: 'printing',
  3680. fn: function (aStream){
  3681. var self=this;
  3682. return smalltalk.withContext(function($ctx1) {
  3683. _st(aStream)._nextPutAll_(_st(self._jsObject())._toString());
  3684. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})},
  3685. args: ["aStream"],
  3686. source: "printOn: aStream\x0a\x09aStream nextPutAll: self jsObject toString",
  3687. messageSends: ["nextPutAll:", "toString", "jsObject"],
  3688. referencedClasses: []
  3689. }),
  3690. smalltalk.JSObjectProxy);
  3691. smalltalk.addMethod(
  3692. smalltalk.method({
  3693. selector: "value",
  3694. category: 'accessing',
  3695. fn: function (){
  3696. var self=this;
  3697. return smalltalk.withContext(function($ctx1) {
  3698. var $1;
  3699. $1=self._at_ifAbsent_("value",(function(){
  3700. return smalltalk.withContext(function($ctx2) {
  3701. return smalltalk.Object.fn.prototype._value.apply(_st(self), []);
  3702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3703. return $1;
  3704. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.JSObjectProxy)})},
  3705. args: [],
  3706. 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 ]",
  3707. messageSends: ["at:ifAbsent:", "value"],
  3708. referencedClasses: []
  3709. }),
  3710. smalltalk.JSObjectProxy);
  3711. smalltalk.addMethod(
  3712. smalltalk.method({
  3713. selector: "on:",
  3714. category: 'instance creation',
  3715. fn: function (aJSObject){
  3716. var self=this;
  3717. return smalltalk.withContext(function($ctx1) {
  3718. var $2,$3,$1;
  3719. $2=self._new();
  3720. _st($2)._jsObject_(aJSObject);
  3721. $3=_st($2)._yourself();
  3722. $1=$3;
  3723. return $1;
  3724. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},smalltalk.JSObjectProxy.klass)})},
  3725. args: ["aJSObject"],
  3726. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  3727. messageSends: ["jsObject:", "new", "yourself"],
  3728. referencedClasses: []
  3729. }),
  3730. smalltalk.JSObjectProxy.klass);
  3731. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  3732. 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].";
  3733. smalltalk.addMethod(
  3734. smalltalk.method({
  3735. selector: "&",
  3736. category: 'converting',
  3737. fn: function (aNumber){
  3738. var self=this;
  3739. return smalltalk.withContext(function($ctx1) {
  3740. return self & aNumber;
  3741. return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},smalltalk.Number)})},
  3742. args: ["aNumber"],
  3743. source: "& aNumber\x0a\x09<return self & aNumber>",
  3744. messageSends: [],
  3745. referencedClasses: []
  3746. }),
  3747. smalltalk.Number);
  3748. smalltalk.addMethod(
  3749. smalltalk.method({
  3750. selector: "*",
  3751. category: 'arithmetic',
  3752. fn: function (aNumber){
  3753. var self=this;
  3754. return smalltalk.withContext(function($ctx1) {
  3755. return self * aNumber;
  3756. return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},smalltalk.Number)})},
  3757. args: ["aNumber"],
  3758. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3759. messageSends: [],
  3760. referencedClasses: []
  3761. }),
  3762. smalltalk.Number);
  3763. smalltalk.addMethod(
  3764. smalltalk.method({
  3765. selector: "+",
  3766. category: 'arithmetic',
  3767. fn: function (aNumber){
  3768. var self=this;
  3769. return smalltalk.withContext(function($ctx1) {
  3770. return self + aNumber;
  3771. return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},smalltalk.Number)})},
  3772. args: ["aNumber"],
  3773. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3774. messageSends: [],
  3775. referencedClasses: []
  3776. }),
  3777. smalltalk.Number);
  3778. smalltalk.addMethod(
  3779. smalltalk.method({
  3780. selector: "-",
  3781. category: 'arithmetic',
  3782. fn: function (aNumber){
  3783. var self=this;
  3784. return smalltalk.withContext(function($ctx1) {
  3785. return self - aNumber;
  3786. return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},smalltalk.Number)})},
  3787. args: ["aNumber"],
  3788. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3789. messageSends: [],
  3790. referencedClasses: []
  3791. }),
  3792. smalltalk.Number);
  3793. smalltalk.addMethod(
  3794. smalltalk.method({
  3795. selector: "/",
  3796. category: 'arithmetic',
  3797. fn: function (aNumber){
  3798. var self=this;
  3799. return smalltalk.withContext(function($ctx1) {
  3800. return self / aNumber;
  3801. return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},smalltalk.Number)})},
  3802. args: ["aNumber"],
  3803. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3804. messageSends: [],
  3805. referencedClasses: []
  3806. }),
  3807. smalltalk.Number);
  3808. smalltalk.addMethod(
  3809. smalltalk.method({
  3810. selector: "<",
  3811. category: 'comparing',
  3812. fn: function (aNumber){
  3813. var self=this;
  3814. return smalltalk.withContext(function($ctx1) {
  3815. return self < aNumber;
  3816. return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},smalltalk.Number)})},
  3817. args: ["aNumber"],
  3818. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3819. messageSends: [],
  3820. referencedClasses: []
  3821. }),
  3822. smalltalk.Number);
  3823. smalltalk.addMethod(
  3824. smalltalk.method({
  3825. selector: "<=",
  3826. category: 'comparing',
  3827. fn: function (aNumber){
  3828. var self=this;
  3829. return smalltalk.withContext(function($ctx1) {
  3830. return self <= aNumber;
  3831. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},smalltalk.Number)})},
  3832. args: ["aNumber"],
  3833. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3834. messageSends: [],
  3835. referencedClasses: []
  3836. }),
  3837. smalltalk.Number);
  3838. smalltalk.addMethod(
  3839. smalltalk.method({
  3840. selector: "=",
  3841. category: 'comparing',
  3842. fn: function (aNumber){
  3843. var self=this;
  3844. return smalltalk.withContext(function($ctx1) {
  3845. if(! aNumber._isNumber || ! aNumber._isNumber()) {
  3846. return false;
  3847. }
  3848. return Number(self) == aNumber
  3849. ;
  3850. return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},smalltalk.Number)})},
  3851. args: ["aNumber"],
  3852. 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>",
  3853. messageSends: [],
  3854. referencedClasses: []
  3855. }),
  3856. smalltalk.Number);
  3857. smalltalk.addMethod(
  3858. smalltalk.method({
  3859. selector: ">",
  3860. category: 'comparing',
  3861. fn: function (aNumber){
  3862. var self=this;
  3863. return smalltalk.withContext(function($ctx1) {
  3864. return self > aNumber;
  3865. return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},smalltalk.Number)})},
  3866. args: ["aNumber"],
  3867. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3868. messageSends: [],
  3869. referencedClasses: []
  3870. }),
  3871. smalltalk.Number);
  3872. smalltalk.addMethod(
  3873. smalltalk.method({
  3874. selector: ">=",
  3875. category: 'comparing',
  3876. fn: function (aNumber){
  3877. var self=this;
  3878. return smalltalk.withContext(function($ctx1) {
  3879. return self >= aNumber;
  3880. return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},smalltalk.Number)})},
  3881. args: ["aNumber"],
  3882. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3883. messageSends: [],
  3884. referencedClasses: []
  3885. }),
  3886. smalltalk.Number);
  3887. smalltalk.addMethod(
  3888. smalltalk.method({
  3889. selector: "@",
  3890. category: 'converting',
  3891. fn: function (aNumber){
  3892. var self=this;
  3893. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3894. return smalltalk.withContext(function($ctx1) {
  3895. var $1;
  3896. $1=_st($Point())._x_y_(self,aNumber);
  3897. return $1;
  3898. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},smalltalk.Number)})},
  3899. args: ["aNumber"],
  3900. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  3901. messageSends: ["x:y:"],
  3902. referencedClasses: ["Point"]
  3903. }),
  3904. smalltalk.Number);
  3905. smalltalk.addMethod(
  3906. smalltalk.method({
  3907. selector: "\x5c\x5c",
  3908. category: 'arithmetic',
  3909. fn: function (aNumber){
  3910. var self=this;
  3911. return smalltalk.withContext(function($ctx1) {
  3912. return self % aNumber;
  3913. return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},smalltalk.Number)})},
  3914. args: ["aNumber"],
  3915. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3916. messageSends: [],
  3917. referencedClasses: []
  3918. }),
  3919. smalltalk.Number);
  3920. smalltalk.addMethod(
  3921. smalltalk.method({
  3922. selector: "abs",
  3923. category: 'arithmetic',
  3924. fn: function (){
  3925. var self=this;
  3926. return smalltalk.withContext(function($ctx1) {
  3927. return Math.abs(self);;
  3928. return self}, function($ctx1) {$ctx1.fill(self,"abs",{},smalltalk.Number)})},
  3929. args: [],
  3930. source: "abs\x0a\x09<return Math.abs(self);>",
  3931. messageSends: [],
  3932. referencedClasses: []
  3933. }),
  3934. smalltalk.Number);
  3935. smalltalk.addMethod(
  3936. smalltalk.method({
  3937. selector: "asJSON",
  3938. category: 'converting',
  3939. fn: function (){
  3940. var self=this;
  3941. return smalltalk.withContext(function($ctx1) {
  3942. var $1;
  3943. $1=self;
  3944. return $1;
  3945. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Number)})},
  3946. args: [],
  3947. source: "asJSON\x0a\x09^self",
  3948. messageSends: [],
  3949. referencedClasses: []
  3950. }),
  3951. smalltalk.Number);
  3952. smalltalk.addMethod(
  3953. smalltalk.method({
  3954. selector: "asJavascript",
  3955. category: 'converting',
  3956. fn: function (){
  3957. var self=this;
  3958. return smalltalk.withContext(function($ctx1) {
  3959. var $1;
  3960. $1=_st("(".__comma(self._printString())).__comma(")");
  3961. return $1;
  3962. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Number)})},
  3963. args: [],
  3964. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  3965. messageSends: [",", "printString"],
  3966. referencedClasses: []
  3967. }),
  3968. smalltalk.Number);
  3969. smalltalk.addMethod(
  3970. smalltalk.method({
  3971. selector: "asPoint",
  3972. category: 'converting',
  3973. fn: function (){
  3974. var self=this;
  3975. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3976. return smalltalk.withContext(function($ctx1) {
  3977. var $1;
  3978. $1=_st($Point())._x_y_(self,self);
  3979. return $1;
  3980. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Number)})},
  3981. args: [],
  3982. source: "asPoint\x0a\x09^Point x: self y: self",
  3983. messageSends: ["x:y:"],
  3984. referencedClasses: ["Point"]
  3985. }),
  3986. smalltalk.Number);
  3987. smalltalk.addMethod(
  3988. smalltalk.method({
  3989. selector: "asString",
  3990. category: 'converting',
  3991. fn: function (){
  3992. var self=this;
  3993. return smalltalk.withContext(function($ctx1) {
  3994. return String(self) ;
  3995. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Number)})},
  3996. args: [],
  3997. source: "asString\x0a\x09< return String(self) >",
  3998. messageSends: [],
  3999. referencedClasses: []
  4000. }),
  4001. smalltalk.Number);
  4002. smalltalk.addMethod(
  4003. smalltalk.method({
  4004. selector: "atRandom",
  4005. category: 'converting',
  4006. fn: function (){
  4007. var self=this;
  4008. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  4009. return smalltalk.withContext(function($ctx1) {
  4010. var $1;
  4011. $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  4012. return $1;
  4013. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.Number)})},
  4014. args: [],
  4015. source: "atRandom\x0a\x09^(Random new next * self) truncated + 1",
  4016. messageSends: ["+", "truncated", "*", "next", "new"],
  4017. referencedClasses: ["Random"]
  4018. }),
  4019. smalltalk.Number);
  4020. smalltalk.addMethod(
  4021. smalltalk.method({
  4022. selector: "copy",
  4023. category: 'copying',
  4024. fn: function (){
  4025. var self=this;
  4026. return smalltalk.withContext(function($ctx1) {
  4027. var $1;
  4028. $1=self;
  4029. return $1;
  4030. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Number)})},
  4031. args: [],
  4032. source: "copy\x0a\x09^self",
  4033. messageSends: [],
  4034. referencedClasses: []
  4035. }),
  4036. smalltalk.Number);
  4037. smalltalk.addMethod(
  4038. smalltalk.method({
  4039. selector: "deepCopy",
  4040. category: 'copying',
  4041. fn: function (){
  4042. var self=this;
  4043. return smalltalk.withContext(function($ctx1) {
  4044. var $1;
  4045. $1=self._copy();
  4046. return $1;
  4047. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Number)})},
  4048. args: [],
  4049. source: "deepCopy\x0a\x09^self copy",
  4050. messageSends: ["copy"],
  4051. referencedClasses: []
  4052. }),
  4053. smalltalk.Number);
  4054. smalltalk.addMethod(
  4055. smalltalk.method({
  4056. selector: "even",
  4057. category: 'testing',
  4058. fn: function (){
  4059. var self=this;
  4060. return smalltalk.withContext(function($ctx1) {
  4061. var $1;
  4062. $1=(0).__eq(self.__backslash_backslash((2)));
  4063. return $1;
  4064. }, function($ctx1) {$ctx1.fill(self,"even",{},smalltalk.Number)})},
  4065. args: [],
  4066. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4067. messageSends: ["=", "\x5c\x5c"],
  4068. referencedClasses: []
  4069. }),
  4070. smalltalk.Number);
  4071. smalltalk.addMethod(
  4072. smalltalk.method({
  4073. selector: "identityHash",
  4074. category: 'accessing',
  4075. fn: function (){
  4076. var self=this;
  4077. return smalltalk.withContext(function($ctx1) {
  4078. var $1;
  4079. $1=_st(self._asString()).__comma("n");
  4080. return $1;
  4081. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Number)})},
  4082. args: [],
  4083. source: "identityHash\x0a\x09^self asString, 'n'",
  4084. messageSends: [",", "asString"],
  4085. referencedClasses: []
  4086. }),
  4087. smalltalk.Number);
  4088. smalltalk.addMethod(
  4089. smalltalk.method({
  4090. selector: "isImmutable",
  4091. category: 'testing',
  4092. fn: function (){
  4093. var self=this;
  4094. return smalltalk.withContext(function($ctx1) {
  4095. return true;
  4096. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Number)})},
  4097. args: [],
  4098. source: "isImmutable\x0a\x09^ true",
  4099. messageSends: [],
  4100. referencedClasses: []
  4101. }),
  4102. smalltalk.Number);
  4103. smalltalk.addMethod(
  4104. smalltalk.method({
  4105. selector: "isNumber",
  4106. category: 'testing',
  4107. fn: function (){
  4108. var self=this;
  4109. return smalltalk.withContext(function($ctx1) {
  4110. return true;
  4111. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Number)})},
  4112. args: [],
  4113. source: "isNumber\x0a\x09^true",
  4114. messageSends: [],
  4115. referencedClasses: []
  4116. }),
  4117. smalltalk.Number);
  4118. smalltalk.addMethod(
  4119. smalltalk.method({
  4120. selector: "isZero",
  4121. category: 'testing',
  4122. fn: function (){
  4123. var self=this;
  4124. return smalltalk.withContext(function($ctx1) {
  4125. var $1;
  4126. $1=self.__eq((0));
  4127. return $1;
  4128. }, function($ctx1) {$ctx1.fill(self,"isZero",{},smalltalk.Number)})},
  4129. args: [],
  4130. source: "isZero\x0a\x09^self = 0",
  4131. messageSends: ["="],
  4132. referencedClasses: []
  4133. }),
  4134. smalltalk.Number);
  4135. smalltalk.addMethod(
  4136. smalltalk.method({
  4137. selector: "max:",
  4138. category: 'arithmetic',
  4139. fn: function (aNumber){
  4140. var self=this;
  4141. return smalltalk.withContext(function($ctx1) {
  4142. return Math.max(self, aNumber);;
  4143. return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},smalltalk.Number)})},
  4144. args: ["aNumber"],
  4145. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  4146. messageSends: [],
  4147. referencedClasses: []
  4148. }),
  4149. smalltalk.Number);
  4150. smalltalk.addMethod(
  4151. smalltalk.method({
  4152. selector: "min:",
  4153. category: 'arithmetic',
  4154. fn: function (aNumber){
  4155. var self=this;
  4156. return smalltalk.withContext(function($ctx1) {
  4157. return Math.min(self, aNumber);;
  4158. return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},smalltalk.Number)})},
  4159. args: ["aNumber"],
  4160. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4161. messageSends: [],
  4162. referencedClasses: []
  4163. }),
  4164. smalltalk.Number);
  4165. smalltalk.addMethod(
  4166. smalltalk.method({
  4167. selector: "negated",
  4168. category: 'arithmetic',
  4169. fn: function (){
  4170. var self=this;
  4171. return smalltalk.withContext(function($ctx1) {
  4172. var $1;
  4173. $1=(0).__minus(self);
  4174. return $1;
  4175. }, function($ctx1) {$ctx1.fill(self,"negated",{},smalltalk.Number)})},
  4176. args: [],
  4177. source: "negated\x0a\x09^0 - self",
  4178. messageSends: ["-"],
  4179. referencedClasses: []
  4180. }),
  4181. smalltalk.Number);
  4182. smalltalk.addMethod(
  4183. smalltalk.method({
  4184. selector: "negative",
  4185. category: 'testing',
  4186. fn: function (){
  4187. var self=this;
  4188. return smalltalk.withContext(function($ctx1) {
  4189. var $1;
  4190. $1=self.__lt((0));
  4191. return $1;
  4192. }, function($ctx1) {$ctx1.fill(self,"negative",{},smalltalk.Number)})},
  4193. args: [],
  4194. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4195. messageSends: ["<"],
  4196. referencedClasses: []
  4197. }),
  4198. smalltalk.Number);
  4199. smalltalk.addMethod(
  4200. smalltalk.method({
  4201. selector: "odd",
  4202. category: 'testing',
  4203. fn: function (){
  4204. var self=this;
  4205. return smalltalk.withContext(function($ctx1) {
  4206. var $1;
  4207. $1=_st(self._even())._not();
  4208. return $1;
  4209. }, function($ctx1) {$ctx1.fill(self,"odd",{},smalltalk.Number)})},
  4210. args: [],
  4211. source: "odd\x0a\x09^ self even not",
  4212. messageSends: ["not", "even"],
  4213. referencedClasses: []
  4214. }),
  4215. smalltalk.Number);
  4216. smalltalk.addMethod(
  4217. smalltalk.method({
  4218. selector: "positive",
  4219. category: 'testing',
  4220. fn: function (){
  4221. var self=this;
  4222. return smalltalk.withContext(function($ctx1) {
  4223. var $1;
  4224. $1=self.__gt_eq((0));
  4225. return $1;
  4226. }, function($ctx1) {$ctx1.fill(self,"positive",{},smalltalk.Number)})},
  4227. args: [],
  4228. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4229. messageSends: [">="],
  4230. referencedClasses: []
  4231. }),
  4232. smalltalk.Number);
  4233. smalltalk.addMethod(
  4234. smalltalk.method({
  4235. selector: "printOn:",
  4236. category: 'printing',
  4237. fn: function (aStream){
  4238. var self=this;
  4239. return smalltalk.withContext(function($ctx1) {
  4240. _st(aStream)._nextPutAll_(self._asString());
  4241. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Number)})},
  4242. args: ["aStream"],
  4243. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4244. messageSends: ["nextPutAll:", "asString"],
  4245. referencedClasses: []
  4246. }),
  4247. smalltalk.Number);
  4248. smalltalk.addMethod(
  4249. smalltalk.method({
  4250. selector: "printShowingDecimalPlaces:",
  4251. category: 'printing',
  4252. fn: function (placesDesired){
  4253. var self=this;
  4254. return smalltalk.withContext(function($ctx1) {
  4255. return self.toFixed(placesDesired);
  4256. return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},smalltalk.Number)})},
  4257. args: ["placesDesired"],
  4258. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4259. messageSends: [],
  4260. referencedClasses: []
  4261. }),
  4262. smalltalk.Number);
  4263. smalltalk.addMethod(
  4264. smalltalk.method({
  4265. selector: "rounded",
  4266. category: 'converting',
  4267. fn: function (){
  4268. var self=this;
  4269. return smalltalk.withContext(function($ctx1) {
  4270. return Math.round(self);;
  4271. return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},smalltalk.Number)})},
  4272. args: [],
  4273. source: "rounded\x0a\x09<return Math.round(self);>",
  4274. messageSends: [],
  4275. referencedClasses: []
  4276. }),
  4277. smalltalk.Number);
  4278. smalltalk.addMethod(
  4279. smalltalk.method({
  4280. selector: "sqrt",
  4281. category: 'arithmetic',
  4282. fn: function (){
  4283. var self=this;
  4284. return smalltalk.withContext(function($ctx1) {
  4285. return Math.sqrt(self);
  4286. return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},smalltalk.Number)})},
  4287. args: [],
  4288. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4289. messageSends: [],
  4290. referencedClasses: []
  4291. }),
  4292. smalltalk.Number);
  4293. smalltalk.addMethod(
  4294. smalltalk.method({
  4295. selector: "squared",
  4296. category: 'arithmetic',
  4297. fn: function (){
  4298. var self=this;
  4299. return smalltalk.withContext(function($ctx1) {
  4300. var $1;
  4301. $1=self.__star(self);
  4302. return $1;
  4303. }, function($ctx1) {$ctx1.fill(self,"squared",{},smalltalk.Number)})},
  4304. args: [],
  4305. source: "squared\x0a\x09^self * self",
  4306. messageSends: ["*"],
  4307. referencedClasses: []
  4308. }),
  4309. smalltalk.Number);
  4310. smalltalk.addMethod(
  4311. smalltalk.method({
  4312. selector: "timesRepeat:",
  4313. category: 'enumerating',
  4314. fn: function (aBlock){
  4315. var self=this;
  4316. var count;
  4317. return smalltalk.withContext(function($ctx1) {
  4318. count=(1);
  4319. _st((function(){
  4320. return smalltalk.withContext(function($ctx2) {
  4321. return _st(count).__gt(self);
  4322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  4323. return smalltalk.withContext(function($ctx2) {
  4324. _st(aBlock)._value();
  4325. count=_st(count).__plus((1));
  4326. return count;
  4327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4328. return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},smalltalk.Number)})},
  4329. args: ["aBlock"],
  4330. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1]",
  4331. messageSends: ["whileFalse:", "value", "+", ">"],
  4332. referencedClasses: []
  4333. }),
  4334. smalltalk.Number);
  4335. smalltalk.addMethod(
  4336. smalltalk.method({
  4337. selector: "to:",
  4338. category: 'converting',
  4339. fn: function (aNumber){
  4340. var self=this;
  4341. var array,first,last,count;
  4342. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4343. return smalltalk.withContext(function($ctx1) {
  4344. var $1;
  4345. first=self._truncated();
  4346. last=_st(_st(aNumber)._truncated()).__plus((1));
  4347. count=(1);
  4348. array=_st($Array())._new();
  4349. _st(_st(last).__minus(first))._timesRepeat_((function(){
  4350. return smalltalk.withContext(function($ctx2) {
  4351. _st(array)._at_put_(count,first);
  4352. count=_st(count).__plus((1));
  4353. count;
  4354. first=_st(first).__plus((1));
  4355. return first;
  4356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4357. $1=array;
  4358. return $1;
  4359. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},smalltalk.Number)})},
  4360. args: ["aNumber"],
  4361. 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",
  4362. messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
  4363. referencedClasses: ["Array"]
  4364. }),
  4365. smalltalk.Number);
  4366. smalltalk.addMethod(
  4367. smalltalk.method({
  4368. selector: "to:by:",
  4369. category: 'converting',
  4370. fn: function (stop,step){
  4371. var self=this;
  4372. var array,value,pos;
  4373. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4374. return smalltalk.withContext(function($ctx1) {
  4375. var $1,$2,$3;
  4376. value=self;
  4377. array=_st($Array())._new();
  4378. pos=(1);
  4379. $1=_st(step).__eq((0));
  4380. if(smalltalk.assert($1)){
  4381. self._error_("step must be non-zero");
  4382. };
  4383. $2=_st(step).__lt((0));
  4384. if(smalltalk.assert($2)){
  4385. _st((function(){
  4386. return smalltalk.withContext(function($ctx2) {
  4387. return _st(value).__gt_eq(stop);
  4388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4389. return smalltalk.withContext(function($ctx2) {
  4390. _st(array)._at_put_(pos,value);
  4391. pos=_st(pos).__plus((1));
  4392. pos;
  4393. value=_st(value).__plus(step);
  4394. return value;
  4395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4396. } else {
  4397. _st((function(){
  4398. return smalltalk.withContext(function($ctx2) {
  4399. return _st(value).__lt_eq(stop);
  4400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4401. return smalltalk.withContext(function($ctx2) {
  4402. _st(array)._at_put_(pos,value);
  4403. pos=_st(pos).__plus((1));
  4404. pos;
  4405. value=_st(value).__plus(step);
  4406. return value;
  4407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4408. };
  4409. $3=array;
  4410. return $3;
  4411. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},smalltalk.Number)})},
  4412. args: ["stop", "step"],
  4413. 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",
  4414. messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
  4415. referencedClasses: ["Array"]
  4416. }),
  4417. smalltalk.Number);
  4418. smalltalk.addMethod(
  4419. smalltalk.method({
  4420. selector: "to:by:do:",
  4421. category: 'enumerating',
  4422. fn: function (stop,step,aBlock){
  4423. var self=this;
  4424. var value;
  4425. return smalltalk.withContext(function($ctx1) {
  4426. var $1,$2;
  4427. value=self;
  4428. $1=_st(step).__eq((0));
  4429. if(smalltalk.assert($1)){
  4430. self._error_("step must be non-zero");
  4431. };
  4432. $2=_st(step).__lt((0));
  4433. if(smalltalk.assert($2)){
  4434. _st((function(){
  4435. return smalltalk.withContext(function($ctx2) {
  4436. return _st(value).__gt_eq(stop);
  4437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4438. return smalltalk.withContext(function($ctx2) {
  4439. _st(aBlock)._value_(value);
  4440. value=_st(value).__plus(step);
  4441. return value;
  4442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4443. } else {
  4444. _st((function(){
  4445. return smalltalk.withContext(function($ctx2) {
  4446. return _st(value).__lt_eq(stop);
  4447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4448. return smalltalk.withContext(function($ctx2) {
  4449. _st(aBlock)._value_(value);
  4450. value=_st(value).__plus(step);
  4451. return value;
  4452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4453. };
  4454. return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},smalltalk.Number)})},
  4455. args: ["stop", "step", "aBlock"],
  4456. 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]]",
  4457. messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
  4458. referencedClasses: []
  4459. }),
  4460. smalltalk.Number);
  4461. smalltalk.addMethod(
  4462. smalltalk.method({
  4463. selector: "to:do:",
  4464. category: 'enumerating',
  4465. fn: function (stop,aBlock){
  4466. var self=this;
  4467. var nextValue;
  4468. return smalltalk.withContext(function($ctx1) {
  4469. nextValue=self;
  4470. _st((function(){
  4471. return smalltalk.withContext(function($ctx2) {
  4472. return _st(nextValue).__lt_eq(stop);
  4473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4474. return smalltalk.withContext(function($ctx2) {
  4475. _st(aBlock)._value_(nextValue);
  4476. nextValue=_st(nextValue).__plus((1));
  4477. return nextValue;
  4478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4479. return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},smalltalk.Number)})},
  4480. args: ["stop", "aBlock"],
  4481. 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]",
  4482. messageSends: ["whileTrue:", "value:", "+", "<="],
  4483. referencedClasses: []
  4484. }),
  4485. smalltalk.Number);
  4486. smalltalk.addMethod(
  4487. smalltalk.method({
  4488. selector: "truncated",
  4489. category: 'converting',
  4490. fn: function (){
  4491. var self=this;
  4492. return smalltalk.withContext(function($ctx1) {
  4493. if(self >= 0) {
  4494. return Math.floor(self);
  4495. } else {
  4496. return Math.floor(self * (-1)) * (-1);
  4497. };
  4498. ;
  4499. return self}, function($ctx1) {$ctx1.fill(self,"truncated",{},smalltalk.Number)})},
  4500. args: [],
  4501. 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>",
  4502. messageSends: [],
  4503. referencedClasses: []
  4504. }),
  4505. smalltalk.Number);
  4506. smalltalk.addMethod(
  4507. smalltalk.method({
  4508. selector: "|",
  4509. category: 'converting',
  4510. fn: function (aNumber){
  4511. var self=this;
  4512. return smalltalk.withContext(function($ctx1) {
  4513. return self | aNumber;
  4514. return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},smalltalk.Number)})},
  4515. args: ["aNumber"],
  4516. source: "| aNumber\x0a\x09<return self | aNumber>",
  4517. messageSends: [],
  4518. referencedClasses: []
  4519. }),
  4520. smalltalk.Number);
  4521. smalltalk.addMethod(
  4522. smalltalk.method({
  4523. selector: "heliosClass",
  4524. category: 'helios',
  4525. fn: function (){
  4526. var self=this;
  4527. return smalltalk.withContext(function($ctx1) {
  4528. return "magnitude";
  4529. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Number.klass)})},
  4530. args: [],
  4531. source: "heliosClass\x0a\x09^ 'magnitude'",
  4532. messageSends: [],
  4533. referencedClasses: []
  4534. }),
  4535. smalltalk.Number.klass);
  4536. smalltalk.addMethod(
  4537. smalltalk.method({
  4538. selector: "pi",
  4539. category: 'instance creation',
  4540. fn: function (){
  4541. var self=this;
  4542. return smalltalk.withContext(function($ctx1) {
  4543. return Math.PI;
  4544. return self}, function($ctx1) {$ctx1.fill(self,"pi",{},smalltalk.Number.klass)})},
  4545. args: [],
  4546. source: "pi\x0a\x09<return Math.PI>",
  4547. messageSends: [],
  4548. referencedClasses: []
  4549. }),
  4550. smalltalk.Number.klass);
  4551. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
  4552. smalltalk.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  4553. smalltalk.addMethod(
  4554. smalltalk.method({
  4555. selector: "addElement:",
  4556. category: 'accessing',
  4557. fn: function (anObject){
  4558. var self=this;
  4559. return smalltalk.withContext(function($ctx1) {
  4560. self.elements.addElement(anObject);
  4561. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},smalltalk.Organizer)})},
  4562. args: ["anObject"],
  4563. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  4564. messageSends: [],
  4565. referencedClasses: []
  4566. }),
  4567. smalltalk.Organizer);
  4568. smalltalk.addMethod(
  4569. smalltalk.method({
  4570. selector: "elements",
  4571. category: 'accessing',
  4572. fn: function (){
  4573. var self=this;
  4574. return smalltalk.withContext(function($ctx1) {
  4575. var $1;
  4576. $1=_st(self._basicAt_("elements"))._copy();
  4577. return $1;
  4578. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.Organizer)})},
  4579. args: [],
  4580. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  4581. messageSends: ["copy", "basicAt:"],
  4582. referencedClasses: []
  4583. }),
  4584. smalltalk.Organizer);
  4585. smalltalk.addMethod(
  4586. smalltalk.method({
  4587. selector: "removeElement:",
  4588. category: 'accessing',
  4589. fn: function (anObject){
  4590. var self=this;
  4591. return smalltalk.withContext(function($ctx1) {
  4592. self.elements.removeElement(anObject);
  4593. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},smalltalk.Organizer)})},
  4594. args: ["anObject"],
  4595. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  4596. messageSends: [],
  4597. referencedClasses: []
  4598. }),
  4599. smalltalk.Organizer);
  4600. smalltalk.addClass('ClassOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
  4601. smalltalk.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  4602. smalltalk.addMethod(
  4603. smalltalk.method({
  4604. selector: "addElement:",
  4605. category: 'accessing',
  4606. fn: function (aString){
  4607. var self=this;
  4608. function $ProtocolAdded(){return smalltalk.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  4609. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  4610. return smalltalk.withContext(function($ctx1) {
  4611. var $1,$2;
  4612. smalltalk.Organizer.fn.prototype._addElement_.apply(_st(self), [aString]);
  4613. $1=_st($ProtocolAdded())._new();
  4614. _st($1)._protocol_(aString);
  4615. _st($1)._theClass_(self._theClass());
  4616. $2=_st($1)._yourself();
  4617. _st(_st($SystemAnnouncer())._current())._announce_($2);
  4618. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  4619. args: ["aString"],
  4620. 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)",
  4621. messageSends: ["addElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
  4622. referencedClasses: ["ProtocolAdded", "SystemAnnouncer"]
  4623. }),
  4624. smalltalk.ClassOrganizer);
  4625. smalltalk.addMethod(
  4626. smalltalk.method({
  4627. selector: "removeElement:",
  4628. category: 'accessing',
  4629. fn: function (aString){
  4630. var self=this;
  4631. function $ProtocolRemoved(){return smalltalk.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  4632. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  4633. return smalltalk.withContext(function($ctx1) {
  4634. var $1,$2;
  4635. smalltalk.Organizer.fn.prototype._removeElement_.apply(_st(self), [aString]);
  4636. $1=_st($ProtocolRemoved())._new();
  4637. _st($1)._protocol_(aString);
  4638. _st($1)._theClass_(self._theClass());
  4639. $2=_st($1)._yourself();
  4640. _st(_st($SystemAnnouncer())._current())._announce_($2);
  4641. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  4642. args: ["aString"],
  4643. 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)",
  4644. messageSends: ["removeElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
  4645. referencedClasses: ["ProtocolRemoved", "SystemAnnouncer"]
  4646. }),
  4647. smalltalk.ClassOrganizer);
  4648. smalltalk.addMethod(
  4649. smalltalk.method({
  4650. selector: "theClass",
  4651. category: 'accessing',
  4652. fn: function (){
  4653. var self=this;
  4654. return smalltalk.withContext(function($ctx1) {
  4655. return self.theClass ;
  4656. return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassOrganizer)})},
  4657. args: [],
  4658. source: "theClass\x0a\x09< return self.theClass >",
  4659. messageSends: [],
  4660. referencedClasses: []
  4661. }),
  4662. smalltalk.ClassOrganizer);
  4663. smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
  4664. smalltalk.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  4665. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  4666. 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'";
  4667. smalltalk.addMethod(
  4668. smalltalk.method({
  4669. selector: "classes",
  4670. category: 'classes',
  4671. fn: function (){
  4672. var self=this;
  4673. return smalltalk.withContext(function($ctx1) {
  4674. var $1;
  4675. $1=_st(self._organization())._elements();
  4676. return $1;
  4677. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Package)})},
  4678. args: [],
  4679. source: "classes\x0a\x09^ self organization elements",
  4680. messageSends: ["elements", "organization"],
  4681. referencedClasses: []
  4682. }),
  4683. smalltalk.Package);
  4684. smalltalk.addMethod(
  4685. smalltalk.method({
  4686. selector: "commitPathJs",
  4687. category: 'accessing',
  4688. fn: function (){
  4689. var self=this;
  4690. return smalltalk.withContext(function($ctx1) {
  4691. var $2,$1;
  4692. $2=self["@commitPathJs"];
  4693. if(($receiver = $2) == nil || $receiver == undefined){
  4694. $1=_st(self._class())._defaultCommitPathJs();
  4695. } else {
  4696. $1=$2;
  4697. };
  4698. return $1;
  4699. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  4700. args: [],
  4701. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  4702. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  4703. referencedClasses: []
  4704. }),
  4705. smalltalk.Package);
  4706. smalltalk.addMethod(
  4707. smalltalk.method({
  4708. selector: "commitPathJs:",
  4709. category: 'accessing',
  4710. fn: function (aString){
  4711. var self=this;
  4712. return smalltalk.withContext(function($ctx1) {
  4713. self["@commitPathJs"]=aString;
  4714. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  4715. args: ["aString"],
  4716. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  4717. messageSends: [],
  4718. referencedClasses: []
  4719. }),
  4720. smalltalk.Package);
  4721. smalltalk.addMethod(
  4722. smalltalk.method({
  4723. selector: "commitPathSt",
  4724. category: 'accessing',
  4725. fn: function (){
  4726. var self=this;
  4727. return smalltalk.withContext(function($ctx1) {
  4728. var $2,$1;
  4729. $2=self["@commitPathSt"];
  4730. if(($receiver = $2) == nil || $receiver == undefined){
  4731. $1=_st(self._class())._defaultCommitPathSt();
  4732. } else {
  4733. $1=$2;
  4734. };
  4735. return $1;
  4736. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  4737. args: [],
  4738. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  4739. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  4740. referencedClasses: []
  4741. }),
  4742. smalltalk.Package);
  4743. smalltalk.addMethod(
  4744. smalltalk.method({
  4745. selector: "commitPathSt:",
  4746. category: 'accessing',
  4747. fn: function (aString){
  4748. var self=this;
  4749. return smalltalk.withContext(function($ctx1) {
  4750. self["@commitPathSt"]=aString;
  4751. return self}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  4752. args: ["aString"],
  4753. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  4754. messageSends: [],
  4755. referencedClasses: []
  4756. }),
  4757. smalltalk.Package);
  4758. smalltalk.addMethod(
  4759. smalltalk.method({
  4760. selector: "isPackage",
  4761. category: 'testing',
  4762. fn: function (){
  4763. var self=this;
  4764. return smalltalk.withContext(function($ctx1) {
  4765. return true;
  4766. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Package)})},
  4767. args: [],
  4768. source: "isPackage\x0a\x09^ true",
  4769. messageSends: [],
  4770. referencedClasses: []
  4771. }),
  4772. smalltalk.Package);
  4773. smalltalk.addMethod(
  4774. smalltalk.method({
  4775. selector: "name",
  4776. category: 'accessing',
  4777. fn: function (){
  4778. var self=this;
  4779. return smalltalk.withContext(function($ctx1) {
  4780. return self.pkgName;
  4781. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Package)})},
  4782. args: [],
  4783. source: "name\x0a\x09<return self.pkgName>",
  4784. messageSends: [],
  4785. referencedClasses: []
  4786. }),
  4787. smalltalk.Package);
  4788. smalltalk.addMethod(
  4789. smalltalk.method({
  4790. selector: "name:",
  4791. category: 'accessing',
  4792. fn: function (aString){
  4793. var self=this;
  4794. return smalltalk.withContext(function($ctx1) {
  4795. self.pkgName = aString;
  4796. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.Package)})},
  4797. args: ["aString"],
  4798. source: "name: aString\x0a\x09<self.pkgName = aString>",
  4799. messageSends: [],
  4800. referencedClasses: []
  4801. }),
  4802. smalltalk.Package);
  4803. smalltalk.addMethod(
  4804. smalltalk.method({
  4805. selector: "organization",
  4806. category: 'accessing',
  4807. fn: function (){
  4808. var self=this;
  4809. return smalltalk.withContext(function($ctx1) {
  4810. var $1;
  4811. $1=self._basicAt_("organization");
  4812. return $1;
  4813. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Package)})},
  4814. args: [],
  4815. source: "organization\x0a\x09^ self basicAt: 'organization'",
  4816. messageSends: ["basicAt:"],
  4817. referencedClasses: []
  4818. }),
  4819. smalltalk.Package);
  4820. smalltalk.addMethod(
  4821. smalltalk.method({
  4822. selector: "printOn:",
  4823. category: 'printing',
  4824. fn: function (aStream){
  4825. var self=this;
  4826. return smalltalk.withContext(function($ctx1) {
  4827. var $1,$2;
  4828. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  4829. $1=aStream;
  4830. _st($1)._nextPutAll_(" (");
  4831. _st($1)._nextPutAll_(self._name());
  4832. $2=_st($1)._nextPutAll_(")");
  4833. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Package)})},
  4834. args: ["aStream"],
  4835. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  4836. messageSends: ["printOn:", "nextPutAll:", "name"],
  4837. referencedClasses: []
  4838. }),
  4839. smalltalk.Package);
  4840. smalltalk.addMethod(
  4841. smalltalk.method({
  4842. selector: "setupClasses",
  4843. category: 'classes',
  4844. fn: function (){
  4845. var self=this;
  4846. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  4847. return smalltalk.withContext(function($ctx1) {
  4848. var $1,$2;
  4849. $1=self._classes();
  4850. _st($1)._do_((function(each){
  4851. return smalltalk.withContext(function($ctx2) {
  4852. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  4853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4854. $2=_st($1)._do_((function(each){
  4855. return smalltalk.withContext(function($ctx2) {
  4856. return _st(each)._initialize();
  4857. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4858. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},smalltalk.Package)})},
  4859. args: [],
  4860. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  4861. messageSends: ["do:", "setupClass:", "new", "classes", "initialize"],
  4862. referencedClasses: ["ClassBuilder"]
  4863. }),
  4864. smalltalk.Package);
  4865. smalltalk.addMethod(
  4866. smalltalk.method({
  4867. selector: "sortedClasses",
  4868. category: 'classes',
  4869. fn: function (){
  4870. var self=this;
  4871. return smalltalk.withContext(function($ctx1) {
  4872. var $1;
  4873. $1=_st(self._class())._sortedClasses_(self._classes());
  4874. return $1;
  4875. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},smalltalk.Package)})},
  4876. args: [],
  4877. 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",
  4878. messageSends: ["sortedClasses:", "classes", "class"],
  4879. referencedClasses: []
  4880. }),
  4881. smalltalk.Package);
  4882. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  4883. smalltalk.addMethod(
  4884. smalltalk.method({
  4885. selector: "commitPathsFromLoader",
  4886. category: 'commit paths',
  4887. fn: function (){
  4888. var self=this;
  4889. return smalltalk.withContext(function($ctx1) {
  4890. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  4891. if (!commitPath) return;
  4892. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  4893. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  4894. ;
  4895. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.Package.klass)})},
  4896. args: [],
  4897. source: "commitPathsFromLoader\x0a\x09<\x0a\x09\x09var commitPath = typeof amber !== 'undefined' && amber.commitPath;\x0a\x09\x09if (!commitPath) return;\x0a\x09\x09if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);\x0a\x09\x09if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);\x0a\x09>",
  4898. messageSends: [],
  4899. referencedClasses: []
  4900. }),
  4901. smalltalk.Package.klass);
  4902. smalltalk.addMethod(
  4903. smalltalk.method({
  4904. selector: "defaultCommitPathJs",
  4905. category: 'commit paths',
  4906. fn: function (){
  4907. var self=this;
  4908. return smalltalk.withContext(function($ctx1) {
  4909. var $2,$1;
  4910. $2=self["@defaultCommitPathJs"];
  4911. if(($receiver = $2) == nil || $receiver == undefined){
  4912. self["@defaultCommitPathJs"]="js";
  4913. $1=self["@defaultCommitPathJs"];
  4914. } else {
  4915. $1=$2;
  4916. };
  4917. return $1;
  4918. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.Package.klass)})},
  4919. args: [],
  4920. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  4921. messageSends: ["ifNil:"],
  4922. referencedClasses: []
  4923. }),
  4924. smalltalk.Package.klass);
  4925. smalltalk.addMethod(
  4926. smalltalk.method({
  4927. selector: "defaultCommitPathJs:",
  4928. category: 'commit paths',
  4929. fn: function (aString){
  4930. var self=this;
  4931. return smalltalk.withContext(function($ctx1) {
  4932. self["@defaultCommitPathJs"]=aString;
  4933. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.Package.klass)})},
  4934. args: ["aString"],
  4935. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  4936. messageSends: [],
  4937. referencedClasses: []
  4938. }),
  4939. smalltalk.Package.klass);
  4940. smalltalk.addMethod(
  4941. smalltalk.method({
  4942. selector: "defaultCommitPathSt",
  4943. category: 'commit paths',
  4944. fn: function (){
  4945. var self=this;
  4946. return smalltalk.withContext(function($ctx1) {
  4947. var $2,$1;
  4948. $2=self["@defaultCommitPathSt"];
  4949. if(($receiver = $2) == nil || $receiver == undefined){
  4950. self["@defaultCommitPathSt"]="st";
  4951. $1=self["@defaultCommitPathSt"];
  4952. } else {
  4953. $1=$2;
  4954. };
  4955. return $1;
  4956. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.Package.klass)})},
  4957. args: [],
  4958. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  4959. messageSends: ["ifNil:"],
  4960. referencedClasses: []
  4961. }),
  4962. smalltalk.Package.klass);
  4963. smalltalk.addMethod(
  4964. smalltalk.method({
  4965. selector: "defaultCommitPathSt:",
  4966. category: 'commit paths',
  4967. fn: function (aString){
  4968. var self=this;
  4969. return smalltalk.withContext(function($ctx1) {
  4970. self["@defaultCommitPathSt"]=aString;
  4971. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.Package.klass)})},
  4972. args: ["aString"],
  4973. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  4974. messageSends: [],
  4975. referencedClasses: []
  4976. }),
  4977. smalltalk.Package.klass);
  4978. smalltalk.addMethod(
  4979. smalltalk.method({
  4980. selector: "initialize",
  4981. category: 'initialization',
  4982. fn: function (){
  4983. var self=this;
  4984. return smalltalk.withContext(function($ctx1) {
  4985. smalltalk.Object.klass.fn.prototype._initialize.apply(_st(self), []);
  4986. self._commitPathsFromLoader();
  4987. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Package.klass)})},
  4988. args: [],
  4989. source: "initialize\x0a\x09super initialize.\x0a\x09self commitPathsFromLoader",
  4990. messageSends: ["initialize", "commitPathsFromLoader"],
  4991. referencedClasses: []
  4992. }),
  4993. smalltalk.Package.klass);
  4994. smalltalk.addMethod(
  4995. smalltalk.method({
  4996. selector: "load:",
  4997. category: 'loading-storing',
  4998. fn: function (aPackageName){
  4999. var self=this;
  5000. return smalltalk.withContext(function($ctx1) {
  5001. self._load_prefix_(aPackageName,_st(self._defaultCommitPathJs()).__comma("/"));
  5002. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  5003. args: ["aPackageName"],
  5004. source: "load: aPackageName\x0a\x09self load: aPackageName prefix: self defaultCommitPathJs, '/'",
  5005. messageSends: ["load:prefix:", ",", "defaultCommitPathJs"],
  5006. referencedClasses: []
  5007. }),
  5008. smalltalk.Package.klass);
  5009. smalltalk.addMethod(
  5010. smalltalk.method({
  5011. selector: "load:prefix:",
  5012. category: 'loading-storing',
  5013. fn: function (aPackageName,aPrefix){
  5014. var self=this;
  5015. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  5016. return smalltalk.withContext(function($ctx1) {
  5017. _st(jQuery)._getScript_onSuccess_(_st(_st(aPrefix).__comma(aPackageName)).__comma(".js"),(function(){
  5018. return smalltalk.withContext(function($ctx2) {
  5019. return _st(_st($Package())._named_(aPackageName))._setupClasses();
  5020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5021. return self}, function($ctx1) {$ctx1.fill(self,"load:prefix:",{aPackageName:aPackageName,aPrefix:aPrefix},smalltalk.Package.klass)})},
  5022. args: ["aPackageName", "aPrefix"],
  5023. source: "load: aPackageName prefix: aPrefix\x0a\x09jQuery\x0a\x09\x09getScript: (aPrefix , aPackageName , '.js')\x0a\x09\x09onSuccess: [\x0a\x09\x09\x09(Package named: aPackageName) setupClasses ]",
  5024. messageSends: ["getScript:onSuccess:", ",", "setupClasses", "named:"],
  5025. referencedClasses: ["Package"]
  5026. }),
  5027. smalltalk.Package.klass);
  5028. smalltalk.addMethod(
  5029. smalltalk.method({
  5030. selector: "named:",
  5031. category: 'accessing',
  5032. fn: function (aPackageName){
  5033. var self=this;
  5034. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5035. return smalltalk.withContext(function($ctx1) {
  5036. var $1;
  5037. $1=_st(_st($Smalltalk())._current())._packageAt_(aPackageName);
  5038. return $1;
  5039. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  5040. args: ["aPackageName"],
  5041. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  5042. messageSends: ["packageAt:", "current"],
  5043. referencedClasses: ["Smalltalk"]
  5044. }),
  5045. smalltalk.Package.klass);
  5046. smalltalk.addMethod(
  5047. smalltalk.method({
  5048. selector: "named:ifAbsent:",
  5049. category: 'accessing',
  5050. fn: function (aPackageName,aBlock){
  5051. var self=this;
  5052. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5053. return smalltalk.withContext(function($ctx1) {
  5054. var $1;
  5055. $1=_st(_st($Smalltalk())._current())._packageAt_ifAbsent_(aPackageName,aBlock);
  5056. return $1;
  5057. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},smalltalk.Package.klass)})},
  5058. args: ["aPackageName", "aBlock"],
  5059. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  5060. messageSends: ["packageAt:ifAbsent:", "current"],
  5061. referencedClasses: ["Smalltalk"]
  5062. }),
  5063. smalltalk.Package.klass);
  5064. smalltalk.addMethod(
  5065. smalltalk.method({
  5066. selector: "resetCommitPaths",
  5067. category: 'commit paths',
  5068. fn: function (){
  5069. var self=this;
  5070. return smalltalk.withContext(function($ctx1) {
  5071. self["@defaultCommitPathJs"]=nil;
  5072. self["@defaultCommitPathSt"]=nil;
  5073. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.Package.klass)})},
  5074. args: [],
  5075. source: "resetCommitPaths\x0a\x09\x09defaultCommitPathJs := nil.\x0a\x09\x09defaultCommitPathSt := nil.",
  5076. messageSends: [],
  5077. referencedClasses: []
  5078. }),
  5079. smalltalk.Package.klass);
  5080. smalltalk.addMethod(
  5081. smalltalk.method({
  5082. selector: "sortedClasses:",
  5083. category: 'sorting',
  5084. fn: function (classes){
  5085. var self=this;
  5086. var children,others,nodes,expandedClasses;
  5087. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  5088. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  5089. return smalltalk.withContext(function($ctx1) {
  5090. var $1,$2;
  5091. children=[];
  5092. others=[];
  5093. _st(classes)._do_((function(each){
  5094. return smalltalk.withContext(function($ctx2) {
  5095. $1=_st(classes)._includes_(_st(each)._superclass());
  5096. if(smalltalk.assert($1)){
  5097. return _st(others)._add_(each);
  5098. } else {
  5099. return _st(children)._add_(each);
  5100. };
  5101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5102. nodes=_st(children)._collect_((function(each){
  5103. return smalltalk.withContext(function($ctx2) {
  5104. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  5105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5106. nodes=_st(nodes)._sorted_((function(a,b){
  5107. return smalltalk.withContext(function($ctx2) {
  5108. return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  5109. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  5110. expandedClasses=_st($Array())._new();
  5111. _st(nodes)._do_((function(aNode){
  5112. return smalltalk.withContext(function($ctx2) {
  5113. return _st(aNode)._traverseClassesWith_(expandedClasses);
  5114. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  5115. $2=expandedClasses;
  5116. return $2;
  5117. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},smalltalk.Package.klass)})},
  5118. args: ["classes"],
  5119. 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",
  5120. messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  5121. referencedClasses: ["ClassSorterNode", "Array"]
  5122. }),
  5123. smalltalk.Package.klass);
  5124. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  5125. 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";
  5126. smalltalk.addMethod(
  5127. smalltalk.method({
  5128. selector: "*",
  5129. category: 'arithmetic',
  5130. fn: function (aPoint){
  5131. var self=this;
  5132. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5133. return smalltalk.withContext(function($ctx1) {
  5134. var $1;
  5135. $1=_st($Point())._x_y_(_st(self._x()).__star(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__star(_st(_st(aPoint)._asPoint())._y()));
  5136. return $1;
  5137. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},smalltalk.Point)})},
  5138. args: ["aPoint"],
  5139. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5140. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  5141. referencedClasses: ["Point"]
  5142. }),
  5143. smalltalk.Point);
  5144. smalltalk.addMethod(
  5145. smalltalk.method({
  5146. selector: "+",
  5147. category: 'arithmetic',
  5148. fn: function (aPoint){
  5149. var self=this;
  5150. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5151. return smalltalk.withContext(function($ctx1) {
  5152. var $1;
  5153. $1=_st($Point())._x_y_(_st(self._x()).__plus(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__plus(_st(_st(aPoint)._asPoint())._y()));
  5154. return $1;
  5155. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},smalltalk.Point)})},
  5156. args: ["aPoint"],
  5157. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5158. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  5159. referencedClasses: ["Point"]
  5160. }),
  5161. smalltalk.Point);
  5162. smalltalk.addMethod(
  5163. smalltalk.method({
  5164. selector: "-",
  5165. category: 'arithmetic',
  5166. fn: function (aPoint){
  5167. var self=this;
  5168. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5169. return smalltalk.withContext(function($ctx1) {
  5170. var $1;
  5171. $1=_st($Point())._x_y_(_st(self._x()).__minus(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__minus(_st(_st(aPoint)._asPoint())._y()));
  5172. return $1;
  5173. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},smalltalk.Point)})},
  5174. args: ["aPoint"],
  5175. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5176. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  5177. referencedClasses: ["Point"]
  5178. }),
  5179. smalltalk.Point);
  5180. smalltalk.addMethod(
  5181. smalltalk.method({
  5182. selector: "/",
  5183. category: 'arithmetic',
  5184. fn: function (aPoint){
  5185. var self=this;
  5186. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5187. return smalltalk.withContext(function($ctx1) {
  5188. var $1;
  5189. $1=_st($Point())._x_y_(_st(self._x()).__slash(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__slash(_st(_st(aPoint)._asPoint())._y()));
  5190. return $1;
  5191. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},smalltalk.Point)})},
  5192. args: ["aPoint"],
  5193. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5194. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  5195. referencedClasses: ["Point"]
  5196. }),
  5197. smalltalk.Point);
  5198. smalltalk.addMethod(
  5199. smalltalk.method({
  5200. selector: "=",
  5201. category: 'arithmetic',
  5202. fn: function (aPoint){
  5203. var self=this;
  5204. return smalltalk.withContext(function($ctx1) {
  5205. var $1;
  5206. $1=_st(_st(_st(aPoint)._class()).__eq(self._class()))._and_((function(){
  5207. return smalltalk.withContext(function($ctx2) {
  5208. return _st(_st(_st(aPoint)._x()).__eq(self._x())).__and(_st(_st(aPoint)._y()).__eq(self._y()));
  5209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5210. return $1;
  5211. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},smalltalk.Point)})},
  5212. args: ["aPoint"],
  5213. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  5214. messageSends: ["and:", "&", "=", "y", "x", "class"],
  5215. referencedClasses: []
  5216. }),
  5217. smalltalk.Point);
  5218. smalltalk.addMethod(
  5219. smalltalk.method({
  5220. selector: "asPoint",
  5221. category: 'converting',
  5222. fn: function (){
  5223. var self=this;
  5224. return smalltalk.withContext(function($ctx1) {
  5225. var $1;
  5226. $1=self;
  5227. return $1;
  5228. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Point)})},
  5229. args: [],
  5230. source: "asPoint\x0a\x09^self",
  5231. messageSends: [],
  5232. referencedClasses: []
  5233. }),
  5234. smalltalk.Point);
  5235. smalltalk.addMethod(
  5236. smalltalk.method({
  5237. selector: "printOn:",
  5238. category: 'printing',
  5239. fn: function (aStream){
  5240. var self=this;
  5241. return smalltalk.withContext(function($ctx1) {
  5242. var $1;
  5243. _st(self["@x"])._printOn_(aStream);
  5244. _st(aStream)._nextPutAll_("@");
  5245. $1=_st(_st(self["@y"])._notNil())._and_((function(){
  5246. return smalltalk.withContext(function($ctx2) {
  5247. return _st(self["@y"])._negative();
  5248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5249. if(smalltalk.assert($1)){
  5250. _st(aStream)._space();
  5251. };
  5252. _st(self["@y"])._printOn_(aStream);
  5253. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Point)})},
  5254. args: ["aStream"],
  5255. 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",
  5256. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "space", "and:", "negative", "notNil"],
  5257. referencedClasses: []
  5258. }),
  5259. smalltalk.Point);
  5260. smalltalk.addMethod(
  5261. smalltalk.method({
  5262. selector: "translateBy:",
  5263. category: 'transforming',
  5264. fn: function (delta){
  5265. var self=this;
  5266. return smalltalk.withContext(function($ctx1) {
  5267. var $1;
  5268. $1=_st(_st(_st(delta)._x()).__plus(self["@x"])).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  5269. return $1;
  5270. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},smalltalk.Point)})},
  5271. args: ["delta"],
  5272. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  5273. messageSends: ["@", "+", "y", "x"],
  5274. referencedClasses: []
  5275. }),
  5276. smalltalk.Point);
  5277. smalltalk.addMethod(
  5278. smalltalk.method({
  5279. selector: "x",
  5280. category: 'accessing',
  5281. fn: function (){
  5282. var self=this;
  5283. return smalltalk.withContext(function($ctx1) {
  5284. var $1;
  5285. $1=self["@x"];
  5286. return $1;
  5287. }, function($ctx1) {$ctx1.fill(self,"x",{},smalltalk.Point)})},
  5288. args: [],
  5289. source: "x\x0a\x09^x",
  5290. messageSends: [],
  5291. referencedClasses: []
  5292. }),
  5293. smalltalk.Point);
  5294. smalltalk.addMethod(
  5295. smalltalk.method({
  5296. selector: "x:",
  5297. category: 'accessing',
  5298. fn: function (aNumber){
  5299. var self=this;
  5300. return smalltalk.withContext(function($ctx1) {
  5301. self["@x"]=aNumber;
  5302. return self}, function($ctx1) {$ctx1.fill(self,"x:",{aNumber:aNumber},smalltalk.Point)})},
  5303. args: ["aNumber"],
  5304. source: "x: aNumber\x0a\x09x := aNumber",
  5305. messageSends: [],
  5306. referencedClasses: []
  5307. }),
  5308. smalltalk.Point);
  5309. smalltalk.addMethod(
  5310. smalltalk.method({
  5311. selector: "y",
  5312. category: 'accessing',
  5313. fn: function (){
  5314. var self=this;
  5315. return smalltalk.withContext(function($ctx1) {
  5316. var $1;
  5317. $1=self["@y"];
  5318. return $1;
  5319. }, function($ctx1) {$ctx1.fill(self,"y",{},smalltalk.Point)})},
  5320. args: [],
  5321. source: "y\x0a\x09^y",
  5322. messageSends: [],
  5323. referencedClasses: []
  5324. }),
  5325. smalltalk.Point);
  5326. smalltalk.addMethod(
  5327. smalltalk.method({
  5328. selector: "y:",
  5329. category: 'accessing',
  5330. fn: function (aNumber){
  5331. var self=this;
  5332. return smalltalk.withContext(function($ctx1) {
  5333. self["@y"]=aNumber;
  5334. return self}, function($ctx1) {$ctx1.fill(self,"y:",{aNumber:aNumber},smalltalk.Point)})},
  5335. args: ["aNumber"],
  5336. source: "y: aNumber\x0a\x09y := aNumber",
  5337. messageSends: [],
  5338. referencedClasses: []
  5339. }),
  5340. smalltalk.Point);
  5341. smalltalk.addMethod(
  5342. smalltalk.method({
  5343. selector: "heliosClass",
  5344. category: 'helios',
  5345. fn: function (){
  5346. var self=this;
  5347. return smalltalk.withContext(function($ctx1) {
  5348. return "magnitude";
  5349. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Point.klass)})},
  5350. args: [],
  5351. source: "heliosClass\x0a\x09^ 'magnitude'",
  5352. messageSends: [],
  5353. referencedClasses: []
  5354. }),
  5355. smalltalk.Point.klass);
  5356. smalltalk.addMethod(
  5357. smalltalk.method({
  5358. selector: "x:y:",
  5359. category: 'instance creation',
  5360. fn: function (aNumber,anotherNumber){
  5361. var self=this;
  5362. return smalltalk.withContext(function($ctx1) {
  5363. var $2,$3,$1;
  5364. $2=self._new();
  5365. _st($2)._x_(aNumber);
  5366. _st($2)._y_(anotherNumber);
  5367. $3=_st($2)._yourself();
  5368. $1=$3;
  5369. return $1;
  5370. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Point.klass)})},
  5371. args: ["aNumber", "anotherNumber"],
  5372. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5373. messageSends: ["x:", "new", "y:", "yourself"],
  5374. referencedClasses: []
  5375. }),
  5376. smalltalk.Point.klass);
  5377. smalltalk.addClass('ProgressHandler', smalltalk.Object, [], 'Kernel-Objects');
  5378. 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.";
  5379. smalltalk.addMethod(
  5380. smalltalk.method({
  5381. selector: "do:on:displaying:",
  5382. category: 'progress handling',
  5383. fn: function (aBlock,aCollection,aString){
  5384. var self=this;
  5385. return smalltalk.withContext(function($ctx1) {
  5386. _st(aCollection)._do_(aBlock);
  5387. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},smalltalk.ProgressHandler)})},
  5388. args: ["aBlock", "aCollection", "aString"],
  5389. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  5390. messageSends: ["do:"],
  5391. referencedClasses: []
  5392. }),
  5393. smalltalk.ProgressHandler);
  5394. smalltalk.ProgressHandler.klass.iVarNames = ['current'];
  5395. smalltalk.addMethod(
  5396. smalltalk.method({
  5397. selector: "current",
  5398. category: 'accessing',
  5399. fn: function (){
  5400. var self=this;
  5401. return smalltalk.withContext(function($ctx1) {
  5402. var $2,$1;
  5403. $2=self["@current"];
  5404. if(($receiver = $2) == nil || $receiver == undefined){
  5405. self["@current"]=self._new();
  5406. $1=self["@current"];
  5407. } else {
  5408. $1=$2;
  5409. };
  5410. return $1;
  5411. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ProgressHandler.klass)})},
  5412. args: [],
  5413. source: "current\x0a\x09^current ifNil: [ current := self new ]",
  5414. messageSends: ["ifNil:", "new"],
  5415. referencedClasses: []
  5416. }),
  5417. smalltalk.ProgressHandler.klass);
  5418. smalltalk.addMethod(
  5419. smalltalk.method({
  5420. selector: "initialize",
  5421. category: 'initialization',
  5422. fn: function (){
  5423. var self=this;
  5424. return smalltalk.withContext(function($ctx1) {
  5425. self._register();
  5426. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ProgressHandler.klass)})},
  5427. args: [],
  5428. source: "initialize\x0a\x09self register",
  5429. messageSends: ["register"],
  5430. referencedClasses: []
  5431. }),
  5432. smalltalk.ProgressHandler.klass);
  5433. smalltalk.addMethod(
  5434. smalltalk.method({
  5435. selector: "register",
  5436. category: 'initialization',
  5437. fn: function (){
  5438. var self=this;
  5439. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  5440. return smalltalk.withContext(function($ctx1) {
  5441. _st($ProgressHandler())._setCurrent_(self._new());
  5442. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ProgressHandler.klass)})},
  5443. args: [],
  5444. source: "register\x0a\x09ProgressHandler setCurrent: self new",
  5445. messageSends: ["setCurrent:", "new"],
  5446. referencedClasses: ["ProgressHandler"]
  5447. }),
  5448. smalltalk.ProgressHandler.klass);
  5449. smalltalk.addMethod(
  5450. smalltalk.method({
  5451. selector: "setCurrent:",
  5452. category: 'accessing',
  5453. fn: function (anHandler){
  5454. var self=this;
  5455. return smalltalk.withContext(function($ctx1) {
  5456. self["@current"]=anHandler;
  5457. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ProgressHandler.klass)})},
  5458. args: ["anHandler"],
  5459. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  5460. messageSends: [],
  5461. referencedClasses: []
  5462. }),
  5463. smalltalk.ProgressHandler.klass);
  5464. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  5465. 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'`.";
  5466. smalltalk.addMethod(
  5467. smalltalk.method({
  5468. selector: "next",
  5469. category: 'accessing',
  5470. fn: function (){
  5471. var self=this;
  5472. return smalltalk.withContext(function($ctx1) {
  5473. return Math.random();
  5474. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Random)})},
  5475. args: [],
  5476. source: "next\x0a\x09<return Math.random()>",
  5477. messageSends: [],
  5478. referencedClasses: []
  5479. }),
  5480. smalltalk.Random);
  5481. smalltalk.addMethod(
  5482. smalltalk.method({
  5483. selector: "next:",
  5484. category: 'accessing',
  5485. fn: function (anInteger){
  5486. var self=this;
  5487. return smalltalk.withContext(function($ctx1) {
  5488. var $1;
  5489. $1=_st((1)._to_(anInteger))._collect_((function(each){
  5490. return smalltalk.withContext(function($ctx2) {
  5491. return self._next();
  5492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5493. return $1;
  5494. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},smalltalk.Random)})},
  5495. args: ["anInteger"],
  5496. source: "next: anInteger\x0a\x09^(1 to: anInteger) collect: [:each | self next]",
  5497. messageSends: ["collect:", "next", "to:"],
  5498. referencedClasses: []
  5499. }),
  5500. smalltalk.Random);
  5501. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  5502. 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.";
  5503. smalltalk.addMethod(
  5504. smalltalk.method({
  5505. selector: "addGlobalJsVariable:",
  5506. category: 'globals',
  5507. fn: function (aString){
  5508. var self=this;
  5509. return smalltalk.withContext(function($ctx1) {
  5510. var $1;
  5511. _st(self._globalJsVariables())._add_(aString);
  5512. $1=self;
  5513. return $1;
  5514. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},smalltalk.Smalltalk)})},
  5515. args: ["aString"],
  5516. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString.\x0a\x09^self",
  5517. messageSends: ["add:", "globalJsVariables"],
  5518. referencedClasses: []
  5519. }),
  5520. smalltalk.Smalltalk);
  5521. smalltalk.addMethod(
  5522. smalltalk.method({
  5523. selector: "asSmalltalkException:",
  5524. category: 'error handling',
  5525. fn: function (anObject){
  5526. var self=this;
  5527. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5528. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5529. return smalltalk.withContext(function($ctx1) {
  5530. var $2,$1;
  5531. $2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
  5532. return smalltalk.withContext(function($ctx2) {
  5533. return _st(anObject)._isKindOf_($Error());
  5534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5535. if(smalltalk.assert($2)){
  5536. $1=anObject;
  5537. } else {
  5538. $1=_st($JavaScriptException())._on_(anObject);
  5539. };
  5540. return $1;
  5541. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.Smalltalk)})},
  5542. args: ["anObject"],
  5543. 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 ]",
  5544. messageSends: ["ifTrue:ifFalse:", "on:", "and:", "isKindOf:", "isSmalltalkObject:"],
  5545. referencedClasses: ["JavaScriptException", "Error"]
  5546. }),
  5547. smalltalk.Smalltalk);
  5548. smalltalk.addMethod(
  5549. smalltalk.method({
  5550. selector: "at:",
  5551. category: 'accessing',
  5552. fn: function (aString){
  5553. var self=this;
  5554. return smalltalk.withContext(function($ctx1) {
  5555. return self[aString];
  5556. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
  5557. args: ["aString"],
  5558. source: "at: aString\x0a\x09<return self[aString]>",
  5559. messageSends: [],
  5560. referencedClasses: []
  5561. }),
  5562. smalltalk.Smalltalk);
  5563. smalltalk.addMethod(
  5564. smalltalk.method({
  5565. selector: "basicParse:",
  5566. category: 'private',
  5567. fn: function (aString){
  5568. var self=this;
  5569. return smalltalk.withContext(function($ctx1) {
  5570. return smalltalk.parser.parse(aString);
  5571. return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.Smalltalk)})},
  5572. args: ["aString"],
  5573. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  5574. messageSends: [],
  5575. referencedClasses: []
  5576. }),
  5577. smalltalk.Smalltalk);
  5578. smalltalk.addMethod(
  5579. smalltalk.method({
  5580. selector: "classes",
  5581. category: 'classes',
  5582. fn: function (){
  5583. var self=this;
  5584. return smalltalk.withContext(function($ctx1) {
  5585. return self.classes();
  5586. return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)})},
  5587. args: [],
  5588. source: "classes\x0a\x09<return self.classes()>",
  5589. messageSends: [],
  5590. referencedClasses: []
  5591. }),
  5592. smalltalk.Smalltalk);
  5593. smalltalk.addMethod(
  5594. smalltalk.method({
  5595. selector: "createPackage:",
  5596. category: 'packages',
  5597. fn: function (packageName){
  5598. var self=this;
  5599. return smalltalk.withContext(function($ctx1) {
  5600. return smalltalk.addPackage(packageName);
  5601. return self}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  5602. args: ["packageName"],
  5603. source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
  5604. messageSends: [],
  5605. referencedClasses: []
  5606. }),
  5607. smalltalk.Smalltalk);
  5608. smalltalk.addMethod(
  5609. smalltalk.method({
  5610. selector: "createPackage:properties:",
  5611. category: 'private',
  5612. fn: function (packageName,aDict){
  5613. var self=this;
  5614. return smalltalk.withContext(function($ctx1) {
  5615. var $1,$2;
  5616. self._deprecatedAPI();
  5617. $1=_st(aDict)._isEmpty();
  5618. if(! smalltalk.assert($1)){
  5619. self._error_("createPackage:properties: called with nonempty properties");
  5620. };
  5621. $2=self._createPackage_(packageName);
  5622. return $2;
  5623. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.Smalltalk)})},
  5624. args: ["packageName", "aDict"],
  5625. 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",
  5626. messageSends: ["deprecatedAPI", "ifFalse:", "error:", "isEmpty", "createPackage:"],
  5627. referencedClasses: []
  5628. }),
  5629. smalltalk.Smalltalk);
  5630. smalltalk.addMethod(
  5631. smalltalk.method({
  5632. selector: "deleteClass:",
  5633. category: 'classes',
  5634. fn: function (aClass){
  5635. var self=this;
  5636. return smalltalk.withContext(function($ctx1) {
  5637. self.removeClass(aClass);
  5638. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  5639. args: ["aClass"],
  5640. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<self.removeClass(aClass)>",
  5641. messageSends: [],
  5642. referencedClasses: []
  5643. }),
  5644. smalltalk.Smalltalk);
  5645. smalltalk.addMethod(
  5646. smalltalk.method({
  5647. selector: "deleteGlobalJsVariable:",
  5648. category: 'globals',
  5649. fn: function (aString){
  5650. var self=this;
  5651. return smalltalk.withContext(function($ctx1) {
  5652. var $1;
  5653. _st(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  5654. return smalltalk.withContext(function($ctx2) {
  5655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5656. $1=self;
  5657. return $1;
  5658. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},smalltalk.Smalltalk)})},
  5659. args: ["aString"],
  5660. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[].\x0a\x09^self",
  5661. messageSends: ["remove:ifAbsent:", "globalJsVariables"],
  5662. referencedClasses: []
  5663. }),
  5664. smalltalk.Smalltalk);
  5665. smalltalk.addMethod(
  5666. smalltalk.method({
  5667. selector: "deletePackage:",
  5668. category: 'packages',
  5669. fn: function (packageName){
  5670. var self=this;
  5671. return smalltalk.withContext(function($ctx1) {
  5672. delete smalltalk.packages[packageName];
  5673. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  5674. args: ["packageName"],
  5675. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete smalltalk.packages[packageName]>",
  5676. messageSends: [],
  5677. referencedClasses: []
  5678. }),
  5679. smalltalk.Smalltalk);
  5680. smalltalk.addMethod(
  5681. smalltalk.method({
  5682. selector: "globalJsVariables",
  5683. category: 'globals',
  5684. fn: function (){
  5685. var self=this;
  5686. return smalltalk.withContext(function($ctx1) {
  5687. return self.globalJsVariables;
  5688. return self}, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},smalltalk.Smalltalk)})},
  5689. args: [],
  5690. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return self.globalJsVariables>",
  5691. messageSends: [],
  5692. referencedClasses: []
  5693. }),
  5694. smalltalk.Smalltalk);
  5695. smalltalk.addMethod(
  5696. smalltalk.method({
  5697. selector: "isSmalltalkObject:",
  5698. category: 'testing',
  5699. fn: function (anObject){
  5700. var self=this;
  5701. return smalltalk.withContext(function($ctx1) {
  5702. return typeof anObject.klass !== 'undefined';
  5703. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  5704. args: ["anObject"],
  5705. 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'>",
  5706. messageSends: [],
  5707. referencedClasses: []
  5708. }),
  5709. smalltalk.Smalltalk);
  5710. smalltalk.addMethod(
  5711. smalltalk.method({
  5712. selector: "packageAt:",
  5713. category: 'packages',
  5714. fn: function (packageName){
  5715. var self=this;
  5716. return smalltalk.withContext(function($ctx1) {
  5717. return self.packages[packageName];
  5718. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.Smalltalk)})},
  5719. args: ["packageName"],
  5720. source: "packageAt: packageName\x0a\x09<return self.packages[packageName]>",
  5721. messageSends: [],
  5722. referencedClasses: []
  5723. }),
  5724. smalltalk.Smalltalk);
  5725. smalltalk.addMethod(
  5726. smalltalk.method({
  5727. selector: "packageAt:ifAbsent:",
  5728. category: 'packages',
  5729. fn: function (packageName,aBlock){
  5730. var self=this;
  5731. return smalltalk.withContext(function($ctx1) {
  5732. var $2,$1;
  5733. $2=self._packageAt_(packageName);
  5734. $1=_st($2)._ifNil_(aBlock);
  5735. return $1;
  5736. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.Smalltalk)})},
  5737. args: ["packageName", "aBlock"],
  5738. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^(self packageAt: packageName) ifNil: aBlock",
  5739. messageSends: ["ifNil:", "packageAt:"],
  5740. referencedClasses: []
  5741. }),
  5742. smalltalk.Smalltalk);
  5743. smalltalk.addMethod(
  5744. smalltalk.method({
  5745. selector: "packages",
  5746. category: 'packages',
  5747. fn: function (){
  5748. var self=this;
  5749. return smalltalk.withContext(function($ctx1) {
  5750. return self.packages.all();
  5751. return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Smalltalk)})},
  5752. args: [],
  5753. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  5754. messageSends: [],
  5755. referencedClasses: []
  5756. }),
  5757. smalltalk.Smalltalk);
  5758. smalltalk.addMethod(
  5759. smalltalk.method({
  5760. selector: "parse:",
  5761. category: 'accessing',
  5762. fn: function (aString){
  5763. var self=this;
  5764. var result;
  5765. return smalltalk.withContext(function($ctx1) {
  5766. var $2,$3,$1;
  5767. self._try_catch_((function(){
  5768. return smalltalk.withContext(function($ctx2) {
  5769. result=self._basicParse_(aString);
  5770. return result;
  5771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(ex){
  5772. return smalltalk.withContext(function($ctx2) {
  5773. return _st(self._parseError_parsing_(ex,aString))._signal();
  5774. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  5775. $2=result;
  5776. _st($2)._source_(aString);
  5777. $3=_st($2)._yourself();
  5778. $1=$3;
  5779. return $1;
  5780. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})},
  5781. args: ["aString"],
  5782. 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",
  5783. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
  5784. referencedClasses: []
  5785. }),
  5786. smalltalk.Smalltalk);
  5787. smalltalk.addMethod(
  5788. smalltalk.method({
  5789. selector: "parseError:parsing:",
  5790. category: 'error handling',
  5791. fn: function (anException,aString){
  5792. var self=this;
  5793. function $ParseError(){return smalltalk.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  5794. return smalltalk.withContext(function($ctx1) {
  5795. var $1;
  5796. $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")));
  5797. return $1;
  5798. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.Smalltalk)})},
  5799. args: ["anException", "aString"],
  5800. 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')",
  5801. messageSends: ["messageText:", ",", "basicAt:", "new"],
  5802. referencedClasses: ["ParseError"]
  5803. }),
  5804. smalltalk.Smalltalk);
  5805. smalltalk.addMethod(
  5806. smalltalk.method({
  5807. selector: "pseudoVariableNames",
  5808. category: 'packages',
  5809. fn: function (){
  5810. var self=this;
  5811. return smalltalk.withContext(function($ctx1) {
  5812. var $1;
  5813. $1=["self", "super", "nil", "true", "false", "thisContext"];
  5814. return $1;
  5815. }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.Smalltalk)})},
  5816. args: [],
  5817. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  5818. messageSends: [],
  5819. referencedClasses: []
  5820. }),
  5821. smalltalk.Smalltalk);
  5822. smalltalk.addMethod(
  5823. smalltalk.method({
  5824. selector: "readJSObject:",
  5825. category: 'accessing',
  5826. fn: function (anObject){
  5827. var self=this;
  5828. return smalltalk.withContext(function($ctx1) {
  5829. return self.readJSObject(anObject);
  5830. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  5831. args: ["anObject"],
  5832. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  5833. messageSends: [],
  5834. referencedClasses: []
  5835. }),
  5836. smalltalk.Smalltalk);
  5837. smalltalk.addMethod(
  5838. smalltalk.method({
  5839. selector: "removeClass:",
  5840. category: 'classes',
  5841. fn: function (aClass){
  5842. var self=this;
  5843. function $ClassRemoved(){return smalltalk.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  5844. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5845. return smalltalk.withContext(function($ctx1) {
  5846. var $1,$2,$3;
  5847. $1=_st(aClass)._isMetaclass();
  5848. if(smalltalk.assert($1)){
  5849. self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  5850. };
  5851. self._deleteClass_(aClass);
  5852. $2=_st($ClassRemoved())._new();
  5853. _st($2)._theClass_(aClass);
  5854. $3=_st($2)._yourself();
  5855. _st(_st($SystemAnnouncer())._current())._announce_($3);
  5856. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  5857. args: ["aClass"],
  5858. 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)",
  5859. messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
  5860. referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
  5861. }),
  5862. smalltalk.Smalltalk);
  5863. smalltalk.addMethod(
  5864. smalltalk.method({
  5865. selector: "removePackage:",
  5866. category: 'packages',
  5867. fn: function (packageName){
  5868. var self=this;
  5869. var pkg;
  5870. return smalltalk.withContext(function($ctx1) {
  5871. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  5872. return smalltalk.withContext(function($ctx2) {
  5873. return self._error_("Missing package: ".__comma(packageName));
  5874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5875. _st(_st(pkg)._classes())._do_((function(each){
  5876. return smalltalk.withContext(function($ctx2) {
  5877. return self._removeClass_(each);
  5878. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5879. self._deletePackage_(packageName);
  5880. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.Smalltalk)})},
  5881. args: ["packageName"],
  5882. 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",
  5883. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
  5884. referencedClasses: []
  5885. }),
  5886. smalltalk.Smalltalk);
  5887. smalltalk.addMethod(
  5888. smalltalk.method({
  5889. selector: "renamePackage:to:",
  5890. category: 'packages',
  5891. fn: function (packageName,newName){
  5892. var self=this;
  5893. var pkg;
  5894. return smalltalk.withContext(function($ctx1) {
  5895. var $1;
  5896. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  5897. return smalltalk.withContext(function($ctx2) {
  5898. return self._error_("Missing package: ".__comma(packageName));
  5899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5900. $1=self._packageAt_(newName);
  5901. if(($receiver = $1) == nil || $receiver == undefined){
  5902. $1;
  5903. } else {
  5904. self._error_("Already exists a package called: ".__comma(newName));
  5905. };
  5906. _st(self._basicAt_("packages"))._at_put_(newName,pkg);
  5907. _st(pkg)._name_(newName);
  5908. self._deletePackage_(packageName);
  5909. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})},
  5910. args: ["packageName", "newName"],
  5911. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].\x0a\x09(self basicAt: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  5912. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "basicAt:", "name:", "deletePackage:"],
  5913. referencedClasses: []
  5914. }),
  5915. smalltalk.Smalltalk);
  5916. smalltalk.addMethod(
  5917. smalltalk.method({
  5918. selector: "reservedWords",
  5919. category: 'accessing',
  5920. fn: function (){
  5921. var self=this;
  5922. return smalltalk.withContext(function($ctx1) {
  5923. return self.reservedWords;
  5924. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.Smalltalk)})},
  5925. args: [],
  5926. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  5927. messageSends: [],
  5928. referencedClasses: []
  5929. }),
  5930. smalltalk.Smalltalk);
  5931. smalltalk.addMethod(
  5932. smalltalk.method({
  5933. selector: "version",
  5934. category: 'accessing',
  5935. fn: function (){
  5936. var self=this;
  5937. return smalltalk.withContext(function($ctx1) {
  5938. return "0.10";
  5939. }, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.Smalltalk)})},
  5940. args: [],
  5941. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.10'",
  5942. messageSends: [],
  5943. referencedClasses: []
  5944. }),
  5945. smalltalk.Smalltalk);
  5946. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  5947. smalltalk.addMethod(
  5948. smalltalk.method({
  5949. selector: "current",
  5950. category: 'accessing',
  5951. fn: function (){
  5952. var self=this;
  5953. return smalltalk.withContext(function($ctx1) {
  5954. return smalltalk;
  5955. return self}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.klass)})},
  5956. args: [],
  5957. source: "current\x0a\x09<return smalltalk>",
  5958. messageSends: [],
  5959. referencedClasses: []
  5960. }),
  5961. smalltalk.Smalltalk.klass);
  5962. smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Objects');
  5963. 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.";
  5964. smalltalk.addMethod(
  5965. smalltalk.method({
  5966. selector: "clearInterval",
  5967. category: 'timeout/interval',
  5968. fn: function (){
  5969. var self=this;
  5970. return smalltalk.withContext(function($ctx1) {
  5971. var interval = self["@rawTimeout"];
  5972. clearInterval(interval);
  5973. ;
  5974. return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},smalltalk.Timeout)})},
  5975. args: [],
  5976. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  5977. messageSends: [],
  5978. referencedClasses: []
  5979. }),
  5980. smalltalk.Timeout);
  5981. smalltalk.addMethod(
  5982. smalltalk.method({
  5983. selector: "clearTimeout",
  5984. category: 'timeout/interval',
  5985. fn: function (){
  5986. var self=this;
  5987. return smalltalk.withContext(function($ctx1) {
  5988. var timeout = self["@rawTimeout"];
  5989. clearTimeout(timeout);
  5990. ;
  5991. return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},smalltalk.Timeout)})},
  5992. args: [],
  5993. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  5994. messageSends: [],
  5995. referencedClasses: []
  5996. }),
  5997. smalltalk.Timeout);
  5998. smalltalk.addMethod(
  5999. smalltalk.method({
  6000. selector: "rawTimeout:",
  6001. category: 'accessing',
  6002. fn: function (anObject){
  6003. var self=this;
  6004. return smalltalk.withContext(function($ctx1) {
  6005. self["@rawTimeout"]=anObject;
  6006. return self}, function($ctx1) {$ctx1.fill(self,"rawTimeout:",{anObject:anObject},smalltalk.Timeout)})},
  6007. args: ["anObject"],
  6008. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  6009. messageSends: [],
  6010. referencedClasses: []
  6011. }),
  6012. smalltalk.Timeout);
  6013. smalltalk.addMethod(
  6014. smalltalk.method({
  6015. selector: "on:",
  6016. category: 'instance creation',
  6017. fn: function (anObject){
  6018. var self=this;
  6019. return smalltalk.withContext(function($ctx1) {
  6020. var $2,$3,$1;
  6021. $2=self._new();
  6022. _st($2)._rawTimeout_(anObject);
  6023. $3=_st($2)._yourself();
  6024. $1=$3;
  6025. return $1;
  6026. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},smalltalk.Timeout.klass)})},
  6027. args: ["anObject"],
  6028. source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself",
  6029. messageSends: ["rawTimeout:", "new", "yourself"],
  6030. referencedClasses: []
  6031. }),
  6032. smalltalk.Timeout.klass);
  6033. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  6034. 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`.";
  6035. smalltalk.addMethod(
  6036. smalltalk.method({
  6037. selector: "asJSON",
  6038. category: 'converting',
  6039. fn: function (){
  6040. var self=this;
  6041. return smalltalk.withContext(function($ctx1) {
  6042. var $1;
  6043. $1=null;
  6044. return $1;
  6045. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.UndefinedObject)})},
  6046. args: [],
  6047. source: "asJSON\x0a\x09^null",
  6048. messageSends: [],
  6049. referencedClasses: []
  6050. }),
  6051. smalltalk.UndefinedObject);
  6052. smalltalk.addMethod(
  6053. smalltalk.method({
  6054. selector: "deepCopy",
  6055. category: 'copying',
  6056. fn: function (){
  6057. var self=this;
  6058. return smalltalk.withContext(function($ctx1) {
  6059. var $1;
  6060. $1=self;
  6061. return $1;
  6062. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.UndefinedObject)})},
  6063. args: [],
  6064. source: "deepCopy\x0a\x09^self",
  6065. messageSends: [],
  6066. referencedClasses: []
  6067. }),
  6068. smalltalk.UndefinedObject);
  6069. smalltalk.addMethod(
  6070. smalltalk.method({
  6071. selector: "ifNil:",
  6072. category: 'testing',
  6073. fn: function (aBlock){
  6074. var self=this;
  6075. return smalltalk.withContext(function($ctx1) {
  6076. var $2,$1;
  6077. $2=self;
  6078. $1=_st($2)._ifNil_ifNotNil_(aBlock,(function(){
  6079. return smalltalk.withContext(function($ctx2) {
  6080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6081. return $1;
  6082. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  6083. args: ["aBlock"],
  6084. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  6085. messageSends: ["ifNil:ifNotNil:"],
  6086. referencedClasses: []
  6087. }),
  6088. smalltalk.UndefinedObject);
  6089. smalltalk.addMethod(
  6090. smalltalk.method({
  6091. selector: "ifNil:ifNotNil:",
  6092. category: 'testing',
  6093. fn: function (aBlock,anotherBlock){
  6094. var self=this;
  6095. return smalltalk.withContext(function($ctx1) {
  6096. var $1;
  6097. $1=_st(aBlock)._value();
  6098. return $1;
  6099. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  6100. args: ["aBlock", "anotherBlock"],
  6101. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  6102. messageSends: ["value"],
  6103. referencedClasses: []
  6104. }),
  6105. smalltalk.UndefinedObject);
  6106. smalltalk.addMethod(
  6107. smalltalk.method({
  6108. selector: "ifNotNil:",
  6109. category: 'testing',
  6110. fn: function (aBlock){
  6111. var self=this;
  6112. return smalltalk.withContext(function($ctx1) {
  6113. var $1;
  6114. $1=self;
  6115. return $1;
  6116. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  6117. args: ["aBlock"],
  6118. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  6119. messageSends: [],
  6120. referencedClasses: []
  6121. }),
  6122. smalltalk.UndefinedObject);
  6123. smalltalk.addMethod(
  6124. smalltalk.method({
  6125. selector: "ifNotNil:ifNil:",
  6126. category: 'testing',
  6127. fn: function (aBlock,anotherBlock){
  6128. var self=this;
  6129. return smalltalk.withContext(function($ctx1) {
  6130. var $1;
  6131. $1=_st(anotherBlock)._value();
  6132. return $1;
  6133. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  6134. args: ["aBlock", "anotherBlock"],
  6135. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  6136. messageSends: ["value"],
  6137. referencedClasses: []
  6138. }),
  6139. smalltalk.UndefinedObject);
  6140. smalltalk.addMethod(
  6141. smalltalk.method({
  6142. selector: "isImmutable",
  6143. category: 'testing',
  6144. fn: function (){
  6145. var self=this;
  6146. return smalltalk.withContext(function($ctx1) {
  6147. return true;
  6148. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.UndefinedObject)})},
  6149. args: [],
  6150. source: "isImmutable\x0a\x09^ true",
  6151. messageSends: [],
  6152. referencedClasses: []
  6153. }),
  6154. smalltalk.UndefinedObject);
  6155. smalltalk.addMethod(
  6156. smalltalk.method({
  6157. selector: "isNil",
  6158. category: 'testing',
  6159. fn: function (){
  6160. var self=this;
  6161. return smalltalk.withContext(function($ctx1) {
  6162. return true;
  6163. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.UndefinedObject)})},
  6164. args: [],
  6165. source: "isNil\x0a\x09^true",
  6166. messageSends: [],
  6167. referencedClasses: []
  6168. }),
  6169. smalltalk.UndefinedObject);
  6170. smalltalk.addMethod(
  6171. smalltalk.method({
  6172. selector: "notNil",
  6173. category: 'testing',
  6174. fn: function (){
  6175. var self=this;
  6176. return smalltalk.withContext(function($ctx1) {
  6177. return false;
  6178. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.UndefinedObject)})},
  6179. args: [],
  6180. source: "notNil\x0a\x09^false",
  6181. messageSends: [],
  6182. referencedClasses: []
  6183. }),
  6184. smalltalk.UndefinedObject);
  6185. smalltalk.addMethod(
  6186. smalltalk.method({
  6187. selector: "printOn:",
  6188. category: 'printing',
  6189. fn: function (aStream){
  6190. var self=this;
  6191. return smalltalk.withContext(function($ctx1) {
  6192. _st(aStream)._nextPutAll_("nil");
  6193. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.UndefinedObject)})},
  6194. args: ["aStream"],
  6195. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  6196. messageSends: ["nextPutAll:"],
  6197. referencedClasses: []
  6198. }),
  6199. smalltalk.UndefinedObject);
  6200. smalltalk.addMethod(
  6201. smalltalk.method({
  6202. selector: "shallowCopy",
  6203. category: 'copying',
  6204. fn: function (){
  6205. var self=this;
  6206. return smalltalk.withContext(function($ctx1) {
  6207. var $1;
  6208. $1=self;
  6209. return $1;
  6210. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.UndefinedObject)})},
  6211. args: [],
  6212. source: "shallowCopy\x0a\x09^self",
  6213. messageSends: [],
  6214. referencedClasses: []
  6215. }),
  6216. smalltalk.UndefinedObject);
  6217. smalltalk.addMethod(
  6218. smalltalk.method({
  6219. selector: "subclass:instanceVariableNames:",
  6220. category: 'class creation',
  6221. fn: function (aString,anotherString){
  6222. var self=this;
  6223. return smalltalk.withContext(function($ctx1) {
  6224. var $1;
  6225. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6226. return $1;
  6227. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.UndefinedObject)})},
  6228. args: ["aString", "anotherString"],
  6229. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  6230. messageSends: ["subclass:instanceVariableNames:package:"],
  6231. referencedClasses: []
  6232. }),
  6233. smalltalk.UndefinedObject);
  6234. smalltalk.addMethod(
  6235. smalltalk.method({
  6236. selector: "subclass:instanceVariableNames:category:",
  6237. category: 'class creation',
  6238. fn: function (aString,aString2,aString3){
  6239. var self=this;
  6240. return smalltalk.withContext(function($ctx1) {
  6241. var $1;
  6242. self._deprecatedAPI();
  6243. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6244. return $1;
  6245. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  6246. args: ["aString", "aString2", "aString3"],
  6247. 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",
  6248. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  6249. referencedClasses: []
  6250. }),
  6251. smalltalk.UndefinedObject);
  6252. smalltalk.addMethod(
  6253. smalltalk.method({
  6254. selector: "subclass:instanceVariableNames:package:",
  6255. category: 'class creation',
  6256. fn: function (aString,aString2,aString3){
  6257. var self=this;
  6258. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6259. return smalltalk.withContext(function($ctx1) {
  6260. var $1;
  6261. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  6262. return $1;
  6263. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  6264. args: ["aString", "aString2", "aString3"],
  6265. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6266. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  6267. referencedClasses: ["ClassBuilder"]
  6268. }),
  6269. smalltalk.UndefinedObject);
  6270. smalltalk.addMethod(
  6271. smalltalk.method({
  6272. selector: "new",
  6273. category: 'instance creation',
  6274. fn: function (){
  6275. var self=this;
  6276. return smalltalk.withContext(function($ctx1) {
  6277. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  6278. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.UndefinedObject.klass)})},
  6279. args: [],
  6280. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  6281. messageSends: ["error:"],
  6282. referencedClasses: []
  6283. }),
  6284. smalltalk.UndefinedObject.klass);
  6285. smalltalk.addMethod(
  6286. smalltalk.method({
  6287. selector: "asJavaScriptSelector",
  6288. category: '*Kernel-Objects',
  6289. fn: function (){
  6290. var self=this;
  6291. return smalltalk.withContext(function($ctx1) {
  6292. var $1;
  6293. $1=self._replace_with_("^([a-zA-Z0-9]*).*$","$1");
  6294. return $1;
  6295. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
  6296. args: [],
  6297. source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
  6298. messageSends: ["replace:with:"],
  6299. referencedClasses: []
  6300. }),
  6301. smalltalk.String);
  6302. smalltalk.addPackage('Kernel-Classes');
  6303. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  6304. 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.";
  6305. smalltalk.addMethod(
  6306. smalltalk.method({
  6307. selector: ">>",
  6308. category: 'accessing',
  6309. fn: function (aString){
  6310. var self=this;
  6311. return smalltalk.withContext(function($ctx1) {
  6312. var $1;
  6313. $1=self._methodAt_(aString);
  6314. return $1;
  6315. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},smalltalk.Behavior)})},
  6316. args: ["aString"],
  6317. source: ">> aString\x0a\x09^ self methodAt: aString",
  6318. messageSends: ["methodAt:"],
  6319. referencedClasses: []
  6320. }),
  6321. smalltalk.Behavior);
  6322. smalltalk.addMethod(
  6323. smalltalk.method({
  6324. selector: "addCompiledMethod:",
  6325. category: 'compiling',
  6326. fn: function (aMethod){
  6327. var self=this;
  6328. var oldMethod,announcement;
  6329. function $MethodAdded(){return smalltalk.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  6330. function $MethodModified(){return smalltalk.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  6331. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6332. return smalltalk.withContext(function($ctx1) {
  6333. var $1,$2,$3,$4,$5,$6;
  6334. oldMethod=_st(self._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
  6335. return smalltalk.withContext(function($ctx2) {
  6336. return nil;
  6337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6338. $1=_st(self._protocols())._includes_(_st(aMethod)._protocol());
  6339. if(! smalltalk.assert($1)){
  6340. _st(self._organization())._addElement_(_st(aMethod)._protocol());
  6341. };
  6342. self._basicAddCompiledMethod_(aMethod);
  6343. $2=oldMethod;
  6344. if(($receiver = $2) == nil || $receiver == undefined){
  6345. $3=_st($MethodAdded())._new();
  6346. _st($3)._method_(aMethod);
  6347. $4=_st($3)._yourself();
  6348. announcement=$4;
  6349. } else {
  6350. $5=_st($MethodModified())._new();
  6351. _st($5)._oldMethod_(oldMethod);
  6352. _st($5)._method_(aMethod);
  6353. $6=_st($5)._yourself();
  6354. announcement=$6;
  6355. };
  6356. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  6357. return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},smalltalk.Behavior)})},
  6358. args: ["aMethod"],
  6359. 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",
  6360. messageSends: ["at:ifAbsent:", "selector", "methodDictionary", "ifFalse:", "addElement:", "protocol", "organization", "includes:", "protocols", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"],
  6361. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"]
  6362. }),
  6363. smalltalk.Behavior);
  6364. smalltalk.addMethod(
  6365. smalltalk.method({
  6366. selector: "allInstanceVariableNames",
  6367. category: 'accessing',
  6368. fn: function (){
  6369. var self=this;
  6370. var result;
  6371. return smalltalk.withContext(function($ctx1) {
  6372. var $1,$2;
  6373. result=_st(self._instanceVariableNames())._copy();
  6374. $1=self._superclass();
  6375. if(($receiver = $1) == nil || $receiver == undefined){
  6376. $1;
  6377. } else {
  6378. _st(result)._addAll_(_st(self._superclass())._allInstanceVariableNames());
  6379. };
  6380. $2=result;
  6381. return $2;
  6382. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},smalltalk.Behavior)})},
  6383. args: [],
  6384. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  6385. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "addAll:", "allInstanceVariableNames", "superclass"],
  6386. referencedClasses: []
  6387. }),
  6388. smalltalk.Behavior);
  6389. smalltalk.addMethod(
  6390. smalltalk.method({
  6391. selector: "allSelectors",
  6392. category: 'accessing',
  6393. fn: function (){
  6394. var self=this;
  6395. return smalltalk.withContext(function($ctx1) {
  6396. var $2,$3,$1;
  6397. $1=_st(self._allSuperclasses())._inject_into_(self._selectors(),(function(soFar,aBehavior){
  6398. return smalltalk.withContext(function($ctx2) {
  6399. $2=soFar;
  6400. _st($2)._addAll_(_st(aBehavior)._selectors());
  6401. $3=_st($2)._yourself();
  6402. return $3;
  6403. }, function($ctx2) {$ctx2.fillBlock({soFar:soFar,aBehavior:aBehavior},$ctx1)})}));
  6404. return $1;
  6405. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Behavior)})},
  6406. args: [],
  6407. source: "allSelectors\x0a\x09^self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :soFar :aBehavior | soFar addAll: aBehavior selectors; yourself ]",
  6408. messageSends: ["inject:into:", "selectors", "addAll:", "yourself", "allSuperclasses"],
  6409. referencedClasses: []
  6410. }),
  6411. smalltalk.Behavior);
  6412. smalltalk.addMethod(
  6413. smalltalk.method({
  6414. selector: "allSubclasses",
  6415. category: 'accessing',
  6416. fn: function (){
  6417. var self=this;
  6418. var result;
  6419. return smalltalk.withContext(function($ctx1) {
  6420. var $1;
  6421. result=self._subclasses();
  6422. _st(self._subclasses())._do_((function(each){
  6423. return smalltalk.withContext(function($ctx2) {
  6424. return _st(result)._addAll_(_st(each)._allSubclasses());
  6425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6426. $1=result;
  6427. return $1;
  6428. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{result:result},smalltalk.Behavior)})},
  6429. args: [],
  6430. source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09\x09result addAll: each allSubclasses].\x0a\x09^result",
  6431. messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
  6432. referencedClasses: []
  6433. }),
  6434. smalltalk.Behavior);
  6435. smalltalk.addMethod(
  6436. smalltalk.method({
  6437. selector: "allSubclassesDo:",
  6438. category: 'enumerating',
  6439. fn: function (aBlock){
  6440. var self=this;
  6441. return smalltalk.withContext(function($ctx1) {
  6442. _st(self._subclasses())._do_((function(each){
  6443. return smalltalk.withContext(function($ctx2) {
  6444. _st(aBlock)._value_(each);
  6445. return _st(each)._allSubclassesDo_(aBlock);
  6446. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6447. return self}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},smalltalk.Behavior)})},
  6448. args: ["aBlock"],
  6449. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self subclasses do: [ :each |\x0a \x09aBlock value: each.\x0a each allSubclassesDo: aBlock ].",
  6450. messageSends: ["do:", "value:", "allSubclassesDo:", "subclasses"],
  6451. referencedClasses: []
  6452. }),
  6453. smalltalk.Behavior);
  6454. smalltalk.addMethod(
  6455. smalltalk.method({
  6456. selector: "allSuperclasses",
  6457. category: 'accessing',
  6458. fn: function (){
  6459. var self=this;
  6460. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  6461. return smalltalk.withContext(function($ctx1) {
  6462. var $1,$2,$4,$5,$3;
  6463. $1=self._superclass();
  6464. if(($receiver = $1) == nil || $receiver == undefined){
  6465. $2=[];
  6466. return $2;
  6467. } else {
  6468. $1;
  6469. };
  6470. $4=_st($OrderedCollection())._with_(self._superclass());
  6471. _st($4)._addAll_(_st(self._superclass())._allSuperclasses());
  6472. $5=_st($4)._yourself();
  6473. $3=$5;
  6474. return $3;
  6475. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},smalltalk.Behavior)})},
  6476. args: [],
  6477. 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",
  6478. messageSends: ["ifNil:", "superclass", "addAll:", "allSuperclasses", "with:", "yourself"],
  6479. referencedClasses: ["OrderedCollection"]
  6480. }),
  6481. smalltalk.Behavior);
  6482. smalltalk.addMethod(
  6483. smalltalk.method({
  6484. selector: "basicAddCompiledMethod:",
  6485. category: 'private',
  6486. fn: function (aMethod){
  6487. var self=this;
  6488. return smalltalk.withContext(function($ctx1) {
  6489. smalltalk.addMethod(aMethod, self);
  6490. return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  6491. args: ["aMethod"],
  6492. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
  6493. messageSends: [],
  6494. referencedClasses: []
  6495. }),
  6496. smalltalk.Behavior);
  6497. smalltalk.addMethod(
  6498. smalltalk.method({
  6499. selector: "basicNew",
  6500. category: 'instance creation',
  6501. fn: function (){
  6502. var self=this;
  6503. return smalltalk.withContext(function($ctx1) {
  6504. return new self.fn();
  6505. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{},smalltalk.Behavior)})},
  6506. args: [],
  6507. source: "basicNew\x0a\x09<return new self.fn()>",
  6508. messageSends: [],
  6509. referencedClasses: []
  6510. }),
  6511. smalltalk.Behavior);
  6512. smalltalk.addMethod(
  6513. smalltalk.method({
  6514. selector: "basicRemoveCompiledMethod:",
  6515. category: 'private',
  6516. fn: function (aMethod){
  6517. var self=this;
  6518. return smalltalk.withContext(function($ctx1) {
  6519. smalltalk.removeMethod(aMethod)
  6520. smalltalk.init(self);
  6521. ;
  6522. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  6523. args: ["aMethod"],
  6524. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<\x0a\x09\x09smalltalk.removeMethod(aMethod)\x0a\x09\x09smalltalk.init(self);\x0a\x09>",
  6525. messageSends: [],
  6526. referencedClasses: []
  6527. }),
  6528. smalltalk.Behavior);
  6529. smalltalk.addMethod(
  6530. smalltalk.method({
  6531. selector: "canUnderstand:",
  6532. category: 'testing',
  6533. fn: function (aSelector){
  6534. var self=this;
  6535. return smalltalk.withContext(function($ctx1) {
  6536. var $1;
  6537. $1=_st(_st(_st(self._methodDictionary())._keys())._includes_(_st(aSelector)._asString()))._or_((function(){
  6538. return smalltalk.withContext(function($ctx2) {
  6539. return _st(_st(self._superclass())._notNil())._and_((function(){
  6540. return smalltalk.withContext(function($ctx3) {
  6541. return _st(self._superclass())._canUnderstand_(aSelector);
  6542. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  6543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6544. return $1;
  6545. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},smalltalk.Behavior)})},
  6546. args: ["aSelector"],
  6547. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  6548. messageSends: ["or:", "and:", "canUnderstand:", "superclass", "notNil", "includes:", "asString", "keys", "methodDictionary"],
  6549. referencedClasses: []
  6550. }),
  6551. smalltalk.Behavior);
  6552. smalltalk.addMethod(
  6553. smalltalk.method({
  6554. selector: "comment",
  6555. category: 'accessing',
  6556. fn: function (){
  6557. var self=this;
  6558. return smalltalk.withContext(function($ctx1) {
  6559. var $2,$1;
  6560. $2=self._basicAt_("comment");
  6561. if(($receiver = $2) == nil || $receiver == undefined){
  6562. $1="";
  6563. } else {
  6564. $1=$2;
  6565. };
  6566. return $1;
  6567. }, function($ctx1) {$ctx1.fill(self,"comment",{},smalltalk.Behavior)})},
  6568. args: [],
  6569. source: "comment\x0a\x09^(self basicAt: 'comment') ifNil: ['']",
  6570. messageSends: ["ifNil:", "basicAt:"],
  6571. referencedClasses: []
  6572. }),
  6573. smalltalk.Behavior);
  6574. smalltalk.addMethod(
  6575. smalltalk.method({
  6576. selector: "comment:",
  6577. category: 'accessing',
  6578. fn: function (aString){
  6579. var self=this;
  6580. function $ClassCommentChanged(){return smalltalk.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  6581. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6582. return smalltalk.withContext(function($ctx1) {
  6583. var $1,$2;
  6584. self._basicAt_put_("comment",aString);
  6585. $1=_st($ClassCommentChanged())._new();
  6586. _st($1)._theClass_(self);
  6587. $2=_st($1)._yourself();
  6588. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6589. return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},smalltalk.Behavior)})},
  6590. args: ["aString"],
  6591. 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)",
  6592. messageSends: ["basicAt:put:", "announce:", "theClass:", "new", "yourself", "current"],
  6593. referencedClasses: ["ClassCommentChanged", "SystemAnnouncer"]
  6594. }),
  6595. smalltalk.Behavior);
  6596. smalltalk.addMethod(
  6597. smalltalk.method({
  6598. selector: "commentStamp",
  6599. category: 'accessing',
  6600. fn: function (){
  6601. var self=this;
  6602. function $ClassCommentReader(){return smalltalk.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  6603. return smalltalk.withContext(function($ctx1) {
  6604. var $2,$3,$1;
  6605. $2=_st($ClassCommentReader())._new();
  6606. _st($2)._class_(self);
  6607. $3=_st($2)._yourself();
  6608. $1=$3;
  6609. return $1;
  6610. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},smalltalk.Behavior)})},
  6611. args: [],
  6612. source: "commentStamp\x0a\x09^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  6613. messageSends: ["class:", "new", "yourself"],
  6614. referencedClasses: ["ClassCommentReader"]
  6615. }),
  6616. smalltalk.Behavior);
  6617. smalltalk.addMethod(
  6618. smalltalk.method({
  6619. selector: "commentStamp:prior:",
  6620. category: 'accessing',
  6621. fn: function (aStamp,prior){
  6622. var self=this;
  6623. return smalltalk.withContext(function($ctx1) {
  6624. var $1;
  6625. $1=self._commentStamp();
  6626. return $1;
  6627. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},smalltalk.Behavior)})},
  6628. args: ["aStamp", "prior"],
  6629. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^self commentStamp",
  6630. messageSends: ["commentStamp"],
  6631. referencedClasses: []
  6632. }),
  6633. smalltalk.Behavior);
  6634. smalltalk.addMethod(
  6635. smalltalk.method({
  6636. selector: "compile:",
  6637. category: 'compiling',
  6638. fn: function (aString){
  6639. var self=this;
  6640. return smalltalk.withContext(function($ctx1) {
  6641. var $1;
  6642. $1=self._compile_category_(aString,"");
  6643. return $1;
  6644. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Behavior)})},
  6645. args: ["aString"],
  6646. source: "compile: aString\x0a\x09^ self compile: aString category: ''",
  6647. messageSends: ["compile:category:"],
  6648. referencedClasses: []
  6649. }),
  6650. smalltalk.Behavior);
  6651. smalltalk.addMethod(
  6652. smalltalk.method({
  6653. selector: "compile:category:",
  6654. category: 'compiling',
  6655. fn: function (aString,anotherString){
  6656. var self=this;
  6657. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6658. return smalltalk.withContext(function($ctx1) {
  6659. var $1;
  6660. $1=_st(_st($Compiler())._new())._install_forClass_category_(aString,self,anotherString);
  6661. return $1;
  6662. }, function($ctx1) {$ctx1.fill(self,"compile:category:",{aString:aString,anotherString:anotherString},smalltalk.Behavior)})},
  6663. args: ["aString", "anotherString"],
  6664. source: "compile: aString category: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09category: anotherString",
  6665. messageSends: ["install:forClass:category:", "new"],
  6666. referencedClasses: ["Compiler"]
  6667. }),
  6668. smalltalk.Behavior);
  6669. smalltalk.addMethod(
  6670. smalltalk.method({
  6671. selector: "definition",
  6672. category: 'accessing',
  6673. fn: function (){
  6674. var self=this;
  6675. return smalltalk.withContext(function($ctx1) {
  6676. return "";
  6677. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Behavior)})},
  6678. args: [],
  6679. source: "definition\x0a\x09^ ''",
  6680. messageSends: [],
  6681. referencedClasses: []
  6682. }),
  6683. smalltalk.Behavior);
  6684. smalltalk.addMethod(
  6685. smalltalk.method({
  6686. selector: "includesBehavior:",
  6687. category: 'testing',
  6688. fn: function (aClass){
  6689. var self=this;
  6690. return smalltalk.withContext(function($ctx1) {
  6691. var $1;
  6692. $1=_st(self.__eq_eq(aClass))._or_((function(){
  6693. return smalltalk.withContext(function($ctx2) {
  6694. return self._inheritsFrom_(aClass);
  6695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6696. return $1;
  6697. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},smalltalk.Behavior)})},
  6698. args: ["aClass"],
  6699. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  6700. messageSends: ["or:", "inheritsFrom:", "=="],
  6701. referencedClasses: []
  6702. }),
  6703. smalltalk.Behavior);
  6704. smalltalk.addMethod(
  6705. smalltalk.method({
  6706. selector: "includesSelector:",
  6707. category: 'testing',
  6708. fn: function (aString){
  6709. var self=this;
  6710. return smalltalk.withContext(function($ctx1) {
  6711. var $1;
  6712. $1=_st(self._methodDictionary())._includesKey_(aString);
  6713. return $1;
  6714. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},smalltalk.Behavior)})},
  6715. args: ["aString"],
  6716. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  6717. messageSends: ["includesKey:", "methodDictionary"],
  6718. referencedClasses: []
  6719. }),
  6720. smalltalk.Behavior);
  6721. smalltalk.addMethod(
  6722. smalltalk.method({
  6723. selector: "inheritsFrom:",
  6724. category: 'testing',
  6725. fn: function (aClass){
  6726. var self=this;
  6727. return smalltalk.withContext(function($ctx1) {
  6728. var $1,$2;
  6729. $1=self._superclass();
  6730. if(($receiver = $1) == nil || $receiver == undefined){
  6731. return false;
  6732. } else {
  6733. $1;
  6734. };
  6735. $2=_st(_st(aClass).__eq_eq(self._superclass()))._or_((function(){
  6736. return smalltalk.withContext(function($ctx2) {
  6737. return _st(self._superclass())._inheritsFrom_(aClass);
  6738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6739. return $2;
  6740. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},smalltalk.Behavior)})},
  6741. args: ["aClass"],
  6742. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  6743. messageSends: ["ifNil:", "superclass", "or:", "inheritsFrom:", "=="],
  6744. referencedClasses: []
  6745. }),
  6746. smalltalk.Behavior);
  6747. smalltalk.addMethod(
  6748. smalltalk.method({
  6749. selector: "instanceVariableNames",
  6750. category: 'accessing',
  6751. fn: function (){
  6752. var self=this;
  6753. return smalltalk.withContext(function($ctx1) {
  6754. return self.iVarNames;
  6755. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},smalltalk.Behavior)})},
  6756. args: [],
  6757. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  6758. messageSends: [],
  6759. referencedClasses: []
  6760. }),
  6761. smalltalk.Behavior);
  6762. smalltalk.addMethod(
  6763. smalltalk.method({
  6764. selector: "isBehavior",
  6765. category: 'testing',
  6766. fn: function (){
  6767. var self=this;
  6768. return smalltalk.withContext(function($ctx1) {
  6769. return true;
  6770. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Behavior)})},
  6771. args: [],
  6772. source: "isBehavior\x0a\x09^ true",
  6773. messageSends: [],
  6774. referencedClasses: []
  6775. }),
  6776. smalltalk.Behavior);
  6777. smalltalk.addMethod(
  6778. smalltalk.method({
  6779. selector: "lookupSelector:",
  6780. category: 'accessing',
  6781. fn: function (selector){
  6782. var self=this;
  6783. var lookupClass;
  6784. return smalltalk.withContext(function($ctx1) {
  6785. var $1,$2;
  6786. var $early={};
  6787. try {
  6788. lookupClass=self;
  6789. _st((function(){
  6790. return smalltalk.withContext(function($ctx2) {
  6791. return _st(lookupClass).__eq(nil);
  6792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  6793. return smalltalk.withContext(function($ctx2) {
  6794. $1=_st(lookupClass)._includesSelector_(selector);
  6795. if(smalltalk.assert($1)){
  6796. $2=_st(lookupClass)._methodAt_(selector);
  6797. throw $early=[$2];
  6798. };
  6799. lookupClass=_st(lookupClass)._superclass();
  6800. return lookupClass;
  6801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6802. return nil;
  6803. }
  6804. catch(e) {if(e===$early)return e[0]; throw e}
  6805. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},smalltalk.Behavior)})},
  6806. args: ["selector"],
  6807. 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",
  6808. messageSends: ["whileFalse:", "ifTrue:", "methodAt:", "includesSelector:", "superclass", "="],
  6809. referencedClasses: []
  6810. }),
  6811. smalltalk.Behavior);
  6812. smalltalk.addMethod(
  6813. smalltalk.method({
  6814. selector: "methodAt:",
  6815. category: 'accessing',
  6816. fn: function (aString){
  6817. var self=this;
  6818. return smalltalk.withContext(function($ctx1) {
  6819. var $1;
  6820. $1=_st(self._methodDictionary())._at_(aString);
  6821. return $1;
  6822. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},smalltalk.Behavior)})},
  6823. args: ["aString"],
  6824. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  6825. messageSends: ["at:", "methodDictionary"],
  6826. referencedClasses: []
  6827. }),
  6828. smalltalk.Behavior);
  6829. smalltalk.addMethod(
  6830. smalltalk.method({
  6831. selector: "methodDictionary",
  6832. category: 'accessing',
  6833. fn: function (){
  6834. var self=this;
  6835. return smalltalk.withContext(function($ctx1) {
  6836. var dict = smalltalk.HashedCollection._new();
  6837. var methods = self.methods;
  6838. for(var i in methods) {
  6839. if(methods[i].selector) {
  6840. dict._at_put_(methods[i].selector, methods[i]);
  6841. }
  6842. };
  6843. return dict;
  6844. return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},smalltalk.Behavior)})},
  6845. args: [],
  6846. 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>",
  6847. messageSends: [],
  6848. referencedClasses: []
  6849. }),
  6850. smalltalk.Behavior);
  6851. smalltalk.addMethod(
  6852. smalltalk.method({
  6853. selector: "methods",
  6854. category: 'accessing',
  6855. fn: function (){
  6856. var self=this;
  6857. return smalltalk.withContext(function($ctx1) {
  6858. var $1;
  6859. $1=_st(self._methodDictionary())._values();
  6860. return $1;
  6861. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.Behavior)})},
  6862. args: [],
  6863. source: "methods\x0a\x09^ self methodDictionary values",
  6864. messageSends: ["values", "methodDictionary"],
  6865. referencedClasses: []
  6866. }),
  6867. smalltalk.Behavior);
  6868. smalltalk.addMethod(
  6869. smalltalk.method({
  6870. selector: "methodsFor:",
  6871. category: 'accessing',
  6872. fn: function (aString){
  6873. var self=this;
  6874. function $ClassCategoryReader(){return smalltalk.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
  6875. return smalltalk.withContext(function($ctx1) {
  6876. var $2,$3,$1;
  6877. $2=_st($ClassCategoryReader())._new();
  6878. _st($2)._class_category_(self,aString);
  6879. $3=_st($2)._yourself();
  6880. $1=$3;
  6881. return $1;
  6882. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},smalltalk.Behavior)})},
  6883. args: ["aString"],
  6884. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  6885. messageSends: ["class:category:", "new", "yourself"],
  6886. referencedClasses: ["ClassCategoryReader"]
  6887. }),
  6888. smalltalk.Behavior);
  6889. smalltalk.addMethod(
  6890. smalltalk.method({
  6891. selector: "methodsFor:stamp:",
  6892. category: 'accessing',
  6893. fn: function (aString,aStamp){
  6894. var self=this;
  6895. return smalltalk.withContext(function($ctx1) {
  6896. var $1;
  6897. $1=self._methodsFor_(aString);
  6898. return $1;
  6899. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},smalltalk.Behavior)})},
  6900. args: ["aString", "aStamp"],
  6901. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  6902. messageSends: ["methodsFor:"],
  6903. referencedClasses: []
  6904. }),
  6905. smalltalk.Behavior);
  6906. smalltalk.addMethod(
  6907. smalltalk.method({
  6908. selector: "methodsInProtocol:",
  6909. category: 'accessing',
  6910. fn: function (aString){
  6911. var self=this;
  6912. return smalltalk.withContext(function($ctx1) {
  6913. var $1;
  6914. $1=_st(_st(self._methodDictionary())._values())._select_((function(each){
  6915. return smalltalk.withContext(function($ctx2) {
  6916. return _st(_st(each)._protocol()).__eq(aString);
  6917. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6918. return $1;
  6919. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},smalltalk.Behavior)})},
  6920. args: ["aString"],
  6921. source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
  6922. messageSends: ["select:", "=", "protocol", "values", "methodDictionary"],
  6923. referencedClasses: []
  6924. }),
  6925. smalltalk.Behavior);
  6926. smalltalk.addMethod(
  6927. smalltalk.method({
  6928. selector: "name",
  6929. category: 'accessing',
  6930. fn: function (){
  6931. var self=this;
  6932. return smalltalk.withContext(function($ctx1) {
  6933. return self.className || nil;
  6934. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Behavior)})},
  6935. args: [],
  6936. source: "name\x0a\x09<return self.className || nil>",
  6937. messageSends: [],
  6938. referencedClasses: []
  6939. }),
  6940. smalltalk.Behavior);
  6941. smalltalk.addMethod(
  6942. smalltalk.method({
  6943. selector: "new",
  6944. category: 'instance creation',
  6945. fn: function (){
  6946. var self=this;
  6947. return smalltalk.withContext(function($ctx1) {
  6948. var $1;
  6949. $1=_st(self._basicNew())._initialize();
  6950. return $1;
  6951. }, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Behavior)})},
  6952. args: [],
  6953. source: "new\x0a\x09^self basicNew initialize",
  6954. messageSends: ["initialize", "basicNew"],
  6955. referencedClasses: []
  6956. }),
  6957. smalltalk.Behavior);
  6958. smalltalk.addMethod(
  6959. smalltalk.method({
  6960. selector: "organization",
  6961. category: 'accessing',
  6962. fn: function (){
  6963. var self=this;
  6964. return smalltalk.withContext(function($ctx1) {
  6965. var $1;
  6966. $1=self._basicAt_("organization");
  6967. return $1;
  6968. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Behavior)})},
  6969. args: [],
  6970. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6971. messageSends: ["basicAt:"],
  6972. referencedClasses: []
  6973. }),
  6974. smalltalk.Behavior);
  6975. smalltalk.addMethod(
  6976. smalltalk.method({
  6977. selector: "protocols",
  6978. category: 'accessing',
  6979. fn: function (){
  6980. var self=this;
  6981. return smalltalk.withContext(function($ctx1) {
  6982. var $1;
  6983. $1=_st(_st(self._organization())._elements())._sorted();
  6984. return $1;
  6985. }, function($ctx1) {$ctx1.fill(self,"protocols",{},smalltalk.Behavior)})},
  6986. args: [],
  6987. source: "protocols\x0a\x09^ self organization elements sorted",
  6988. messageSends: ["sorted", "elements", "organization"],
  6989. referencedClasses: []
  6990. }),
  6991. smalltalk.Behavior);
  6992. smalltalk.addMethod(
  6993. smalltalk.method({
  6994. selector: "protocolsDo:",
  6995. category: 'enumerating',
  6996. fn: function (aBlock){
  6997. var self=this;
  6998. var methodsByCategory;
  6999. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  7000. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  7001. return smalltalk.withContext(function($ctx1) {
  7002. methodsByCategory=_st($HashedCollection())._new();
  7003. _st(_st(self._methodDictionary())._values())._do_((function(m){
  7004. return smalltalk.withContext(function($ctx2) {
  7005. return _st(_st(methodsByCategory)._at_ifAbsentPut_(_st(m)._category(),(function(){
  7006. return smalltalk.withContext(function($ctx3) {
  7007. return _st($Array())._new();
  7008. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})})))._add_(m);
  7009. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1)})}));
  7010. _st(self._protocols())._do_((function(category){
  7011. return smalltalk.withContext(function($ctx2) {
  7012. return _st(aBlock)._value_value_(category,_st(methodsByCategory)._at_(category));
  7013. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  7014. return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByCategory:methodsByCategory},smalltalk.Behavior)})},
  7015. args: ["aBlock"],
  7016. 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)]",
  7017. messageSends: ["new", "do:", "add:", "at:ifAbsentPut:", "category", "values", "methodDictionary", "value:value:", "at:", "protocols"],
  7018. referencedClasses: ["HashedCollection", "Array"]
  7019. }),
  7020. smalltalk.Behavior);
  7021. smalltalk.addMethod(
  7022. smalltalk.method({
  7023. selector: "prototype",
  7024. category: 'accessing',
  7025. fn: function (){
  7026. var self=this;
  7027. return smalltalk.withContext(function($ctx1) {
  7028. return self.fn.prototype;
  7029. return self}, function($ctx1) {$ctx1.fill(self,"prototype",{},smalltalk.Behavior)})},
  7030. args: [],
  7031. source: "prototype\x0a\x09<return self.fn.prototype>",
  7032. messageSends: [],
  7033. referencedClasses: []
  7034. }),
  7035. smalltalk.Behavior);
  7036. smalltalk.addMethod(
  7037. smalltalk.method({
  7038. selector: "removeCompiledMethod:",
  7039. category: 'compiling',
  7040. fn: function (aMethod){
  7041. var self=this;
  7042. function $MethodRemoved(){return smalltalk.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  7043. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7044. return smalltalk.withContext(function($ctx1) {
  7045. var $1,$2;
  7046. self._basicRemoveCompiledMethod_(aMethod);
  7047. _st(self._methods())._detect_ifNone_((function(each){
  7048. return smalltalk.withContext(function($ctx2) {
  7049. return _st(_st(each)._protocol()).__eq(_st(aMethod)._protocol());
  7050. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  7051. return smalltalk.withContext(function($ctx2) {
  7052. return _st(self._organization())._removeElement_(_st(aMethod)._protocol());
  7053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  7054. $1=_st($MethodRemoved())._new();
  7055. _st($1)._method_(aMethod);
  7056. $2=_st($1)._yourself();
  7057. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7058. return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  7059. args: ["aMethod"],
  7060. 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)",
  7061. messageSends: ["basicRemoveCompiledMethod:", "detect:ifNone:", "=", "protocol", "removeElement:", "organization", "methods", "announce:", "method:", "new", "yourself", "current"],
  7062. referencedClasses: ["MethodRemoved", "SystemAnnouncer"]
  7063. }),
  7064. smalltalk.Behavior);
  7065. smalltalk.addMethod(
  7066. smalltalk.method({
  7067. selector: "selectors",
  7068. category: 'accessing',
  7069. fn: function (){
  7070. var self=this;
  7071. return smalltalk.withContext(function($ctx1) {
  7072. var $1;
  7073. $1=_st(self._methodDictionary())._keys();
  7074. return $1;
  7075. }, function($ctx1) {$ctx1.fill(self,"selectors",{},smalltalk.Behavior)})},
  7076. args: [],
  7077. source: "selectors\x0a\x09^ self methodDictionary keys",
  7078. messageSends: ["keys", "methodDictionary"],
  7079. referencedClasses: []
  7080. }),
  7081. smalltalk.Behavior);
  7082. smalltalk.addMethod(
  7083. smalltalk.method({
  7084. selector: "subclasses",
  7085. category: 'accessing',
  7086. fn: function (){
  7087. var self=this;
  7088. return smalltalk.withContext(function($ctx1) {
  7089. return smalltalk.subclasses(self);
  7090. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Behavior)})},
  7091. args: [],
  7092. source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
  7093. messageSends: [],
  7094. referencedClasses: []
  7095. }),
  7096. smalltalk.Behavior);
  7097. smalltalk.addMethod(
  7098. smalltalk.method({
  7099. selector: "superclass",
  7100. category: 'accessing',
  7101. fn: function (){
  7102. var self=this;
  7103. return smalltalk.withContext(function($ctx1) {
  7104. return self.superclass || nil;
  7105. return self}, function($ctx1) {$ctx1.fill(self,"superclass",{},smalltalk.Behavior)})},
  7106. args: [],
  7107. source: "superclass\x0a\x09<return self.superclass || nil>",
  7108. messageSends: [],
  7109. referencedClasses: []
  7110. }),
  7111. smalltalk.Behavior);
  7112. smalltalk.addMethod(
  7113. smalltalk.method({
  7114. selector: "theMetaClass",
  7115. category: 'accessing',
  7116. fn: function (){
  7117. var self=this;
  7118. return smalltalk.withContext(function($ctx1) {
  7119. var $1;
  7120. $1=self._class();
  7121. return $1;
  7122. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Behavior)})},
  7123. args: [],
  7124. source: "theMetaClass\x0a\x09^ self class",
  7125. messageSends: ["class"],
  7126. referencedClasses: []
  7127. }),
  7128. smalltalk.Behavior);
  7129. smalltalk.addMethod(
  7130. smalltalk.method({
  7131. selector: "theNonMetaClass",
  7132. category: 'accessing',
  7133. fn: function (){
  7134. var self=this;
  7135. return smalltalk.withContext(function($ctx1) {
  7136. var $1;
  7137. $1=self;
  7138. return $1;
  7139. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Behavior)})},
  7140. args: [],
  7141. source: "theNonMetaClass\x0a\x09^ self",
  7142. messageSends: [],
  7143. referencedClasses: []
  7144. }),
  7145. smalltalk.Behavior);
  7146. smalltalk.addMethod(
  7147. smalltalk.method({
  7148. selector: "withAllSubclasses",
  7149. category: 'accessing',
  7150. fn: function (){
  7151. var self=this;
  7152. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  7153. return smalltalk.withContext(function($ctx1) {
  7154. var $2,$3,$1;
  7155. $2=_st($Array())._with_(self);
  7156. _st($2)._addAll_(self._allSubclasses());
  7157. $3=_st($2)._yourself();
  7158. $1=$3;
  7159. return $1;
  7160. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},smalltalk.Behavior)})},
  7161. args: [],
  7162. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  7163. messageSends: ["addAll:", "allSubclasses", "with:", "yourself"],
  7164. referencedClasses: ["Array"]
  7165. }),
  7166. smalltalk.Behavior);
  7167. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  7168. 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.";
  7169. smalltalk.addMethod(
  7170. smalltalk.method({
  7171. selector: "asJavascript",
  7172. category: 'converting',
  7173. fn: function (){
  7174. var self=this;
  7175. return smalltalk.withContext(function($ctx1) {
  7176. var $1;
  7177. $1="smalltalk.".__comma(self._name());
  7178. return $1;
  7179. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Class)})},
  7180. args: [],
  7181. source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
  7182. messageSends: [",", "name"],
  7183. referencedClasses: []
  7184. }),
  7185. smalltalk.Class);
  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._package();
  7195. if(($receiver = $2) == nil || $receiver == undefined){
  7196. $1="Unclassified";
  7197. } else {
  7198. $1=_st(self._package())._name();
  7199. };
  7200. return $1;
  7201. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.Class)})},
  7202. args: [],
  7203. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  7204. messageSends: ["ifNil:ifNotNil:", "name", "package"],
  7205. referencedClasses: []
  7206. }),
  7207. smalltalk.Class);
  7208. smalltalk.addMethod(
  7209. smalltalk.method({
  7210. selector: "definition",
  7211. category: 'accessing',
  7212. fn: function (){
  7213. var self=this;
  7214. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  7215. return smalltalk.withContext(function($ctx1) {
  7216. var $2,$3,$4,$5,$1;
  7217. $1=_st($String())._streamContents_((function(stream){
  7218. return smalltalk.withContext(function($ctx2) {
  7219. $2=stream;
  7220. _st($2)._nextPutAll_(_st(self._superclass())._asString());
  7221. _st($2)._nextPutAll_(" subclass: #");
  7222. _st($2)._nextPutAll_(self._name());
  7223. _st($2)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
  7224. $3=_st($2)._nextPutAll_("instanceVariableNames: '");
  7225. $3;
  7226. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  7227. return smalltalk.withContext(function($ctx3) {
  7228. return _st(stream)._nextPutAll_(each);
  7229. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}),(function(){
  7230. return smalltalk.withContext(function($ctx3) {
  7231. return _st(stream)._nextPutAll_(" ");
  7232. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  7233. $4=stream;
  7234. _st($4)._nextPutAll_(_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab()));
  7235. _st($4)._nextPutAll_("package: '");
  7236. _st($4)._nextPutAll_(self._category());
  7237. $5=_st($4)._nextPutAll_("'");
  7238. return $5;
  7239. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  7240. return $1;
  7241. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Class)})},
  7242. args: [],
  7243. 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: '''' ]",
  7244. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "tab", "lf", "do:separatedBy:", "instanceVariableNames", "category"],
  7245. referencedClasses: ["String"]
  7246. }),
  7247. smalltalk.Class);
  7248. smalltalk.addMethod(
  7249. smalltalk.method({
  7250. selector: "isClass",
  7251. category: 'testing',
  7252. fn: function (){
  7253. var self=this;
  7254. return smalltalk.withContext(function($ctx1) {
  7255. return true;
  7256. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Class)})},
  7257. args: [],
  7258. source: "isClass\x0a\x09^true",
  7259. messageSends: [],
  7260. referencedClasses: []
  7261. }),
  7262. smalltalk.Class);
  7263. smalltalk.addMethod(
  7264. smalltalk.method({
  7265. selector: "package",
  7266. category: 'accessing',
  7267. fn: function (){
  7268. var self=this;
  7269. return smalltalk.withContext(function($ctx1) {
  7270. var $1;
  7271. $1=self._basicAt_("pkg");
  7272. return $1;
  7273. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.Class)})},
  7274. args: [],
  7275. source: "package\x0a\x09^ self basicAt: 'pkg'",
  7276. messageSends: ["basicAt:"],
  7277. referencedClasses: []
  7278. }),
  7279. smalltalk.Class);
  7280. smalltalk.addMethod(
  7281. smalltalk.method({
  7282. selector: "package:",
  7283. category: 'accessing',
  7284. fn: function (aPackage){
  7285. var self=this;
  7286. var oldPackage;
  7287. function $ClassMoved(){return smalltalk.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  7288. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7289. return smalltalk.withContext(function($ctx1) {
  7290. var $1,$2,$3,$4;
  7291. $1=_st(self._package()).__eq(aPackage);
  7292. if(smalltalk.assert($1)){
  7293. $2=self;
  7294. return $2;
  7295. };
  7296. oldPackage=self._package();
  7297. self._basicAt_put_("pkg",aPackage);
  7298. _st(_st(oldPackage)._organization())._removeElement_(self);
  7299. _st(_st(aPackage)._organization())._addElement_(self);
  7300. $3=_st($ClassMoved())._new();
  7301. _st($3)._theClass_(self);
  7302. _st($3)._oldPackage_(oldPackage);
  7303. $4=_st($3)._yourself();
  7304. _st(_st($SystemAnnouncer())._current())._announce_($4);
  7305. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},smalltalk.Class)})},
  7306. args: ["aPackage"],
  7307. 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)",
  7308. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "theClass:", "new", "oldPackage:", "yourself", "current"],
  7309. referencedClasses: ["ClassMoved", "SystemAnnouncer"]
  7310. }),
  7311. smalltalk.Class);
  7312. smalltalk.addMethod(
  7313. smalltalk.method({
  7314. selector: "printOn:",
  7315. category: 'printing',
  7316. fn: function (aStream){
  7317. var self=this;
  7318. return smalltalk.withContext(function($ctx1) {
  7319. _st(aStream)._nextPutAll_(self._name());
  7320. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Class)})},
  7321. args: ["aStream"],
  7322. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  7323. messageSends: ["nextPutAll:", "name"],
  7324. referencedClasses: []
  7325. }),
  7326. smalltalk.Class);
  7327. smalltalk.addMethod(
  7328. smalltalk.method({
  7329. selector: "rename:",
  7330. category: 'accessing',
  7331. fn: function (aString){
  7332. var self=this;
  7333. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  7334. return smalltalk.withContext(function($ctx1) {
  7335. _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
  7336. return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},smalltalk.Class)})},
  7337. args: ["aString"],
  7338. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  7339. messageSends: ["renameClass:to:", "new"],
  7340. referencedClasses: ["ClassBuilder"]
  7341. }),
  7342. smalltalk.Class);
  7343. smalltalk.addMethod(
  7344. smalltalk.method({
  7345. selector: "subclass:instanceVariableNames:",
  7346. category: 'class creation',
  7347. fn: function (aString,anotherString){
  7348. var self=this;
  7349. return smalltalk.withContext(function($ctx1) {
  7350. var $1;
  7351. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  7352. return $1;
  7353. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.Class)})},
  7354. args: ["aString", "anotherString"],
  7355. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  7356. messageSends: ["subclass:instanceVariableNames:package:"],
  7357. referencedClasses: []
  7358. }),
  7359. smalltalk.Class);
  7360. smalltalk.addMethod(
  7361. smalltalk.method({
  7362. selector: "subclass:instanceVariableNames:category:",
  7363. category: 'class creation',
  7364. fn: function (aString,aString2,aString3){
  7365. var self=this;
  7366. return smalltalk.withContext(function($ctx1) {
  7367. var $1;
  7368. self._deprecatedAPI();
  7369. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7370. return $1;
  7371. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
  7372. args: ["aString", "aString2", "aString3"],
  7373. 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",
  7374. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  7375. referencedClasses: []
  7376. }),
  7377. smalltalk.Class);
  7378. smalltalk.addMethod(
  7379. smalltalk.method({
  7380. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  7381. category: 'class creation',
  7382. fn: function (aString,aString2,classVars,pools,aString3){
  7383. var self=this;
  7384. return smalltalk.withContext(function($ctx1) {
  7385. var $1;
  7386. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7387. return $1;
  7388. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},smalltalk.Class)})},
  7389. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  7390. 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",
  7391. messageSends: ["subclass:instanceVariableNames:package:"],
  7392. referencedClasses: []
  7393. }),
  7394. smalltalk.Class);
  7395. smalltalk.addMethod(
  7396. smalltalk.method({
  7397. selector: "subclass:instanceVariableNames:package:",
  7398. category: 'class creation',
  7399. fn: function (aString,aString2,aString3){
  7400. var self=this;
  7401. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  7402. return smalltalk.withContext(function($ctx1) {
  7403. var $1;
  7404. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  7405. return $1;
  7406. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
  7407. args: ["aString", "aString2", "aString3"],
  7408. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  7409. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  7410. referencedClasses: ["ClassBuilder"]
  7411. }),
  7412. smalltalk.Class);
  7413. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  7414. 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.";
  7415. smalltalk.addMethod(
  7416. smalltalk.method({
  7417. selector: "asJavascript",
  7418. category: 'converting',
  7419. fn: function (){
  7420. var self=this;
  7421. return smalltalk.withContext(function($ctx1) {
  7422. var $1;
  7423. $1=_st("smalltalk.".__comma(_st(self._instanceClass())._name())).__comma(".klass");
  7424. return $1;
  7425. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Metaclass)})},
  7426. args: [],
  7427. source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
  7428. messageSends: [",", "name", "instanceClass"],
  7429. referencedClasses: []
  7430. }),
  7431. smalltalk.Metaclass);
  7432. smalltalk.addMethod(
  7433. smalltalk.method({
  7434. selector: "definition",
  7435. category: 'accessing',
  7436. fn: function (){
  7437. var self=this;
  7438. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  7439. return smalltalk.withContext(function($ctx1) {
  7440. var $2,$3,$1;
  7441. $1=_st($String())._streamContents_((function(stream){
  7442. return smalltalk.withContext(function($ctx2) {
  7443. $2=stream;
  7444. _st($2)._nextPutAll_(self._asString());
  7445. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  7446. $3;
  7447. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  7448. return smalltalk.withContext(function($ctx3) {
  7449. return _st(stream)._nextPutAll_(each);
  7450. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}),(function(){
  7451. return smalltalk.withContext(function($ctx3) {
  7452. return _st(stream)._nextPutAll_(" ");
  7453. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  7454. return _st(stream)._nextPutAll_("'");
  7455. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  7456. return $1;
  7457. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Metaclass)})},
  7458. args: [],
  7459. 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: '''' ]",
  7460. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  7461. referencedClasses: ["String"]
  7462. }),
  7463. smalltalk.Metaclass);
  7464. smalltalk.addMethod(
  7465. smalltalk.method({
  7466. selector: "instanceClass",
  7467. category: 'accessing',
  7468. fn: function (){
  7469. var self=this;
  7470. return smalltalk.withContext(function($ctx1) {
  7471. return self.instanceClass;
  7472. return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{},smalltalk.Metaclass)})},
  7473. args: [],
  7474. source: "instanceClass\x0a\x09<return self.instanceClass>",
  7475. messageSends: [],
  7476. referencedClasses: []
  7477. }),
  7478. smalltalk.Metaclass);
  7479. smalltalk.addMethod(
  7480. smalltalk.method({
  7481. selector: "instanceVariableNames:",
  7482. category: 'accessing',
  7483. fn: function (aCollection){
  7484. var self=this;
  7485. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  7486. return smalltalk.withContext(function($ctx1) {
  7487. _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  7488. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},smalltalk.Metaclass)})},
  7489. args: ["aCollection"],
  7490. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  7491. messageSends: ["class:instanceVariableNames:", "new"],
  7492. referencedClasses: ["ClassBuilder"]
  7493. }),
  7494. smalltalk.Metaclass);
  7495. smalltalk.addMethod(
  7496. smalltalk.method({
  7497. selector: "isMetaclass",
  7498. category: 'testing',
  7499. fn: function (){
  7500. var self=this;
  7501. return smalltalk.withContext(function($ctx1) {
  7502. return true;
  7503. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Metaclass)})},
  7504. args: [],
  7505. source: "isMetaclass\x0a\x09^true",
  7506. messageSends: [],
  7507. referencedClasses: []
  7508. }),
  7509. smalltalk.Metaclass);
  7510. smalltalk.addMethod(
  7511. smalltalk.method({
  7512. selector: "printOn:",
  7513. category: 'printing',
  7514. fn: function (aStream){
  7515. var self=this;
  7516. return smalltalk.withContext(function($ctx1) {
  7517. var $1,$2;
  7518. $1=aStream;
  7519. _st($1)._nextPutAll_(_st(self._instanceClass())._name());
  7520. $2=_st($1)._nextPutAll_(" class");
  7521. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Metaclass)})},
  7522. args: ["aStream"],
  7523. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  7524. messageSends: ["nextPutAll:", "name", "instanceClass"],
  7525. referencedClasses: []
  7526. }),
  7527. smalltalk.Metaclass);
  7528. smalltalk.addMethod(
  7529. smalltalk.method({
  7530. selector: "theMetaClass",
  7531. category: 'accessing',
  7532. fn: function (){
  7533. var self=this;
  7534. return smalltalk.withContext(function($ctx1) {
  7535. var $1;
  7536. $1=self;
  7537. return $1;
  7538. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Metaclass)})},
  7539. args: [],
  7540. source: "theMetaClass\x0a\x09^ self",
  7541. messageSends: [],
  7542. referencedClasses: []
  7543. }),
  7544. smalltalk.Metaclass);
  7545. smalltalk.addMethod(
  7546. smalltalk.method({
  7547. selector: "theNonMetaClass",
  7548. category: 'accessing',
  7549. fn: function (){
  7550. var self=this;
  7551. return smalltalk.withContext(function($ctx1) {
  7552. var $1;
  7553. $1=self._instanceClass();
  7554. return $1;
  7555. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Metaclass)})},
  7556. args: [],
  7557. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  7558. messageSends: ["instanceClass"],
  7559. referencedClasses: []
  7560. }),
  7561. smalltalk.Metaclass);
  7562. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  7563. 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:`.";
  7564. smalltalk.addMethod(
  7565. smalltalk.method({
  7566. selector: "addSubclassOf:named:instanceVariableNames:package:",
  7567. category: 'class definition',
  7568. fn: function (aClass,className,aCollection,packageName){
  7569. var self=this;
  7570. var theClass;
  7571. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7572. return smalltalk.withContext(function($ctx1) {
  7573. var $1,$2,$3,$4;
  7574. theClass=_st(_st($Smalltalk())._current())._at_(className);
  7575. $1=theClass;
  7576. if(($receiver = $1) == nil || $receiver == undefined){
  7577. $1;
  7578. } else {
  7579. _st(theClass)._package_(self._createPackageNamed_(packageName));
  7580. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  7581. if(! smalltalk.assert($2)){
  7582. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  7583. return $3;
  7584. };
  7585. };
  7586. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  7587. return $4;
  7588. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass},smalltalk.ClassBuilder)})},
  7589. args: ["aClass", "className", "aCollection", "packageName"],
  7590. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass |\x0a\x09\x0a\x09theClass := Smalltalk current at: className.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: (self createPackageNamed: packageName).\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09\x09^ self\x0a\x09\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09\x09named: className\x0a\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09package: packageName",
  7591. messageSends: ["at:", "current", "ifNotNil:", "package:", "createPackageNamed:", "ifFalse:", "migrateClassNamed:superclass:instanceVariableNames:package:", "==", "superclass", "basicAddSubclassOf:named:instanceVariableNames:package:"],
  7592. referencedClasses: ["Smalltalk"]
  7593. }),
  7594. smalltalk.ClassBuilder);
  7595. smalltalk.addMethod(
  7596. smalltalk.method({
  7597. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7598. category: 'private',
  7599. fn: function (aClass,aString,aCollection,packageName){
  7600. var self=this;
  7601. return smalltalk.withContext(function($ctx1) {
  7602. smalltalk.addClass(aString, aClass, aCollection, packageName);
  7603. return smalltalk[aString]
  7604. ;
  7605. return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},smalltalk.ClassBuilder)})},
  7606. args: ["aClass", "aString", "aCollection", "packageName"],
  7607. 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>",
  7608. messageSends: [],
  7609. referencedClasses: []
  7610. }),
  7611. smalltalk.ClassBuilder);
  7612. smalltalk.addMethod(
  7613. smalltalk.method({
  7614. selector: "basicClass:instanceVariableNames:",
  7615. category: 'private',
  7616. fn: function (aClass,aString){
  7617. var self=this;
  7618. return smalltalk.withContext(function($ctx1) {
  7619. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7620. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7621. args: ["aClass", "aString"],
  7622. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7623. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
  7624. referencedClasses: []
  7625. }),
  7626. smalltalk.ClassBuilder);
  7627. smalltalk.addMethod(
  7628. smalltalk.method({
  7629. selector: "basicClass:instanceVariables:",
  7630. category: 'private',
  7631. fn: function (aClass,aCollection){
  7632. var self=this;
  7633. return smalltalk.withContext(function($ctx1) {
  7634. var $1;
  7635. $1=_st(aClass)._isMetaclass();
  7636. if(! smalltalk.assert($1)){
  7637. self._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  7638. };
  7639. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  7640. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},smalltalk.ClassBuilder)})},
  7641. args: ["aClass", "aCollection"],
  7642. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7643. messageSends: ["ifFalse:", "error:", ",", "name", "isMetaclass", "basicAt:put:"],
  7644. referencedClasses: []
  7645. }),
  7646. smalltalk.ClassBuilder);
  7647. smalltalk.addMethod(
  7648. smalltalk.method({
  7649. selector: "basicRemoveClass:",
  7650. category: 'private',
  7651. fn: function (aClass){
  7652. var self=this;
  7653. return smalltalk.withContext(function($ctx1) {
  7654. smalltalk.removeClass(aClass);
  7655. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
  7656. args: ["aClass"],
  7657. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  7658. messageSends: [],
  7659. referencedClasses: []
  7660. }),
  7661. smalltalk.ClassBuilder);
  7662. smalltalk.addMethod(
  7663. smalltalk.method({
  7664. selector: "basicRenameClass:to:",
  7665. category: 'private',
  7666. fn: function (aClass,aString){
  7667. var self=this;
  7668. return smalltalk.withContext(function($ctx1) {
  7669. smalltalk[aString] = aClass;
  7670. delete smalltalk[aClass.className];
  7671. aClass.className = aString;
  7672. ;
  7673. return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7674. args: ["aClass", "aString"],
  7675. 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>",
  7676. messageSends: [],
  7677. referencedClasses: []
  7678. }),
  7679. smalltalk.ClassBuilder);
  7680. smalltalk.addMethod(
  7681. smalltalk.method({
  7682. selector: "basicSwapClassNames:with:",
  7683. category: 'private',
  7684. fn: function (aClass,anotherClass){
  7685. var self=this;
  7686. return smalltalk.withContext(function($ctx1) {
  7687. var tmp = aClass.className;
  7688. aClass.className = anotherClass.className;
  7689. anotherClass.className = tmp;
  7690. ;
  7691. return self}, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  7692. args: ["aClass", "anotherClass"],
  7693. 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>",
  7694. messageSends: [],
  7695. referencedClasses: []
  7696. }),
  7697. smalltalk.ClassBuilder);
  7698. smalltalk.addMethod(
  7699. smalltalk.method({
  7700. selector: "class:instanceVariableNames:",
  7701. category: 'class definition',
  7702. fn: function (aClass,ivarNames){
  7703. var self=this;
  7704. function $ClassDefinitionChanged(){return smalltalk.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  7705. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7706. return smalltalk.withContext(function($ctx1) {
  7707. var $1,$2;
  7708. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7709. self._setupClass_(aClass);
  7710. $1=_st($ClassDefinitionChanged())._new();
  7711. _st($1)._theClass_(aClass);
  7712. $2=_st($1)._yourself();
  7713. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7714. return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},smalltalk.ClassBuilder)})},
  7715. args: ["aClass", "ivarNames"],
  7716. 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)",
  7717. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  7718. referencedClasses: ["ClassDefinitionChanged", "SystemAnnouncer"]
  7719. }),
  7720. smalltalk.ClassBuilder);
  7721. smalltalk.addMethod(
  7722. smalltalk.method({
  7723. selector: "copyClass:named:",
  7724. category: 'copying',
  7725. fn: function (aClass,className){
  7726. var self=this;
  7727. var newClass;
  7728. function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7729. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7730. return smalltalk.withContext(function($ctx1) {
  7731. var $1,$2,$3;
  7732. newClass=self._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),className,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  7733. self._copyClass_to_(aClass,newClass);
  7734. $1=_st($ClassAdded())._new();
  7735. _st($1)._theClass_(newClass);
  7736. $2=_st($1)._yourself();
  7737. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7738. $3=newClass;
  7739. return $3;
  7740. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},smalltalk.ClassBuilder)})},
  7741. args: ["aClass", "className"],
  7742. 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",
  7743. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "theClass:", "new", "yourself", "current"],
  7744. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  7745. }),
  7746. smalltalk.ClassBuilder);
  7747. smalltalk.addMethod(
  7748. smalltalk.method({
  7749. selector: "copyClass:to:",
  7750. category: 'copying',
  7751. fn: function (aClass,anotherClass){
  7752. var self=this;
  7753. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7754. return smalltalk.withContext(function($ctx1) {
  7755. _st(anotherClass)._comment_(_st(aClass)._comment());
  7756. _st(_st(_st(aClass)._methodDictionary())._values())._do_((function(each){
  7757. return smalltalk.withContext(function($ctx2) {
  7758. return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),anotherClass,_st(each)._category());
  7759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7760. self._basicClass_instanceVariables_(_st(anotherClass)._class(),_st(_st(aClass)._class())._instanceVariableNames());
  7761. _st(_st(_st(_st(aClass)._class())._methodDictionary())._values())._do_((function(each){
  7762. return smalltalk.withContext(function($ctx2) {
  7763. return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._category());
  7764. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7765. self._setupClass_(anotherClass);
  7766. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  7767. args: ["aClass", "anotherClass"],
  7768. 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",
  7769. messageSends: ["comment:", "comment", "do:", "install:forClass:category:", "source", "category", "new", "values", "methodDictionary", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
  7770. referencedClasses: ["Compiler"]
  7771. }),
  7772. smalltalk.ClassBuilder);
  7773. smalltalk.addMethod(
  7774. smalltalk.method({
  7775. selector: "createPackageNamed:",
  7776. category: 'private',
  7777. fn: function (aString){
  7778. var self=this;
  7779. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7780. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  7781. return smalltalk.withContext(function($ctx1) {
  7782. var $1;
  7783. $1=_st($Package())._named_ifAbsent_(aString,(function(){
  7784. return smalltalk.withContext(function($ctx2) {
  7785. return _st(_st($Smalltalk())._current())._createPackage_(aString);
  7786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  7787. return $1;
  7788. }, function($ctx1) {$ctx1.fill(self,"createPackageNamed:",{aString:aString},smalltalk.ClassBuilder)})},
  7789. args: ["aString"],
  7790. source: "createPackageNamed: aString\x0a\x09^ Package named: aString ifAbsent: [\x0a\x09\x09Smalltalk current createPackage: aString ]",
  7791. messageSends: ["named:ifAbsent:", "createPackage:", "current"],
  7792. referencedClasses: ["Smalltalk", "Package"]
  7793. }),
  7794. smalltalk.ClassBuilder);
  7795. smalltalk.addMethod(
  7796. smalltalk.method({
  7797. selector: "installMethod:forClass:category:",
  7798. category: 'method definition',
  7799. fn: function (aCompiledMethod,aBehavior,aString){
  7800. var self=this;
  7801. return smalltalk.withContext(function($ctx1) {
  7802. var $1;
  7803. _st(aCompiledMethod)._category_(aString);
  7804. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7805. self._setupClass_(aBehavior);
  7806. $1=aCompiledMethod;
  7807. return $1;
  7808. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},smalltalk.ClassBuilder)})},
  7809. args: ["aCompiledMethod", "aBehavior", "aString"],
  7810. source: "installMethod: aCompiledMethod forClass: aBehavior category: aString\x0a\x09aCompiledMethod category: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^aCompiledMethod",
  7811. messageSends: ["category:", "addCompiledMethod:", "setupClass:"],
  7812. referencedClasses: []
  7813. }),
  7814. smalltalk.ClassBuilder);
  7815. smalltalk.addMethod(
  7816. smalltalk.method({
  7817. selector: "instanceVariableNamesFor:",
  7818. category: 'accessing',
  7819. fn: function (aString){
  7820. var self=this;
  7821. return smalltalk.withContext(function($ctx1) {
  7822. var $1;
  7823. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  7824. return smalltalk.withContext(function($ctx2) {
  7825. return _st(each)._isEmpty();
  7826. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7827. return $1;
  7828. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},smalltalk.ClassBuilder)})},
  7829. args: ["aString"],
  7830. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7831. messageSends: ["reject:", "isEmpty", "tokenize:"],
  7832. referencedClasses: []
  7833. }),
  7834. smalltalk.ClassBuilder);
  7835. smalltalk.addMethod(
  7836. smalltalk.method({
  7837. selector: "migrateClass:superclass:",
  7838. category: 'class migration',
  7839. fn: function (aClass,anotherClass){
  7840. var self=this;
  7841. return smalltalk.withContext(function($ctx1) {
  7842. var $1;
  7843. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_(_st(aClass)._name(),anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  7844. return $1;
  7845. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  7846. args: ["aClass", "anotherClass"],
  7847. 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",
  7848. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"],
  7849. referencedClasses: []
  7850. }),
  7851. smalltalk.ClassBuilder);
  7852. smalltalk.addMethod(
  7853. smalltalk.method({
  7854. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7855. category: 'class migration',
  7856. fn: function (className,aClass,aCollection,packageName){
  7857. var self=this;
  7858. var oldClass,newClass,tmp;
  7859. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7860. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7861. function $ClassMigrated(){return smalltalk.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  7862. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7863. return smalltalk.withContext(function($ctx1) {
  7864. var $1,$2,$3,$4,$5,$6,$7;
  7865. tmp="new*".__comma(className);
  7866. oldClass=_st(_st($Smalltalk())._current())._at_(className);
  7867. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7868. self._basicSwapClassNames_with_(oldClass,newClass);
  7869. _st((function(){
  7870. return smalltalk.withContext(function($ctx2) {
  7871. return self._copyClass_to_(oldClass,newClass);
  7872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(exception){
  7873. return smalltalk.withContext(function($ctx2) {
  7874. $1=self;
  7875. _st($1)._basicSwapClassNames_with_(oldClass,newClass);
  7876. $2=_st($1)._basicRemoveClass_(newClass);
  7877. $2;
  7878. return _st(exception)._signal();
  7879. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})}));
  7880. $3=self;
  7881. _st($3)._rawRenameClass_to_(oldClass,tmp);
  7882. $4=_st($3)._rawRenameClass_to_(newClass,className);
  7883. _st(_st(oldClass)._subclasses())._do_displayingProgress_((function(each){
  7884. return smalltalk.withContext(function($ctx2) {
  7885. return self._migrateClass_superclass_(each,newClass);
  7886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),_st("Recompiling ".__comma(_st(newClass)._name())).__comma("..."));
  7887. self._basicRemoveClass_(oldClass);
  7888. $5=_st($ClassMigrated())._new();
  7889. _st($5)._theClass_(newClass);
  7890. _st($5)._oldClass_(oldClass);
  7891. $6=_st($5)._yourself();
  7892. _st(_st($SystemAnnouncer())._current())._announce_($6);
  7893. $7=newClass;
  7894. return $7;
  7895. }, 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)})},
  7896. args: ["className", "aClass", "aCollection", "packageName"],
  7897. 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",
  7898. messageSends: [",", "at:", "current", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "basicRemoveClass:", "signal", "copyClass:to:", "rawRenameClass:to:", "do:displayingProgress:", "migrateClass:superclass:", "name", "subclasses", "announce:", "theClass:", "new", "oldClass:", "yourself"],
  7899. referencedClasses: ["Smalltalk", "Error", "ClassMigrated", "SystemAnnouncer"]
  7900. }),
  7901. smalltalk.ClassBuilder);
  7902. smalltalk.addMethod(
  7903. smalltalk.method({
  7904. selector: "rawRenameClass:to:",
  7905. category: 'private',
  7906. fn: function (aClass,aString){
  7907. var self=this;
  7908. return smalltalk.withContext(function($ctx1) {
  7909. smalltalk[aString] = aClass;
  7910. ;
  7911. return self}, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7912. args: ["aClass", "aString"],
  7913. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09>",
  7914. messageSends: [],
  7915. referencedClasses: []
  7916. }),
  7917. smalltalk.ClassBuilder);
  7918. smalltalk.addMethod(
  7919. smalltalk.method({
  7920. selector: "renameClass:to:",
  7921. category: 'class migration',
  7922. fn: function (aClass,className){
  7923. var self=this;
  7924. function $ClassRenamed(){return smalltalk.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  7925. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7926. return smalltalk.withContext(function($ctx1) {
  7927. var $1,$2;
  7928. self._basicRenameClass_to_(aClass,className);
  7929. $1=_st($ClassRenamed())._new();
  7930. _st($1)._theClass_(aClass);
  7931. $2=_st($1)._yourself();
  7932. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7933. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},smalltalk.ClassBuilder)})},
  7934. args: ["aClass", "className"],
  7935. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7936. messageSends: ["basicRenameClass:to:", "announce:", "theClass:", "new", "yourself", "current"],
  7937. referencedClasses: ["ClassRenamed", "SystemAnnouncer"]
  7938. }),
  7939. smalltalk.ClassBuilder);
  7940. smalltalk.addMethod(
  7941. smalltalk.method({
  7942. selector: "setupClass:",
  7943. category: 'public',
  7944. fn: function (aClass){
  7945. var self=this;
  7946. return smalltalk.withContext(function($ctx1) {
  7947. smalltalk.init(aClass);;
  7948. return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
  7949. args: ["aClass"],
  7950. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  7951. messageSends: [],
  7952. referencedClasses: []
  7953. }),
  7954. smalltalk.ClassBuilder);
  7955. smalltalk.addMethod(
  7956. smalltalk.method({
  7957. selector: "superclass:subclass:",
  7958. category: 'class definition',
  7959. fn: function (aClass,className){
  7960. var self=this;
  7961. return smalltalk.withContext(function($ctx1) {
  7962. var $1;
  7963. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7964. return $1;
  7965. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},smalltalk.ClassBuilder)})},
  7966. args: ["aClass", "className"],
  7967. source: "superclass: aClass subclass: className\x0a\x09^self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7968. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  7969. referencedClasses: []
  7970. }),
  7971. smalltalk.ClassBuilder);
  7972. smalltalk.addMethod(
  7973. smalltalk.method({
  7974. selector: "superclass:subclass:instanceVariableNames:package:",
  7975. category: 'class definition',
  7976. fn: function (aClass,className,ivarNames,packageName){
  7977. var self=this;
  7978. var newClass;
  7979. function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7980. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7981. return smalltalk.withContext(function($ctx1) {
  7982. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  7983. $1=self;
  7984. $2=aClass;
  7985. $3=className;
  7986. $4=self._instanceVariableNamesFor_(ivarNames);
  7987. $6=packageName;
  7988. if(($receiver = $6) == nil || $receiver == undefined){
  7989. $5="unclassified";
  7990. } else {
  7991. $5=$6;
  7992. };
  7993. newClass=_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$5);
  7994. self._setupClass_(newClass);
  7995. $7=_st($ClassAdded())._new();
  7996. _st($7)._theClass_(newClass);
  7997. $8=_st($7)._yourself();
  7998. _st(_st($SystemAnnouncer())._current())._announce_($8);
  7999. $9=newClass;
  8000. return $9;
  8001. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},smalltalk.ClassBuilder)})},
  8002. args: ["aClass", "className", "ivarNames", "packageName"],
  8003. 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",
  8004. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  8005. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  8006. }),
  8007. smalltalk.ClassBuilder);
  8008. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category'], 'Kernel-Classes');
  8009. smalltalk.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  8010. smalltalk.addMethod(
  8011. smalltalk.method({
  8012. selector: "class:category:",
  8013. category: 'accessing',
  8014. fn: function (aClass,aString){
  8015. var self=this;
  8016. return smalltalk.withContext(function($ctx1) {
  8017. self["@class"]=aClass;
  8018. self["@category"]=aString;
  8019. return self}, function($ctx1) {$ctx1.fill(self,"class:category:",{aClass:aClass,aString:aString},smalltalk.ClassCategoryReader)})},
  8020. args: ["aClass", "aString"],
  8021. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  8022. messageSends: [],
  8023. referencedClasses: []
  8024. }),
  8025. smalltalk.ClassCategoryReader);
  8026. smalltalk.addMethod(
  8027. smalltalk.method({
  8028. selector: "compileMethod:",
  8029. category: 'private',
  8030. fn: function (aString){
  8031. var self=this;
  8032. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  8033. return smalltalk.withContext(function($ctx1) {
  8034. _st(_st($Compiler())._new())._install_forClass_category_(aString,self["@class"],self["@category"]);
  8035. return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},smalltalk.ClassCategoryReader)})},
  8036. args: ["aString"],
  8037. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  8038. messageSends: ["install:forClass:category:", "new"],
  8039. referencedClasses: ["Compiler"]
  8040. }),
  8041. smalltalk.ClassCategoryReader);
  8042. smalltalk.addMethod(
  8043. smalltalk.method({
  8044. selector: "initialize",
  8045. category: 'initialization',
  8046. fn: function (){
  8047. var self=this;
  8048. return smalltalk.withContext(function($ctx1) {
  8049. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  8050. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCategoryReader)})},
  8051. args: [],
  8052. source: "initialize\x0a\x09super initialize.",
  8053. messageSends: ["initialize"],
  8054. referencedClasses: []
  8055. }),
  8056. smalltalk.ClassCategoryReader);
  8057. smalltalk.addMethod(
  8058. smalltalk.method({
  8059. selector: "scanFrom:",
  8060. category: 'fileIn',
  8061. fn: function (aChunkParser){
  8062. var self=this;
  8063. var chunk;
  8064. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  8065. return smalltalk.withContext(function($ctx1) {
  8066. _st((function(){
  8067. return smalltalk.withContext(function($ctx2) {
  8068. chunk=_st(aChunkParser)._nextChunk();
  8069. chunk;
  8070. return _st(chunk)._isEmpty();
  8071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  8072. return smalltalk.withContext(function($ctx2) {
  8073. return self._compileMethod_(chunk);
  8074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8075. _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
  8076. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCategoryReader)})},
  8077. args: ["aChunkParser"],
  8078. 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",
  8079. messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"],
  8080. referencedClasses: ["ClassBuilder"]
  8081. }),
  8082. smalltalk.ClassCategoryReader);
  8083. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class'], 'Kernel-Classes');
  8084. smalltalk.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  8085. smalltalk.addMethod(
  8086. smalltalk.method({
  8087. selector: "class:",
  8088. category: 'accessing',
  8089. fn: function (aClass){
  8090. var self=this;
  8091. return smalltalk.withContext(function($ctx1) {
  8092. self["@class"]=aClass;
  8093. return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},smalltalk.ClassCommentReader)})},
  8094. args: ["aClass"],
  8095. source: "class: aClass\x0a\x09class := aClass",
  8096. messageSends: [],
  8097. referencedClasses: []
  8098. }),
  8099. smalltalk.ClassCommentReader);
  8100. smalltalk.addMethod(
  8101. smalltalk.method({
  8102. selector: "initialize",
  8103. category: 'initialization',
  8104. fn: function (){
  8105. var self=this;
  8106. return smalltalk.withContext(function($ctx1) {
  8107. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  8108. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCommentReader)})},
  8109. args: [],
  8110. source: "initialize\x0a\x09super initialize.",
  8111. messageSends: ["initialize"],
  8112. referencedClasses: []
  8113. }),
  8114. smalltalk.ClassCommentReader);
  8115. smalltalk.addMethod(
  8116. smalltalk.method({
  8117. selector: "scanFrom:",
  8118. category: 'fileIn',
  8119. fn: function (aChunkParser){
  8120. var self=this;
  8121. var chunk;
  8122. return smalltalk.withContext(function($ctx1) {
  8123. var $1;
  8124. chunk=_st(aChunkParser)._nextChunk();
  8125. $1=_st(chunk)._isEmpty();
  8126. if(! smalltalk.assert($1)){
  8127. self._setComment_(chunk);
  8128. };
  8129. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCommentReader)})},
  8130. args: ["aChunkParser"],
  8131. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk].",
  8132. messageSends: ["nextChunk", "ifFalse:", "setComment:", "isEmpty"],
  8133. referencedClasses: []
  8134. }),
  8135. smalltalk.ClassCommentReader);
  8136. smalltalk.addMethod(
  8137. smalltalk.method({
  8138. selector: "setComment:",
  8139. category: 'private',
  8140. fn: function (aString){
  8141. var self=this;
  8142. return smalltalk.withContext(function($ctx1) {
  8143. _st(self["@class"])._comment_(aString);
  8144. return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},smalltalk.ClassCommentReader)})},
  8145. args: ["aString"],
  8146. source: "setComment: aString\x0a\x09class comment: aString",
  8147. messageSends: ["comment:"],
  8148. referencedClasses: []
  8149. }),
  8150. smalltalk.ClassCommentReader);
  8151. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  8152. 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.";
  8153. smalltalk.addMethod(
  8154. smalltalk.method({
  8155. selector: "getNodesFrom:",
  8156. category: 'accessing',
  8157. fn: function (aCollection){
  8158. var self=this;
  8159. var children,others;
  8160. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  8161. return smalltalk.withContext(function($ctx1) {
  8162. var $1;
  8163. children=[];
  8164. others=[];
  8165. _st(aCollection)._do_((function(each){
  8166. return smalltalk.withContext(function($ctx2) {
  8167. $1=_st(_st(each)._superclass()).__eq(self._theClass());
  8168. if(smalltalk.assert($1)){
  8169. return _st(children)._add_(each);
  8170. } else {
  8171. return _st(others)._add_(each);
  8172. };
  8173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8174. self["@nodes"]=_st(children)._collect_((function(each){
  8175. return smalltalk.withContext(function($ctx2) {
  8176. return _st($ClassSorterNode())._on_classes_level_(each,others,_st(self._level()).__plus((1)));
  8177. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8178. return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},smalltalk.ClassSorterNode)})},
  8179. args: ["aCollection"],
  8180. 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]",
  8181. messageSends: ["do:", "ifTrue:ifFalse:", "add:", "=", "theClass", "superclass", "collect:", "on:classes:level:", "+", "level"],
  8182. referencedClasses: ["ClassSorterNode"]
  8183. }),
  8184. smalltalk.ClassSorterNode);
  8185. smalltalk.addMethod(
  8186. smalltalk.method({
  8187. selector: "level",
  8188. category: 'accessing',
  8189. fn: function (){
  8190. var self=this;
  8191. return smalltalk.withContext(function($ctx1) {
  8192. var $1;
  8193. $1=self["@level"];
  8194. return $1;
  8195. }, function($ctx1) {$ctx1.fill(self,"level",{},smalltalk.ClassSorterNode)})},
  8196. args: [],
  8197. source: "level\x0a\x09^level",
  8198. messageSends: [],
  8199. referencedClasses: []
  8200. }),
  8201. smalltalk.ClassSorterNode);
  8202. smalltalk.addMethod(
  8203. smalltalk.method({
  8204. selector: "level:",
  8205. category: 'accessing',
  8206. fn: function (anInteger){
  8207. var self=this;
  8208. return smalltalk.withContext(function($ctx1) {
  8209. self["@level"]=anInteger;
  8210. return self}, function($ctx1) {$ctx1.fill(self,"level:",{anInteger:anInteger},smalltalk.ClassSorterNode)})},
  8211. args: ["anInteger"],
  8212. source: "level: anInteger\x0a\x09level := anInteger",
  8213. messageSends: [],
  8214. referencedClasses: []
  8215. }),
  8216. smalltalk.ClassSorterNode);
  8217. smalltalk.addMethod(
  8218. smalltalk.method({
  8219. selector: "nodes",
  8220. category: 'accessing',
  8221. fn: function (){
  8222. var self=this;
  8223. return smalltalk.withContext(function($ctx1) {
  8224. var $1;
  8225. $1=self["@nodes"];
  8226. return $1;
  8227. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.ClassSorterNode)})},
  8228. args: [],
  8229. source: "nodes\x0a\x09^nodes",
  8230. messageSends: [],
  8231. referencedClasses: []
  8232. }),
  8233. smalltalk.ClassSorterNode);
  8234. smalltalk.addMethod(
  8235. smalltalk.method({
  8236. selector: "theClass",
  8237. category: 'accessing',
  8238. fn: function (){
  8239. var self=this;
  8240. return smalltalk.withContext(function($ctx1) {
  8241. var $1;
  8242. $1=self["@theClass"];
  8243. return $1;
  8244. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassSorterNode)})},
  8245. args: [],
  8246. source: "theClass\x0a\x09^theClass",
  8247. messageSends: [],
  8248. referencedClasses: []
  8249. }),
  8250. smalltalk.ClassSorterNode);
  8251. smalltalk.addMethod(
  8252. smalltalk.method({
  8253. selector: "theClass:",
  8254. category: 'accessing',
  8255. fn: function (aClass){
  8256. var self=this;
  8257. return smalltalk.withContext(function($ctx1) {
  8258. self["@theClass"]=aClass;
  8259. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassSorterNode)})},
  8260. args: ["aClass"],
  8261. source: "theClass: aClass\x0a\x09theClass := aClass",
  8262. messageSends: [],
  8263. referencedClasses: []
  8264. }),
  8265. smalltalk.ClassSorterNode);
  8266. smalltalk.addMethod(
  8267. smalltalk.method({
  8268. selector: "traverseClassesWith:",
  8269. category: 'visiting',
  8270. fn: function (aCollection){
  8271. var self=this;
  8272. return smalltalk.withContext(function($ctx1) {
  8273. _st(aCollection)._add_(self._theClass());
  8274. _st(_st(self._nodes())._sorted_((function(a,b){
  8275. return smalltalk.withContext(function($ctx2) {
  8276. return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  8277. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(aNode){
  8278. return smalltalk.withContext(function($ctx2) {
  8279. return _st(aNode)._traverseClassesWith_(aCollection);
  8280. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  8281. return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},smalltalk.ClassSorterNode)})},
  8282. args: ["aCollection"],
  8283. 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 ].",
  8284. messageSends: ["add:", "theClass", "do:", "traverseClassesWith:", "sorted:", "<=", "name", "nodes"],
  8285. referencedClasses: []
  8286. }),
  8287. smalltalk.ClassSorterNode);
  8288. smalltalk.addMethod(
  8289. smalltalk.method({
  8290. selector: "on:classes:level:",
  8291. category: 'instance creation',
  8292. fn: function (aClass,aCollection,anInteger){
  8293. var self=this;
  8294. return smalltalk.withContext(function($ctx1) {
  8295. var $2,$3,$1;
  8296. $2=self._new();
  8297. _st($2)._theClass_(aClass);
  8298. _st($2)._level_(anInteger);
  8299. _st($2)._getNodesFrom_(aCollection);
  8300. $3=_st($2)._yourself();
  8301. $1=$3;
  8302. return $1;
  8303. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},smalltalk.ClassSorterNode.klass)})},
  8304. args: ["aClass", "aCollection", "anInteger"],
  8305. 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",
  8306. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  8307. referencedClasses: []
  8308. }),
  8309. smalltalk.ClassSorterNode.klass);
  8310. smalltalk.addPackage('Kernel-Methods');
  8311. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  8312. 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 | ... ] `";
  8313. smalltalk.addMethod(
  8314. smalltalk.method({
  8315. selector: "applyTo:arguments:",
  8316. category: 'evaluating',
  8317. fn: function (anObject,aCollection){
  8318. var self=this;
  8319. return smalltalk.withContext(function($ctx1) {
  8320. return self.apply(anObject, aCollection);
  8321. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.BlockClosure)})},
  8322. args: ["anObject", "aCollection"],
  8323. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  8324. messageSends: [],
  8325. referencedClasses: []
  8326. }),
  8327. smalltalk.BlockClosure);
  8328. smalltalk.addMethod(
  8329. smalltalk.method({
  8330. selector: "asCompiledMethod:",
  8331. category: 'converting',
  8332. fn: function (aString){
  8333. var self=this;
  8334. return smalltalk.withContext(function($ctx1) {
  8335. return smalltalk.method({selector:aString, fn:self});;
  8336. return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},smalltalk.BlockClosure)})},
  8337. args: ["aString"],
  8338. source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
  8339. messageSends: [],
  8340. referencedClasses: []
  8341. }),
  8342. smalltalk.BlockClosure);
  8343. smalltalk.addMethod(
  8344. smalltalk.method({
  8345. selector: "compiledSource",
  8346. category: 'accessing',
  8347. fn: function (){
  8348. var self=this;
  8349. return smalltalk.withContext(function($ctx1) {
  8350. return self.toString();
  8351. return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},smalltalk.BlockClosure)})},
  8352. args: [],
  8353. source: "compiledSource\x0a\x09<return self.toString()>",
  8354. messageSends: [],
  8355. referencedClasses: []
  8356. }),
  8357. smalltalk.BlockClosure);
  8358. smalltalk.addMethod(
  8359. smalltalk.method({
  8360. selector: "currySelf",
  8361. category: 'converting',
  8362. fn: function (){
  8363. var self=this;
  8364. return smalltalk.withContext(function($ctx1) {
  8365. return function () {
  8366. var args = [ this ];
  8367. args.push.apply(args, arguments);
  8368. return self.apply(null, args);
  8369. }
  8370. ;
  8371. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},smalltalk.BlockClosure)})},
  8372. args: [],
  8373. 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>",
  8374. messageSends: [],
  8375. referencedClasses: []
  8376. }),
  8377. smalltalk.BlockClosure);
  8378. smalltalk.addMethod(
  8379. smalltalk.method({
  8380. selector: "ensure:",
  8381. category: 'evaluating',
  8382. fn: function (aBlock){
  8383. var self=this;
  8384. return smalltalk.withContext(function($ctx1) {
  8385. try{return self._value()}finally{aBlock._value()};
  8386. return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  8387. args: ["aBlock"],
  8388. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  8389. messageSends: [],
  8390. referencedClasses: []
  8391. }),
  8392. smalltalk.BlockClosure);
  8393. smalltalk.addMethod(
  8394. smalltalk.method({
  8395. selector: "fork",
  8396. category: 'timeout/interval',
  8397. fn: function (){
  8398. var self=this;
  8399. function $ForkPool(){return smalltalk.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  8400. return smalltalk.withContext(function($ctx1) {
  8401. _st(_st($ForkPool())._default())._fork_(self);
  8402. return self}, function($ctx1) {$ctx1.fill(self,"fork",{},smalltalk.BlockClosure)})},
  8403. args: [],
  8404. source: "fork\x0a\x09ForkPool default fork: self",
  8405. messageSends: ["fork:", "default"],
  8406. referencedClasses: ["ForkPool"]
  8407. }),
  8408. smalltalk.BlockClosure);
  8409. smalltalk.addMethod(
  8410. smalltalk.method({
  8411. selector: "new",
  8412. category: 'evaluating',
  8413. fn: function (){
  8414. var self=this;
  8415. return smalltalk.withContext(function($ctx1) {
  8416. return new self();
  8417. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.BlockClosure)})},
  8418. args: [],
  8419. 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()>",
  8420. messageSends: [],
  8421. referencedClasses: []
  8422. }),
  8423. smalltalk.BlockClosure);
  8424. smalltalk.addMethod(
  8425. smalltalk.method({
  8426. selector: "newValue:",
  8427. category: 'evaluating',
  8428. fn: function (anObject){
  8429. var self=this;
  8430. return smalltalk.withContext(function($ctx1) {
  8431. var $1;
  8432. $1=self._newWithValues_([anObject]);
  8433. return $1;
  8434. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},smalltalk.BlockClosure)})},
  8435. args: ["anObject"],
  8436. source: "newValue: anObject\x0a^ self newWithValues: { anObject }",
  8437. messageSends: ["newWithValues:"],
  8438. referencedClasses: []
  8439. }),
  8440. smalltalk.BlockClosure);
  8441. smalltalk.addMethod(
  8442. smalltalk.method({
  8443. selector: "newValue:value:",
  8444. category: 'evaluating',
  8445. fn: function (anObject,anObject2){
  8446. var self=this;
  8447. return smalltalk.withContext(function($ctx1) {
  8448. var $1;
  8449. $1=self._newWithValues_([anObject,anObject2]);
  8450. return $1;
  8451. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},smalltalk.BlockClosure)})},
  8452. args: ["anObject", "anObject2"],
  8453. source: "newValue: anObject value: anObject2\x0a^ self newWithValues: { anObject. anObject2 }.",
  8454. messageSends: ["newWithValues:"],
  8455. referencedClasses: []
  8456. }),
  8457. smalltalk.BlockClosure);
  8458. smalltalk.addMethod(
  8459. smalltalk.method({
  8460. selector: "newValue:value:value:",
  8461. category: 'evaluating',
  8462. fn: function (anObject,anObject2,anObject3){
  8463. var self=this;
  8464. return smalltalk.withContext(function($ctx1) {
  8465. var $1;
  8466. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  8467. return $1;
  8468. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.BlockClosure)})},
  8469. args: ["anObject", "anObject2", "anObject3"],
  8470. source: "newValue: anObject value: anObject2 value: anObject3\x0a^ self newWithValues: { anObject. anObject2. anObject3 }.",
  8471. messageSends: ["newWithValues:"],
  8472. referencedClasses: []
  8473. }),
  8474. smalltalk.BlockClosure);
  8475. smalltalk.addMethod(
  8476. smalltalk.method({
  8477. selector: "newWithValues:",
  8478. category: 'evaluating',
  8479. fn: function (aCollection){
  8480. var self=this;
  8481. return smalltalk.withContext(function($ctx1) {
  8482. var constructor = function() {};
  8483. constructor.prototype = self.prototype;
  8484. var object = new constructor;
  8485. var result = self.apply(object, aCollection);
  8486. return typeof result === "object" ? result : object;;
  8487. return self}, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},smalltalk.BlockClosure)})},
  8488. args: ["aCollection"],
  8489. source: "newWithValues: aCollection\x0a\x22Use the receiver as a JavaScript constructor with a variable number of arguments.\x0aAnswer the object created using the operator `new`.\x0a\x0aThis algorithm was inspired by http://stackoverflow.com/a/6069331.\x0a\x0aHere's a general breakdown of what's going on:\x0a1) Create a new, empty constructor function.\x0a2) Set it's prototype to the receiver's prototype. Because the receiver is a `BlockClosure`, it is also a JavaScript function.\x0a3) Instantiate a new object using the constructor function just created. \x0a This forces the interpreter to set the internal [[prototype]] property to what was set on the function before. \x0a This has to be done, as we have no access to the [[prototype]] property externally.\x0a4) Apply `self` to the object I just instantiated.\x22\x0a\x0a<\x0a\x09var constructor = function() {};\x0a\x09constructor.prototype = self.prototype;\x0a\x09var object = new constructor;\x0a\x09var result = self.apply(object, aCollection);\x0a\x09return typeof result === \x22object\x22 ? result : object;\x0a>",
  8490. messageSends: [],
  8491. referencedClasses: []
  8492. }),
  8493. smalltalk.BlockClosure);
  8494. smalltalk.addMethod(
  8495. smalltalk.method({
  8496. selector: "numArgs",
  8497. category: 'accessing',
  8498. fn: function (){
  8499. var self=this;
  8500. return smalltalk.withContext(function($ctx1) {
  8501. return self.length;
  8502. return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},smalltalk.BlockClosure)})},
  8503. args: [],
  8504. source: "numArgs\x0a\x09<return self.length>",
  8505. messageSends: [],
  8506. referencedClasses: []
  8507. }),
  8508. smalltalk.BlockClosure);
  8509. smalltalk.addMethod(
  8510. smalltalk.method({
  8511. selector: "on:do:",
  8512. category: 'error handling',
  8513. fn: function (anErrorClass,aBlock){
  8514. var self=this;
  8515. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  8516. return smalltalk.withContext(function($ctx1) {
  8517. var $2,$1;
  8518. $1=self._try_catch_(self,(function(error){
  8519. var smalltalkError;
  8520. return smalltalk.withContext(function($ctx2) {
  8521. smalltalkError=_st(_st($Smalltalk())._current())._asSmalltalkException_(error);
  8522. smalltalkError;
  8523. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  8524. if(smalltalk.assert($2)){
  8525. return _st(aBlock)._value_(smalltalkError);
  8526. } else {
  8527. return _st(smalltalkError)._resignal();
  8528. };
  8529. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1)})}));
  8530. return $1;
  8531. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},smalltalk.BlockClosure)})},
  8532. args: ["anErrorClass", "aBlock"],
  8533. 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 ] ]",
  8534. messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "value:", "resignal", "isKindOf:"],
  8535. referencedClasses: ["Smalltalk"]
  8536. }),
  8537. smalltalk.BlockClosure);
  8538. smalltalk.addMethod(
  8539. smalltalk.method({
  8540. selector: "receiver",
  8541. category: 'accessing',
  8542. fn: function (){
  8543. var self=this;
  8544. return smalltalk.withContext(function($ctx1) {
  8545. return nil;
  8546. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.BlockClosure)})},
  8547. args: [],
  8548. source: "receiver\x0a\x09^ nil",
  8549. messageSends: [],
  8550. referencedClasses: []
  8551. }),
  8552. smalltalk.BlockClosure);
  8553. smalltalk.addMethod(
  8554. smalltalk.method({
  8555. selector: "timeToRun",
  8556. category: 'evaluating',
  8557. fn: function (){
  8558. var self=this;
  8559. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  8560. return smalltalk.withContext(function($ctx1) {
  8561. var $1;
  8562. $1=_st($Date())._millisecondsToRun_(self);
  8563. return $1;
  8564. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},smalltalk.BlockClosure)})},
  8565. args: [],
  8566. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  8567. messageSends: ["millisecondsToRun:"],
  8568. referencedClasses: ["Date"]
  8569. }),
  8570. smalltalk.BlockClosure);
  8571. smalltalk.addMethod(
  8572. smalltalk.method({
  8573. selector: "value",
  8574. category: 'evaluating',
  8575. fn: function (){
  8576. var self=this;
  8577. return smalltalk.withContext(function($ctx1) {
  8578. return self();;
  8579. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.BlockClosure)})},
  8580. args: [],
  8581. source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
  8582. messageSends: [],
  8583. referencedClasses: []
  8584. }),
  8585. smalltalk.BlockClosure);
  8586. smalltalk.addMethod(
  8587. smalltalk.method({
  8588. selector: "value:",
  8589. category: 'evaluating',
  8590. fn: function (anArg){
  8591. var self=this;
  8592. return smalltalk.withContext(function($ctx1) {
  8593. return self(anArg);;
  8594. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},smalltalk.BlockClosure)})},
  8595. args: ["anArg"],
  8596. source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
  8597. messageSends: [],
  8598. referencedClasses: []
  8599. }),
  8600. smalltalk.BlockClosure);
  8601. smalltalk.addMethod(
  8602. smalltalk.method({
  8603. selector: "value:value:",
  8604. category: 'evaluating',
  8605. fn: function (firstArg,secondArg){
  8606. var self=this;
  8607. return smalltalk.withContext(function($ctx1) {
  8608. return self(firstArg, secondArg);;
  8609. return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},smalltalk.BlockClosure)})},
  8610. args: ["firstArg", "secondArg"],
  8611. source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
  8612. messageSends: [],
  8613. referencedClasses: []
  8614. }),
  8615. smalltalk.BlockClosure);
  8616. smalltalk.addMethod(
  8617. smalltalk.method({
  8618. selector: "value:value:value:",
  8619. category: 'evaluating',
  8620. fn: function (firstArg,secondArg,thirdArg){
  8621. var self=this;
  8622. return smalltalk.withContext(function($ctx1) {
  8623. return self(firstArg, secondArg, thirdArg);;
  8624. return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},smalltalk.BlockClosure)})},
  8625. args: ["firstArg", "secondArg", "thirdArg"],
  8626. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  8627. messageSends: [],
  8628. referencedClasses: []
  8629. }),
  8630. smalltalk.BlockClosure);
  8631. smalltalk.addMethod(
  8632. smalltalk.method({
  8633. selector: "valueWithInterval:",
  8634. category: 'timeout/interval',
  8635. fn: function (aNumber){
  8636. var self=this;
  8637. return smalltalk.withContext(function($ctx1) {
  8638. var interval = setInterval(self, aNumber);
  8639. return smalltalk.Timeout._on_(interval);
  8640. ;
  8641. return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  8642. args: ["aNumber"],
  8643. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(interval);\x0a\x09>",
  8644. messageSends: [],
  8645. referencedClasses: []
  8646. }),
  8647. smalltalk.BlockClosure);
  8648. smalltalk.addMethod(
  8649. smalltalk.method({
  8650. selector: "valueWithPossibleArguments:",
  8651. category: 'evaluating',
  8652. fn: function (aCollection){
  8653. var self=this;
  8654. return smalltalk.withContext(function($ctx1) {
  8655. return self.apply(null, aCollection);;
  8656. return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.BlockClosure)})},
  8657. args: ["aCollection"],
  8658. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8659. messageSends: [],
  8660. referencedClasses: []
  8661. }),
  8662. smalltalk.BlockClosure);
  8663. smalltalk.addMethod(
  8664. smalltalk.method({
  8665. selector: "valueWithTimeout:",
  8666. category: 'timeout/interval',
  8667. fn: function (aNumber){
  8668. var self=this;
  8669. return smalltalk.withContext(function($ctx1) {
  8670. var timeout = setTimeout(self, aNumber);
  8671. return smalltalk.Timeout._on_(timeout);
  8672. ;
  8673. return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  8674. args: ["aNumber"],
  8675. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(timeout);\x0a\x09>",
  8676. messageSends: [],
  8677. referencedClasses: []
  8678. }),
  8679. smalltalk.BlockClosure);
  8680. smalltalk.addMethod(
  8681. smalltalk.method({
  8682. selector: "whileFalse",
  8683. category: 'controlling',
  8684. fn: function (){
  8685. var self=this;
  8686. return smalltalk.withContext(function($ctx1) {
  8687. self._whileFalse_((function(){
  8688. return smalltalk.withContext(function($ctx2) {
  8689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8690. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},smalltalk.BlockClosure)})},
  8691. args: [],
  8692. source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
  8693. messageSends: ["whileFalse:"],
  8694. referencedClasses: []
  8695. }),
  8696. smalltalk.BlockClosure);
  8697. smalltalk.addMethod(
  8698. smalltalk.method({
  8699. selector: "whileFalse:",
  8700. category: 'controlling',
  8701. fn: function (aBlock){
  8702. var self=this;
  8703. return smalltalk.withContext(function($ctx1) {
  8704. while(!smalltalk.assert(self._value())) {aBlock._value()};
  8705. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  8706. args: ["aBlock"],
  8707. source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!smalltalk.assert(self._value())) {aBlock._value()}>",
  8708. messageSends: [],
  8709. referencedClasses: []
  8710. }),
  8711. smalltalk.BlockClosure);
  8712. smalltalk.addMethod(
  8713. smalltalk.method({
  8714. selector: "whileTrue",
  8715. category: 'controlling',
  8716. fn: function (){
  8717. var self=this;
  8718. return smalltalk.withContext(function($ctx1) {
  8719. self._whileTrue_((function(){
  8720. return smalltalk.withContext(function($ctx2) {
  8721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8722. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},smalltalk.BlockClosure)})},
  8723. args: [],
  8724. source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
  8725. messageSends: ["whileTrue:"],
  8726. referencedClasses: []
  8727. }),
  8728. smalltalk.BlockClosure);
  8729. smalltalk.addMethod(
  8730. smalltalk.method({
  8731. selector: "whileTrue:",
  8732. category: 'controlling',
  8733. fn: function (aBlock){
  8734. var self=this;
  8735. return smalltalk.withContext(function($ctx1) {
  8736. while(smalltalk.assert(self._value())) {aBlock._value()};
  8737. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  8738. args: ["aBlock"],
  8739. source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(smalltalk.assert(self._value())) {aBlock._value()}>",
  8740. messageSends: [],
  8741. referencedClasses: []
  8742. }),
  8743. smalltalk.BlockClosure);
  8744. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  8745. 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";
  8746. smalltalk.addMethod(
  8747. smalltalk.method({
  8748. selector: "arguments",
  8749. category: 'accessing',
  8750. fn: function (){
  8751. var self=this;
  8752. return smalltalk.withContext(function($ctx1) {
  8753. return self.args || [];
  8754. return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.CompiledMethod)})},
  8755. args: [],
  8756. source: "arguments\x0a\x09<return self.args || []>",
  8757. messageSends: [],
  8758. referencedClasses: []
  8759. }),
  8760. smalltalk.CompiledMethod);
  8761. smalltalk.addMethod(
  8762. smalltalk.method({
  8763. selector: "category",
  8764. category: 'accessing',
  8765. fn: function (){
  8766. var self=this;
  8767. return smalltalk.withContext(function($ctx1) {
  8768. var $2,$1;
  8769. $2=self._basicAt_("category");
  8770. if(($receiver = $2) == nil || $receiver == undefined){
  8771. $1=self._defaultCategory();
  8772. } else {
  8773. $1=$2;
  8774. };
  8775. return $1;
  8776. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.CompiledMethod)})},
  8777. args: [],
  8778. source: "category\x0a\x09^(self basicAt: 'category') ifNil: [ self defaultCategory ]",
  8779. messageSends: ["ifNil:", "defaultCategory", "basicAt:"],
  8780. referencedClasses: []
  8781. }),
  8782. smalltalk.CompiledMethod);
  8783. smalltalk.addMethod(
  8784. smalltalk.method({
  8785. selector: "category:",
  8786. category: 'accessing',
  8787. fn: function (aString){
  8788. var self=this;
  8789. var oldProtocol;
  8790. function $MethodMoved(){return smalltalk.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  8791. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8792. return smalltalk.withContext(function($ctx1) {
  8793. var $1,$2,$3;
  8794. oldProtocol=self._protocol();
  8795. self._basicAt_put_("category",aString);
  8796. $1=_st($MethodMoved())._new();
  8797. _st($1)._method_(self);
  8798. _st($1)._oldProtocol_(oldProtocol);
  8799. $2=_st($1)._yourself();
  8800. _st(_st($SystemAnnouncer())._current())._announce_($2);
  8801. $3=self._methodClass();
  8802. if(($receiver = $3) == nil || $receiver == undefined){
  8803. $3;
  8804. } else {
  8805. _st(_st(self._methodClass())._organization())._addElement_(aString);
  8806. _st(_st(_st(self._methodClass())._methods())._select_((function(each){
  8807. return smalltalk.withContext(function($ctx2) {
  8808. return _st(_st(each)._protocol()).__eq(oldProtocol);
  8809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._ifEmpty_((function(){
  8810. return smalltalk.withContext(function($ctx2) {
  8811. return _st(_st(self._methodClass())._organization())._removeElement_(oldProtocol);
  8812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8813. };
  8814. return self}, function($ctx1) {$ctx1.fill(self,"category:",{aString:aString,oldProtocol:oldProtocol},smalltalk.CompiledMethod)})},
  8815. args: ["aString"],
  8816. 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 ] ]",
  8817. messageSends: ["protocol", "basicAt:put:", "announce:", "method:", "new", "oldProtocol:", "yourself", "current", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
  8818. referencedClasses: ["MethodMoved", "SystemAnnouncer"]
  8819. }),
  8820. smalltalk.CompiledMethod);
  8821. smalltalk.addMethod(
  8822. smalltalk.method({
  8823. selector: "defaultCategory",
  8824. category: 'defaults',
  8825. fn: function (){
  8826. var self=this;
  8827. return smalltalk.withContext(function($ctx1) {
  8828. return "as yet unclassified";
  8829. }, function($ctx1) {$ctx1.fill(self,"defaultCategory",{},smalltalk.CompiledMethod)})},
  8830. args: [],
  8831. source: "defaultCategory\x0a\x09^ 'as yet unclassified'",
  8832. messageSends: [],
  8833. referencedClasses: []
  8834. }),
  8835. smalltalk.CompiledMethod);
  8836. smalltalk.addMethod(
  8837. smalltalk.method({
  8838. selector: "fn",
  8839. category: 'accessing',
  8840. fn: function (){
  8841. var self=this;
  8842. return smalltalk.withContext(function($ctx1) {
  8843. var $1;
  8844. $1=self._basicAt_("fn");
  8845. return $1;
  8846. }, function($ctx1) {$ctx1.fill(self,"fn",{},smalltalk.CompiledMethod)})},
  8847. args: [],
  8848. source: "fn\x0a\x09^self basicAt: 'fn'",
  8849. messageSends: ["basicAt:"],
  8850. referencedClasses: []
  8851. }),
  8852. smalltalk.CompiledMethod);
  8853. smalltalk.addMethod(
  8854. smalltalk.method({
  8855. selector: "fn:",
  8856. category: 'accessing',
  8857. fn: function (aBlock){
  8858. var self=this;
  8859. return smalltalk.withContext(function($ctx1) {
  8860. self._basicAt_put_("fn",aBlock);
  8861. return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},smalltalk.CompiledMethod)})},
  8862. args: ["aBlock"],
  8863. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8864. messageSends: ["basicAt:put:"],
  8865. referencedClasses: []
  8866. }),
  8867. smalltalk.CompiledMethod);
  8868. smalltalk.addMethod(
  8869. smalltalk.method({
  8870. selector: "isCompiledMethod",
  8871. category: 'testing',
  8872. fn: function (){
  8873. var self=this;
  8874. return smalltalk.withContext(function($ctx1) {
  8875. return true;
  8876. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.CompiledMethod)})},
  8877. args: [],
  8878. source: "isCompiledMethod\x0a\x09^ true",
  8879. messageSends: [],
  8880. referencedClasses: []
  8881. }),
  8882. smalltalk.CompiledMethod);
  8883. smalltalk.addMethod(
  8884. smalltalk.method({
  8885. selector: "isOverridden",
  8886. category: 'testing',
  8887. fn: function (){
  8888. var self=this;
  8889. var selector;
  8890. return smalltalk.withContext(function($ctx1) {
  8891. var $1;
  8892. var $early={};
  8893. try {
  8894. selector=self._selector();
  8895. _st(self._methodClass())._allSubclassesDo_((function(each){
  8896. return smalltalk.withContext(function($ctx2) {
  8897. $1=_st(each)._includesSelector_(selector);
  8898. if(smalltalk.assert($1)){
  8899. throw $early=[true];
  8900. };
  8901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8902. return false;
  8903. }
  8904. catch(e) {if(e===$early)return e[0]; throw e}
  8905. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},smalltalk.CompiledMethod)})},
  8906. args: [],
  8907. 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",
  8908. messageSends: ["selector", "allSubclassesDo:", "ifTrue:", "includesSelector:", "methodClass"],
  8909. referencedClasses: []
  8910. }),
  8911. smalltalk.CompiledMethod);
  8912. smalltalk.addMethod(
  8913. smalltalk.method({
  8914. selector: "isOverride",
  8915. category: 'testing',
  8916. fn: function (){
  8917. var self=this;
  8918. var superclass;
  8919. return smalltalk.withContext(function($ctx1) {
  8920. var $1,$2;
  8921. superclass=_st(self._methodClass())._superclass();
  8922. $1=superclass;
  8923. if(($receiver = $1) == nil || $receiver == undefined){
  8924. return false;
  8925. } else {
  8926. $1;
  8927. };
  8928. $2=_st(_st(_st(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8929. return $2;
  8930. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},smalltalk.CompiledMethod)})},
  8931. args: [],
  8932. 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",
  8933. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"],
  8934. referencedClasses: []
  8935. }),
  8936. smalltalk.CompiledMethod);
  8937. smalltalk.addMethod(
  8938. smalltalk.method({
  8939. selector: "messageSends",
  8940. category: 'accessing',
  8941. fn: function (){
  8942. var self=this;
  8943. return smalltalk.withContext(function($ctx1) {
  8944. var $1;
  8945. $1=self._basicAt_("messageSends");
  8946. return $1;
  8947. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.CompiledMethod)})},
  8948. args: [],
  8949. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  8950. messageSends: ["basicAt:"],
  8951. referencedClasses: []
  8952. }),
  8953. smalltalk.CompiledMethod);
  8954. smalltalk.addMethod(
  8955. smalltalk.method({
  8956. selector: "methodClass",
  8957. category: 'accessing',
  8958. fn: function (){
  8959. var self=this;
  8960. return smalltalk.withContext(function($ctx1) {
  8961. var $1;
  8962. $1=self._basicAt_("methodClass");
  8963. return $1;
  8964. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},smalltalk.CompiledMethod)})},
  8965. args: [],
  8966. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  8967. messageSends: ["basicAt:"],
  8968. referencedClasses: []
  8969. }),
  8970. smalltalk.CompiledMethod);
  8971. smalltalk.addMethod(
  8972. smalltalk.method({
  8973. selector: "protocol",
  8974. category: 'accessing',
  8975. fn: function (){
  8976. var self=this;
  8977. return smalltalk.withContext(function($ctx1) {
  8978. var $1;
  8979. $1=self._category();
  8980. return $1;
  8981. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.CompiledMethod)})},
  8982. args: [],
  8983. source: "protocol\x0a\x09^ self category",
  8984. messageSends: ["category"],
  8985. referencedClasses: []
  8986. }),
  8987. smalltalk.CompiledMethod);
  8988. smalltalk.addMethod(
  8989. smalltalk.method({
  8990. selector: "protocol:",
  8991. category: 'accessing',
  8992. fn: function (aString){
  8993. var self=this;
  8994. return smalltalk.withContext(function($ctx1) {
  8995. self._category_(aString);
  8996. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.CompiledMethod)})},
  8997. args: ["aString"],
  8998. source: "protocol: aString\x0a\x09self category: aString",
  8999. messageSends: ["category:"],
  9000. referencedClasses: []
  9001. }),
  9002. smalltalk.CompiledMethod);
  9003. smalltalk.addMethod(
  9004. smalltalk.method({
  9005. selector: "referencedClasses",
  9006. category: 'accessing',
  9007. fn: function (){
  9008. var self=this;
  9009. return smalltalk.withContext(function($ctx1) {
  9010. var $1;
  9011. $1=self._basicAt_("referencedClasses");
  9012. return $1;
  9013. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},smalltalk.CompiledMethod)})},
  9014. args: [],
  9015. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  9016. messageSends: ["basicAt:"],
  9017. referencedClasses: []
  9018. }),
  9019. smalltalk.CompiledMethod);
  9020. smalltalk.addMethod(
  9021. smalltalk.method({
  9022. selector: "selector",
  9023. category: 'accessing',
  9024. fn: function (){
  9025. var self=this;
  9026. return smalltalk.withContext(function($ctx1) {
  9027. var $1;
  9028. $1=self._basicAt_("selector");
  9029. return $1;
  9030. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.CompiledMethod)})},
  9031. args: [],
  9032. source: "selector\x0a\x09^self basicAt: 'selector'",
  9033. messageSends: ["basicAt:"],
  9034. referencedClasses: []
  9035. }),
  9036. smalltalk.CompiledMethod);
  9037. smalltalk.addMethod(
  9038. smalltalk.method({
  9039. selector: "selector:",
  9040. category: 'accessing',
  9041. fn: function (aString){
  9042. var self=this;
  9043. return smalltalk.withContext(function($ctx1) {
  9044. self._basicAt_put_("selector",aString);
  9045. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.CompiledMethod)})},
  9046. args: ["aString"],
  9047. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  9048. messageSends: ["basicAt:put:"],
  9049. referencedClasses: []
  9050. }),
  9051. smalltalk.CompiledMethod);
  9052. smalltalk.addMethod(
  9053. smalltalk.method({
  9054. selector: "source",
  9055. category: 'accessing',
  9056. fn: function (){
  9057. var self=this;
  9058. return smalltalk.withContext(function($ctx1) {
  9059. var $2,$1;
  9060. $2=self._basicAt_("source");
  9061. if(($receiver = $2) == nil || $receiver == undefined){
  9062. $1="";
  9063. } else {
  9064. $1=$2;
  9065. };
  9066. return $1;
  9067. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.CompiledMethod)})},
  9068. args: [],
  9069. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  9070. messageSends: ["ifNil:", "basicAt:"],
  9071. referencedClasses: []
  9072. }),
  9073. smalltalk.CompiledMethod);
  9074. smalltalk.addMethod(
  9075. smalltalk.method({
  9076. selector: "source:",
  9077. category: 'accessing',
  9078. fn: function (aString){
  9079. var self=this;
  9080. return smalltalk.withContext(function($ctx1) {
  9081. self._basicAt_put_("source",aString);
  9082. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.CompiledMethod)})},
  9083. args: ["aString"],
  9084. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  9085. messageSends: ["basicAt:put:"],
  9086. referencedClasses: []
  9087. }),
  9088. smalltalk.CompiledMethod);
  9089. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  9090. 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`";
  9091. smalltalk.addMethod(
  9092. smalltalk.method({
  9093. selector: "addWorker",
  9094. category: 'private',
  9095. fn: function (){
  9096. var self=this;
  9097. return smalltalk.withContext(function($ctx1) {
  9098. _st(self["@worker"])._valueWithTimeout_((0));
  9099. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  9100. return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},smalltalk.ForkPool)})},
  9101. args: [],
  9102. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  9103. messageSends: ["valueWithTimeout:", "+"],
  9104. referencedClasses: []
  9105. }),
  9106. smalltalk.ForkPool);
  9107. smalltalk.addMethod(
  9108. smalltalk.method({
  9109. selector: "defaultMaxPoolSize",
  9110. category: 'defaults',
  9111. fn: function (){
  9112. var self=this;
  9113. return smalltalk.withContext(function($ctx1) {
  9114. var $1;
  9115. $1=_st(self._class())._defaultMaxPoolSize();
  9116. return $1;
  9117. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool)})},
  9118. args: [],
  9119. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  9120. messageSends: ["defaultMaxPoolSize", "class"],
  9121. referencedClasses: []
  9122. }),
  9123. smalltalk.ForkPool);
  9124. smalltalk.addMethod(
  9125. smalltalk.method({
  9126. selector: "fork:",
  9127. category: 'actions',
  9128. fn: function (aBlock){
  9129. var self=this;
  9130. return smalltalk.withContext(function($ctx1) {
  9131. var $1;
  9132. $1=_st(self["@poolSize"]).__lt(self._maxPoolSize());
  9133. if(smalltalk.assert($1)){
  9134. self._addWorker();
  9135. };
  9136. _st(self["@queue"])._nextPut_(aBlock);
  9137. return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},smalltalk.ForkPool)})},
  9138. args: ["aBlock"],
  9139. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  9140. messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "nextPut:"],
  9141. referencedClasses: []
  9142. }),
  9143. smalltalk.ForkPool);
  9144. smalltalk.addMethod(
  9145. smalltalk.method({
  9146. selector: "initialize",
  9147. category: 'initialization',
  9148. fn: function (){
  9149. var self=this;
  9150. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  9151. return smalltalk.withContext(function($ctx1) {
  9152. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  9153. self["@poolSize"]=(0);
  9154. self["@queue"]=_st($Queue())._new();
  9155. self["@worker"]=self._makeWorker();
  9156. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ForkPool)})},
  9157. args: [],
  9158. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  9159. messageSends: ["initialize", "new", "makeWorker"],
  9160. referencedClasses: ["Queue"]
  9161. }),
  9162. smalltalk.ForkPool);
  9163. smalltalk.addMethod(
  9164. smalltalk.method({
  9165. selector: "makeWorker",
  9166. category: 'initialization',
  9167. fn: function (){
  9168. var self=this;
  9169. var sentinel;
  9170. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  9171. return smalltalk.withContext(function($ctx1) {
  9172. var $2,$1;
  9173. sentinel=_st($Object())._new();
  9174. $1=(function(){
  9175. var block;
  9176. return smalltalk.withContext(function($ctx2) {
  9177. self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  9178. self["@poolSize"];
  9179. block=_st(self["@queue"])._nextIfAbsent_((function(){
  9180. return smalltalk.withContext(function($ctx3) {
  9181. return sentinel;
  9182. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  9183. block;
  9184. $2=_st(block).__eq_eq(sentinel);
  9185. if(! smalltalk.assert($2)){
  9186. return _st((function(){
  9187. return smalltalk.withContext(function($ctx3) {
  9188. return _st(block)._value();
  9189. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._ensure_((function(){
  9190. return smalltalk.withContext(function($ctx3) {
  9191. return self._addWorker();
  9192. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  9193. };
  9194. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1)})});
  9195. return $1;
  9196. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},smalltalk.ForkPool)})},
  9197. args: [],
  9198. 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 ]]]",
  9199. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
  9200. referencedClasses: ["Object"]
  9201. }),
  9202. smalltalk.ForkPool);
  9203. smalltalk.addMethod(
  9204. smalltalk.method({
  9205. selector: "maxPoolSize",
  9206. category: 'accessing',
  9207. fn: function (){
  9208. var self=this;
  9209. return smalltalk.withContext(function($ctx1) {
  9210. var $2,$1;
  9211. $2=self["@maxPoolSize"];
  9212. if(($receiver = $2) == nil || $receiver == undefined){
  9213. $1=self._defaultMaxPoolSize();
  9214. } else {
  9215. $1=$2;
  9216. };
  9217. return $1;
  9218. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},smalltalk.ForkPool)})},
  9219. args: [],
  9220. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  9221. messageSends: ["ifNil:", "defaultMaxPoolSize"],
  9222. referencedClasses: []
  9223. }),
  9224. smalltalk.ForkPool);
  9225. smalltalk.addMethod(
  9226. smalltalk.method({
  9227. selector: "maxPoolSize:",
  9228. category: 'accessing',
  9229. fn: function (anInteger){
  9230. var self=this;
  9231. return smalltalk.withContext(function($ctx1) {
  9232. self["@maxPoolSize"]=anInteger;
  9233. return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger},smalltalk.ForkPool)})},
  9234. args: ["anInteger"],
  9235. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  9236. messageSends: [],
  9237. referencedClasses: []
  9238. }),
  9239. smalltalk.ForkPool);
  9240. smalltalk.ForkPool.klass.iVarNames = ['default'];
  9241. smalltalk.addMethod(
  9242. smalltalk.method({
  9243. selector: "default",
  9244. category: 'accessing',
  9245. fn: function (){
  9246. var self=this;
  9247. return smalltalk.withContext(function($ctx1) {
  9248. var $2,$1;
  9249. $2=self["@default"];
  9250. if(($receiver = $2) == nil || $receiver == undefined){
  9251. self["@default"]=self._new();
  9252. $1=self["@default"];
  9253. } else {
  9254. $1=$2;
  9255. };
  9256. return $1;
  9257. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.ForkPool.klass)})},
  9258. args: [],
  9259. source: "default\x0a\x09^default ifNil: [ default := self new ]",
  9260. messageSends: ["ifNil:", "new"],
  9261. referencedClasses: []
  9262. }),
  9263. smalltalk.ForkPool.klass);
  9264. smalltalk.addMethod(
  9265. smalltalk.method({
  9266. selector: "defaultMaxPoolSize",
  9267. category: 'accessing',
  9268. fn: function (){
  9269. var self=this;
  9270. return smalltalk.withContext(function($ctx1) {
  9271. return (100);
  9272. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool.klass)})},
  9273. args: [],
  9274. source: "defaultMaxPoolSize\x0a\x09^100",
  9275. messageSends: [],
  9276. referencedClasses: []
  9277. }),
  9278. smalltalk.ForkPool.klass);
  9279. smalltalk.addMethod(
  9280. smalltalk.method({
  9281. selector: "resetDefault",
  9282. category: 'accessing',
  9283. fn: function (){
  9284. var self=this;
  9285. return smalltalk.withContext(function($ctx1) {
  9286. self["@default"]=nil;
  9287. return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{},smalltalk.ForkPool.klass)})},
  9288. args: [],
  9289. source: "resetDefault\x0a\x09default := nil",
  9290. messageSends: [],
  9291. referencedClasses: []
  9292. }),
  9293. smalltalk.ForkPool.klass);
  9294. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  9295. 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.";
  9296. smalltalk.addMethod(
  9297. smalltalk.method({
  9298. selector: "arguments",
  9299. category: 'accessing',
  9300. fn: function (){
  9301. var self=this;
  9302. return smalltalk.withContext(function($ctx1) {
  9303. var $1;
  9304. $1=self["@arguments"];
  9305. return $1;
  9306. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.Message)})},
  9307. args: [],
  9308. source: "arguments\x0a\x09^arguments",
  9309. messageSends: [],
  9310. referencedClasses: []
  9311. }),
  9312. smalltalk.Message);
  9313. smalltalk.addMethod(
  9314. smalltalk.method({
  9315. selector: "arguments:",
  9316. category: 'accessing',
  9317. fn: function (anArray){
  9318. var self=this;
  9319. return smalltalk.withContext(function($ctx1) {
  9320. self["@arguments"]=anArray;
  9321. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray},smalltalk.Message)})},
  9322. args: ["anArray"],
  9323. source: "arguments: anArray\x0a\x09arguments := anArray",
  9324. messageSends: [],
  9325. referencedClasses: []
  9326. }),
  9327. smalltalk.Message);
  9328. smalltalk.addMethod(
  9329. smalltalk.method({
  9330. selector: "printOn:",
  9331. category: 'printing',
  9332. fn: function (aStream){
  9333. var self=this;
  9334. return smalltalk.withContext(function($ctx1) {
  9335. var $1,$2;
  9336. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  9337. $1=aStream;
  9338. _st($1)._nextPutAll_("(");
  9339. _st($1)._nextPutAll_(self._selector());
  9340. $2=_st($1)._nextPutAll_(")");
  9341. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Message)})},
  9342. args: ["aStream"],
  9343. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  9344. messageSends: ["printOn:", "nextPutAll:", "selector"],
  9345. referencedClasses: []
  9346. }),
  9347. smalltalk.Message);
  9348. smalltalk.addMethod(
  9349. smalltalk.method({
  9350. selector: "selector",
  9351. category: 'accessing',
  9352. fn: function (){
  9353. var self=this;
  9354. return smalltalk.withContext(function($ctx1) {
  9355. var $1;
  9356. $1=self["@selector"];
  9357. return $1;
  9358. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.Message)})},
  9359. args: [],
  9360. source: "selector\x0a\x09^selector",
  9361. messageSends: [],
  9362. referencedClasses: []
  9363. }),
  9364. smalltalk.Message);
  9365. smalltalk.addMethod(
  9366. smalltalk.method({
  9367. selector: "selector:",
  9368. category: 'accessing',
  9369. fn: function (aString){
  9370. var self=this;
  9371. return smalltalk.withContext(function($ctx1) {
  9372. self["@selector"]=aString;
  9373. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.Message)})},
  9374. args: ["aString"],
  9375. source: "selector: aString\x0a\x09selector := aString",
  9376. messageSends: [],
  9377. referencedClasses: []
  9378. }),
  9379. smalltalk.Message);
  9380. smalltalk.addMethod(
  9381. smalltalk.method({
  9382. selector: "sendTo:",
  9383. category: 'actions',
  9384. fn: function (anObject){
  9385. var self=this;
  9386. return smalltalk.withContext(function($ctx1) {
  9387. var $1;
  9388. $1=_st(anObject)._perform_withArguments_(self._selector(),self._arguments());
  9389. return $1;
  9390. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},smalltalk.Message)})},
  9391. args: ["anObject"],
  9392. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  9393. messageSends: ["perform:withArguments:", "selector", "arguments"],
  9394. referencedClasses: []
  9395. }),
  9396. smalltalk.Message);
  9397. smalltalk.addMethod(
  9398. smalltalk.method({
  9399. selector: "selector:arguments:",
  9400. category: 'instance creation',
  9401. fn: function (aString,anArray){
  9402. var self=this;
  9403. return smalltalk.withContext(function($ctx1) {
  9404. var $2,$3,$1;
  9405. $2=self._new();
  9406. _st($2)._selector_(aString);
  9407. _st($2)._arguments_(anArray);
  9408. $3=_st($2)._yourself();
  9409. $1=$3;
  9410. return $1;
  9411. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},smalltalk.Message.klass)})},
  9412. args: ["aString", "anArray"],
  9413. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  9414. messageSends: ["selector:", "new", "arguments:", "yourself"],
  9415. referencedClasses: []
  9416. }),
  9417. smalltalk.Message.klass);
  9418. smalltalk.addClass('MessageSend', smalltalk.Object, ['receiver', 'message'], 'Kernel-Methods');
  9419. 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.";
  9420. smalltalk.addMethod(
  9421. smalltalk.method({
  9422. selector: "arguments",
  9423. category: 'accessing',
  9424. fn: function (){
  9425. var self=this;
  9426. return smalltalk.withContext(function($ctx1) {
  9427. var $1;
  9428. $1=_st(self["@message"])._arguments();
  9429. return $1;
  9430. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.MessageSend)})},
  9431. args: [],
  9432. source: "arguments\x0a\x09^ message arguments",
  9433. messageSends: ["arguments"],
  9434. referencedClasses: []
  9435. }),
  9436. smalltalk.MessageSend);
  9437. smalltalk.addMethod(
  9438. smalltalk.method({
  9439. selector: "arguments:",
  9440. category: 'accessing',
  9441. fn: function (aCollection){
  9442. var self=this;
  9443. return smalltalk.withContext(function($ctx1) {
  9444. _st(self["@message"])._arguments_(aCollection);
  9445. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
  9446. args: ["aCollection"],
  9447. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  9448. messageSends: ["arguments:"],
  9449. referencedClasses: []
  9450. }),
  9451. smalltalk.MessageSend);
  9452. smalltalk.addMethod(
  9453. smalltalk.method({
  9454. selector: "initialize",
  9455. category: 'initialization',
  9456. fn: function (){
  9457. var self=this;
  9458. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  9459. return smalltalk.withContext(function($ctx1) {
  9460. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  9461. self["@message"]=_st($Message())._new();
  9462. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MessageSend)})},
  9463. args: [],
  9464. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  9465. messageSends: ["initialize", "new"],
  9466. referencedClasses: ["Message"]
  9467. }),
  9468. smalltalk.MessageSend);
  9469. smalltalk.addMethod(
  9470. smalltalk.method({
  9471. selector: "printOn:",
  9472. category: 'printing',
  9473. fn: function (aStream){
  9474. var self=this;
  9475. return smalltalk.withContext(function($ctx1) {
  9476. var $1,$2;
  9477. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  9478. $1=aStream;
  9479. _st($1)._nextPutAll_("(");
  9480. _st($1)._nextPutAll_(self._receiver());
  9481. _st($1)._nextPutAll_(" >> ");
  9482. _st($1)._nextPutAll_(self._selector());
  9483. $2=_st($1)._nextPutAll_(")");
  9484. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MessageSend)})},
  9485. args: ["aStream"],
  9486. 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: ')'",
  9487. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"],
  9488. referencedClasses: []
  9489. }),
  9490. smalltalk.MessageSend);
  9491. smalltalk.addMethod(
  9492. smalltalk.method({
  9493. selector: "receiver",
  9494. category: 'accessing',
  9495. fn: function (){
  9496. var self=this;
  9497. return smalltalk.withContext(function($ctx1) {
  9498. var $1;
  9499. $1=self["@receiver"];
  9500. return $1;
  9501. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageSend)})},
  9502. args: [],
  9503. source: "receiver\x0a\x09^ receiver",
  9504. messageSends: [],
  9505. referencedClasses: []
  9506. }),
  9507. smalltalk.MessageSend);
  9508. smalltalk.addMethod(
  9509. smalltalk.method({
  9510. selector: "receiver:",
  9511. category: 'accessing',
  9512. fn: function (anObject){
  9513. var self=this;
  9514. return smalltalk.withContext(function($ctx1) {
  9515. self["@receiver"]=anObject;
  9516. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageSend)})},
  9517. args: ["anObject"],
  9518. source: "receiver: anObject\x0a\x09receiver := anObject",
  9519. messageSends: [],
  9520. referencedClasses: []
  9521. }),
  9522. smalltalk.MessageSend);
  9523. smalltalk.addMethod(
  9524. smalltalk.method({
  9525. selector: "selector",
  9526. category: 'accessing',
  9527. fn: function (){
  9528. var self=this;
  9529. return smalltalk.withContext(function($ctx1) {
  9530. var $1;
  9531. $1=_st(self["@message"])._selector();
  9532. return $1;
  9533. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MessageSend)})},
  9534. args: [],
  9535. source: "selector\x0a\x09^ message selector",
  9536. messageSends: ["selector"],
  9537. referencedClasses: []
  9538. }),
  9539. smalltalk.MessageSend);
  9540. smalltalk.addMethod(
  9541. smalltalk.method({
  9542. selector: "selector:",
  9543. category: 'accessing',
  9544. fn: function (aString){
  9545. var self=this;
  9546. return smalltalk.withContext(function($ctx1) {
  9547. _st(self["@message"])._selector_(aString);
  9548. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.MessageSend)})},
  9549. args: ["aString"],
  9550. source: "selector: aString\x0a\x09message selector: aString",
  9551. messageSends: ["selector:"],
  9552. referencedClasses: []
  9553. }),
  9554. smalltalk.MessageSend);
  9555. smalltalk.addMethod(
  9556. smalltalk.method({
  9557. selector: "value",
  9558. category: 'evaluating',
  9559. fn: function (){
  9560. var self=this;
  9561. return smalltalk.withContext(function($ctx1) {
  9562. var $1;
  9563. $1=_st(self["@message"])._sendTo_(self._receiver());
  9564. return $1;
  9565. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.MessageSend)})},
  9566. args: [],
  9567. source: "value\x0a\x09^ message sendTo: self receiver",
  9568. messageSends: ["sendTo:", "receiver"],
  9569. referencedClasses: []
  9570. }),
  9571. smalltalk.MessageSend);
  9572. smalltalk.addMethod(
  9573. smalltalk.method({
  9574. selector: "value:",
  9575. category: 'evaluating',
  9576. fn: function (anObject){
  9577. var self=this;
  9578. return smalltalk.withContext(function($ctx1) {
  9579. var $2,$3,$1;
  9580. $2=self["@message"];
  9581. _st($2)._arguments_([anObject]);
  9582. $3=_st($2)._sendTo_(self._receiver());
  9583. $1=$3;
  9584. return $1;
  9585. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.MessageSend)})},
  9586. args: ["anObject"],
  9587. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9588. messageSends: ["arguments:", "sendTo:", "receiver"],
  9589. referencedClasses: []
  9590. }),
  9591. smalltalk.MessageSend);
  9592. smalltalk.addMethod(
  9593. smalltalk.method({
  9594. selector: "value:value:",
  9595. category: 'evaluating',
  9596. fn: function (firstArgument,secondArgument){
  9597. var self=this;
  9598. return smalltalk.withContext(function($ctx1) {
  9599. var $2,$3,$1;
  9600. $2=self["@message"];
  9601. _st($2)._arguments_([firstArgument,secondArgument]);
  9602. $3=_st($2)._sendTo_(self._receiver());
  9603. $1=$3;
  9604. return $1;
  9605. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},smalltalk.MessageSend)})},
  9606. args: ["firstArgument", "secondArgument"],
  9607. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9608. messageSends: ["arguments:", "sendTo:", "receiver"],
  9609. referencedClasses: []
  9610. }),
  9611. smalltalk.MessageSend);
  9612. smalltalk.addMethod(
  9613. smalltalk.method({
  9614. selector: "value:value:value:",
  9615. category: 'evaluating',
  9616. fn: function (firstArgument,secondArgument,thirdArgument){
  9617. var self=this;
  9618. return smalltalk.withContext(function($ctx1) {
  9619. var $2,$3,$1;
  9620. $2=self["@message"];
  9621. _st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9622. $3=_st($2)._sendTo_(self._receiver());
  9623. $1=$3;
  9624. return $1;
  9625. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},smalltalk.MessageSend)})},
  9626. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9627. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9628. messageSends: ["arguments:", "sendTo:", "receiver"],
  9629. referencedClasses: []
  9630. }),
  9631. smalltalk.MessageSend);
  9632. smalltalk.addMethod(
  9633. smalltalk.method({
  9634. selector: "valueWithPossibleArguments:",
  9635. category: 'evaluating',
  9636. fn: function (aCollection){
  9637. var self=this;
  9638. return smalltalk.withContext(function($ctx1) {
  9639. var $1;
  9640. self._arguments_(aCollection);
  9641. $1=self._value();
  9642. return $1;
  9643. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
  9644. args: ["aCollection"],
  9645. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9646. messageSends: ["arguments:", "value"],
  9647. referencedClasses: []
  9648. }),
  9649. smalltalk.MessageSend);
  9650. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  9651. 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`.";
  9652. smalltalk.addMethod(
  9653. smalltalk.method({
  9654. selector: "asString",
  9655. category: 'converting',
  9656. fn: function (){
  9657. var self=this;
  9658. return smalltalk.withContext(function($ctx1) {
  9659. var $2,$1;
  9660. $2=self._isBlockContext();
  9661. if(smalltalk.assert($2)){
  9662. $1=_st("a block (in ".__comma(_st(self._methodContext())._asString())).__comma(")");
  9663. } else {
  9664. $1=_st(_st(_st(_st(self._receiver())._class())._name()).__comma(" >> ")).__comma(self._selector());
  9665. };
  9666. return $1;
  9667. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.MethodContext)})},
  9668. args: [],
  9669. source: "asString\x0a\x09^self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ self receiver class name, ' >> ', self selector ]",
  9670. messageSends: ["ifTrue:ifFalse:", ",", "asString", "methodContext", "selector", "name", "class", "receiver", "isBlockContext"],
  9671. referencedClasses: []
  9672. }),
  9673. smalltalk.MethodContext);
  9674. smalltalk.addMethod(
  9675. smalltalk.method({
  9676. selector: "home",
  9677. category: 'accessing',
  9678. fn: function (){
  9679. var self=this;
  9680. return smalltalk.withContext(function($ctx1) {
  9681. return self.homeContext;
  9682. return self}, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.MethodContext)})},
  9683. args: [],
  9684. source: "home\x0a\x09<return self.homeContext>",
  9685. messageSends: [],
  9686. referencedClasses: []
  9687. }),
  9688. smalltalk.MethodContext);
  9689. smalltalk.addMethod(
  9690. smalltalk.method({
  9691. selector: "isBlockContext",
  9692. category: 'testing',
  9693. fn: function (){
  9694. var self=this;
  9695. return smalltalk.withContext(function($ctx1) {
  9696. var $1;
  9697. $1=_st(self._selector())._isNil();
  9698. return $1;
  9699. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.MethodContext)})},
  9700. args: [],
  9701. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9702. messageSends: ["isNil", "selector"],
  9703. referencedClasses: []
  9704. }),
  9705. smalltalk.MethodContext);
  9706. smalltalk.addMethod(
  9707. smalltalk.method({
  9708. selector: "locals",
  9709. category: 'accessing',
  9710. fn: function (){
  9711. var self=this;
  9712. return smalltalk.withContext(function($ctx1) {
  9713. return self.locals || {};
  9714. return self}, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.MethodContext)})},
  9715. args: [],
  9716. source: "locals\x0a\x09<return self.locals || {}>",
  9717. messageSends: [],
  9718. referencedClasses: []
  9719. }),
  9720. smalltalk.MethodContext);
  9721. smalltalk.addMethod(
  9722. smalltalk.method({
  9723. selector: "method",
  9724. category: 'accessing',
  9725. fn: function (){
  9726. var self=this;
  9727. return smalltalk.withContext(function($ctx1) {
  9728. var $2,$1;
  9729. $2=self._methodContext();
  9730. if(($receiver = $2) == nil || $receiver == undefined){
  9731. $1=$2;
  9732. } else {
  9733. $1=_st(_st(_st(self._methodContext())._receiver())._class())._lookupSelector_(_st(self._methodContext())._selector());
  9734. };
  9735. return $1;
  9736. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodContext)})},
  9737. args: [],
  9738. source: "method\x0a\x09^ self methodContext ifNotNil: [\x0a\x09\x09self methodContext receiver class lookupSelector: self methodContext selector ]",
  9739. messageSends: ["ifNotNil:", "lookupSelector:", "selector", "methodContext", "class", "receiver"],
  9740. referencedClasses: []
  9741. }),
  9742. smalltalk.MethodContext);
  9743. smalltalk.addMethod(
  9744. smalltalk.method({
  9745. selector: "methodContext",
  9746. category: 'accessing',
  9747. fn: function (){
  9748. var self=this;
  9749. return smalltalk.withContext(function($ctx1) {
  9750. var $1,$2,$4,$3;
  9751. $1=self._isBlockContext();
  9752. if(! smalltalk.assert($1)){
  9753. $2=self;
  9754. return $2;
  9755. };
  9756. $4=self._home();
  9757. if(($receiver = $4) == nil || $receiver == undefined){
  9758. $3=$4;
  9759. } else {
  9760. var home;
  9761. home=$receiver;
  9762. $3=_st(home)._methodContext();
  9763. };
  9764. return $3;
  9765. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.MethodContext)})},
  9766. args: [],
  9767. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self home ifNotNil: [ :home |\x0a\x09\x09home methodContext ]",
  9768. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "methodContext", "home"],
  9769. referencedClasses: []
  9770. }),
  9771. smalltalk.MethodContext);
  9772. smalltalk.addMethod(
  9773. smalltalk.method({
  9774. selector: "outerContext",
  9775. category: 'accessing',
  9776. fn: function (){
  9777. var self=this;
  9778. return smalltalk.withContext(function($ctx1) {
  9779. return self.outerContext || self.homeContext;
  9780. return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.MethodContext)})},
  9781. args: [],
  9782. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9783. messageSends: [],
  9784. referencedClasses: []
  9785. }),
  9786. smalltalk.MethodContext);
  9787. smalltalk.addMethod(
  9788. smalltalk.method({
  9789. selector: "pc",
  9790. category: 'accessing',
  9791. fn: function (){
  9792. var self=this;
  9793. return smalltalk.withContext(function($ctx1) {
  9794. return self.pc;
  9795. return self}, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.MethodContext)})},
  9796. args: [],
  9797. source: "pc\x0a\x09<return self.pc>",
  9798. messageSends: [],
  9799. referencedClasses: []
  9800. }),
  9801. smalltalk.MethodContext);
  9802. smalltalk.addMethod(
  9803. smalltalk.method({
  9804. selector: "printOn:",
  9805. category: 'printing',
  9806. fn: function (aStream){
  9807. var self=this;
  9808. return smalltalk.withContext(function($ctx1) {
  9809. var $1,$2;
  9810. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  9811. $1=aStream;
  9812. _st($1)._nextPutAll_("(");
  9813. _st($1)._nextPutAll_(self._asString());
  9814. $2=_st($1)._nextPutAll_(")");
  9815. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MethodContext)})},
  9816. args: ["aStream"],
  9817. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9818. messageSends: ["printOn:", "nextPutAll:", "asString"],
  9819. referencedClasses: []
  9820. }),
  9821. smalltalk.MethodContext);
  9822. smalltalk.addMethod(
  9823. smalltalk.method({
  9824. selector: "receiver",
  9825. category: 'accessing',
  9826. fn: function (){
  9827. var self=this;
  9828. return smalltalk.withContext(function($ctx1) {
  9829. return self.receiver;
  9830. return self}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MethodContext)})},
  9831. args: [],
  9832. source: "receiver\x0a\x09<return self.receiver>",
  9833. messageSends: [],
  9834. referencedClasses: []
  9835. }),
  9836. smalltalk.MethodContext);
  9837. smalltalk.addMethod(
  9838. smalltalk.method({
  9839. selector: "selector",
  9840. category: 'accessing',
  9841. fn: function (){
  9842. var self=this;
  9843. return smalltalk.withContext(function($ctx1) {
  9844. if(self.selector) {
  9845. return smalltalk.convertSelector(self.selector);
  9846. } else {
  9847. return nil;
  9848. }
  9849. ;
  9850. return self}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodContext)})},
  9851. args: [],
  9852. 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>",
  9853. messageSends: [],
  9854. referencedClasses: []
  9855. }),
  9856. smalltalk.MethodContext);
  9857. smalltalk.addMethod(
  9858. smalltalk.method({
  9859. selector: "temps",
  9860. category: 'accessing',
  9861. fn: function (){
  9862. var self=this;
  9863. return smalltalk.withContext(function($ctx1) {
  9864. var $1;
  9865. self._deprecatedAPI();
  9866. $1=self._locals();
  9867. return $1;
  9868. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.MethodContext)})},
  9869. args: [],
  9870. source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
  9871. messageSends: ["deprecatedAPI", "locals"],
  9872. referencedClasses: []
  9873. }),
  9874. smalltalk.MethodContext);
  9875. smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods');
  9876. 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' ]";
  9877. smalltalk.addMethod(
  9878. smalltalk.method({
  9879. selector: "constructor:",
  9880. category: 'instance creation',
  9881. fn: function (aString){
  9882. var self=this;
  9883. return smalltalk.withContext(function($ctx1) {
  9884. var native=eval(aString);
  9885. return new native();
  9886. ;
  9887. return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},smalltalk.NativeFunction.klass)})},
  9888. args: ["aString"],
  9889. source: "constructor: aString\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native();\x0a\x09>",
  9890. messageSends: [],
  9891. referencedClasses: []
  9892. }),
  9893. smalltalk.NativeFunction.klass);
  9894. smalltalk.addMethod(
  9895. smalltalk.method({
  9896. selector: "constructor:value:",
  9897. category: 'instance creation',
  9898. fn: function (aString,anObject){
  9899. var self=this;
  9900. return smalltalk.withContext(function($ctx1) {
  9901. var native=eval(aString);
  9902. return new native(anObject);
  9903. ;
  9904. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},smalltalk.NativeFunction.klass)})},
  9905. args: ["aString", "anObject"],
  9906. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject);\x0a\x09>",
  9907. messageSends: [],
  9908. referencedClasses: []
  9909. }),
  9910. smalltalk.NativeFunction.klass);
  9911. smalltalk.addMethod(
  9912. smalltalk.method({
  9913. selector: "constructor:value:value:",
  9914. category: 'instance creation',
  9915. fn: function (aString,anObject,anObject2){
  9916. var self=this;
  9917. return smalltalk.withContext(function($ctx1) {
  9918. var native=eval(aString);
  9919. return new native(anObject,anObject2);
  9920. ;
  9921. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},smalltalk.NativeFunction.klass)})},
  9922. args: ["aString", "anObject", "anObject2"],
  9923. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2);\x0a\x09>",
  9924. messageSends: [],
  9925. referencedClasses: []
  9926. }),
  9927. smalltalk.NativeFunction.klass);
  9928. smalltalk.addMethod(
  9929. smalltalk.method({
  9930. selector: "constructor:value:value:value:",
  9931. category: 'instance creation',
  9932. fn: function (aString,anObject,anObject2,anObject3){
  9933. var self=this;
  9934. return smalltalk.withContext(function($ctx1) {
  9935. var native=eval(aString);
  9936. return new native(anObject,anObject2, anObject3);
  9937. ;
  9938. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.NativeFunction.klass)})},
  9939. args: ["aString", "anObject", "anObject2", "anObject3"],
  9940. 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>",
  9941. messageSends: [],
  9942. referencedClasses: []
  9943. }),
  9944. smalltalk.NativeFunction.klass);
  9945. smalltalk.addMethod(
  9946. smalltalk.method({
  9947. selector: "exists:",
  9948. category: 'testing',
  9949. fn: function (aString){
  9950. var self=this;
  9951. return smalltalk.withContext(function($ctx1) {
  9952. if(aString in window) {
  9953. return true
  9954. } else {
  9955. return false
  9956. }
  9957. ;
  9958. return self}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},smalltalk.NativeFunction.klass)})},
  9959. args: ["aString"],
  9960. source: "exists: aString\x0a\x09<\x0a\x09\x09if(aString in window) {\x0a\x09\x09\x09return true\x0a\x09\x09} else {\x0a\x09\x09\x09return false\x0a\x09\x09}\x0a\x09>",
  9961. messageSends: [],
  9962. referencedClasses: []
  9963. }),
  9964. smalltalk.NativeFunction.klass);
  9965. smalltalk.addPackage('Kernel-Collections');
  9966. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  9967. 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:`";
  9968. smalltalk.addMethod(
  9969. smalltalk.method({
  9970. selector: "=",
  9971. category: 'comparing',
  9972. fn: function (anAssociation){
  9973. var self=this;
  9974. return smalltalk.withContext(function($ctx1) {
  9975. var $1;
  9976. $1=_st(_st(self._class()).__eq(_st(anAssociation)._class()))._and_((function(){
  9977. return smalltalk.withContext(function($ctx2) {
  9978. return _st(_st(self._key()).__eq(_st(anAssociation)._key()))._and_((function(){
  9979. return smalltalk.withContext(function($ctx3) {
  9980. return _st(self._value()).__eq(_st(anAssociation)._value());
  9981. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  9982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  9983. return $1;
  9984. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},smalltalk.Association)})},
  9985. args: ["anAssociation"],
  9986. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  9987. messageSends: ["and:", "=", "value", "key", "class"],
  9988. referencedClasses: []
  9989. }),
  9990. smalltalk.Association);
  9991. smalltalk.addMethod(
  9992. smalltalk.method({
  9993. selector: "key",
  9994. category: 'accessing',
  9995. fn: function (){
  9996. var self=this;
  9997. return smalltalk.withContext(function($ctx1) {
  9998. var $1;
  9999. $1=self["@key"];
  10000. return $1;
  10001. }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.Association)})},
  10002. args: [],
  10003. source: "key\x0a\x09^key",
  10004. messageSends: [],
  10005. referencedClasses: []
  10006. }),
  10007. smalltalk.Association);
  10008. smalltalk.addMethod(
  10009. smalltalk.method({
  10010. selector: "key:",
  10011. category: 'accessing',
  10012. fn: function (aKey){
  10013. var self=this;
  10014. return smalltalk.withContext(function($ctx1) {
  10015. self["@key"]=aKey;
  10016. return self}, function($ctx1) {$ctx1.fill(self,"key:",{aKey:aKey},smalltalk.Association)})},
  10017. args: ["aKey"],
  10018. source: "key: aKey\x0a\x09key := aKey",
  10019. messageSends: [],
  10020. referencedClasses: []
  10021. }),
  10022. smalltalk.Association);
  10023. smalltalk.addMethod(
  10024. smalltalk.method({
  10025. selector: "printOn:",
  10026. category: 'printing',
  10027. fn: function (aStream){
  10028. var self=this;
  10029. return smalltalk.withContext(function($ctx1) {
  10030. _st(self._key())._printOn_(aStream);
  10031. _st(aStream)._nextPutAll_(" -> ");
  10032. _st(self._value())._printOn_(aStream);
  10033. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Association)})},
  10034. args: ["aStream"],
  10035. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10036. messageSends: ["printOn:", "key", "nextPutAll:", "value"],
  10037. referencedClasses: []
  10038. }),
  10039. smalltalk.Association);
  10040. smalltalk.addMethod(
  10041. smalltalk.method({
  10042. selector: "value",
  10043. category: 'accessing',
  10044. fn: function (){
  10045. var self=this;
  10046. return smalltalk.withContext(function($ctx1) {
  10047. var $1;
  10048. $1=self["@value"];
  10049. return $1;
  10050. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Association)})},
  10051. args: [],
  10052. source: "value\x0a\x09^value",
  10053. messageSends: [],
  10054. referencedClasses: []
  10055. }),
  10056. smalltalk.Association);
  10057. smalltalk.addMethod(
  10058. smalltalk.method({
  10059. selector: "value:",
  10060. category: 'accessing',
  10061. fn: function (aValue){
  10062. var self=this;
  10063. return smalltalk.withContext(function($ctx1) {
  10064. self["@value"]=aValue;
  10065. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue},smalltalk.Association)})},
  10066. args: ["aValue"],
  10067. source: "value: aValue\x0a\x09value := aValue",
  10068. messageSends: [],
  10069. referencedClasses: []
  10070. }),
  10071. smalltalk.Association);
  10072. smalltalk.addMethod(
  10073. smalltalk.method({
  10074. selector: "key:value:",
  10075. category: 'instance creation',
  10076. fn: function (aKey,aValue){
  10077. var self=this;
  10078. return smalltalk.withContext(function($ctx1) {
  10079. var $2,$3,$1;
  10080. $2=self._new();
  10081. _st($2)._key_(aKey);
  10082. _st($2)._value_(aValue);
  10083. $3=_st($2)._yourself();
  10084. $1=$3;
  10085. return $1;
  10086. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},smalltalk.Association.klass)})},
  10087. args: ["aKey", "aValue"],
  10088. source: "key: aKey value: aValue\x0a\x09\x09^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10089. messageSends: ["key:", "new", "value:", "yourself"],
  10090. referencedClasses: []
  10091. }),
  10092. smalltalk.Association.klass);
  10093. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  10094. 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.";
  10095. smalltalk.addMethod(
  10096. smalltalk.method({
  10097. selector: ",",
  10098. category: 'copying',
  10099. fn: function (aCollection){
  10100. var self=this;
  10101. return smalltalk.withContext(function($ctx1) {
  10102. var $2,$3,$1;
  10103. $2=self._copy();
  10104. _st($2)._addAll_(aCollection);
  10105. $3=_st($2)._yourself();
  10106. $1=$3;
  10107. return $1;
  10108. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.Collection)})},
  10109. args: ["aCollection"],
  10110. source: ", aCollection\x0a\x09^self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10111. messageSends: ["addAll:", "copy", "yourself"],
  10112. referencedClasses: []
  10113. }),
  10114. smalltalk.Collection);
  10115. smalltalk.addMethod(
  10116. smalltalk.method({
  10117. selector: "add:",
  10118. category: 'adding/removing',
  10119. fn: function (anObject){
  10120. var self=this;
  10121. return smalltalk.withContext(function($ctx1) {
  10122. self._subclassResponsibility();
  10123. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Collection)})},
  10124. args: ["anObject"],
  10125. source: "add: anObject\x0a\x09self subclassResponsibility",
  10126. messageSends: ["subclassResponsibility"],
  10127. referencedClasses: []
  10128. }),
  10129. smalltalk.Collection);
  10130. smalltalk.addMethod(
  10131. smalltalk.method({
  10132. selector: "addAll:",
  10133. category: 'adding/removing',
  10134. fn: function (aCollection){
  10135. var self=this;
  10136. return smalltalk.withContext(function($ctx1) {
  10137. var $1;
  10138. _st(aCollection)._do_((function(each){
  10139. return smalltalk.withContext(function($ctx2) {
  10140. return self._add_(each);
  10141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10142. $1=aCollection;
  10143. return $1;
  10144. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},smalltalk.Collection)})},
  10145. args: ["aCollection"],
  10146. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self add: each].\x0a\x09^aCollection",
  10147. messageSends: ["do:", "add:"],
  10148. referencedClasses: []
  10149. }),
  10150. smalltalk.Collection);
  10151. smalltalk.addMethod(
  10152. smalltalk.method({
  10153. selector: "asArray",
  10154. category: 'converting',
  10155. fn: function (){
  10156. var self=this;
  10157. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  10158. return smalltalk.withContext(function($ctx1) {
  10159. var $1;
  10160. $1=_st($Array())._withAll_(self);
  10161. return $1;
  10162. }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Collection)})},
  10163. args: [],
  10164. source: "asArray\x0a\x09^Array withAll: self",
  10165. messageSends: ["withAll:"],
  10166. referencedClasses: ["Array"]
  10167. }),
  10168. smalltalk.Collection);
  10169. smalltalk.addMethod(
  10170. smalltalk.method({
  10171. selector: "asJSON",
  10172. category: 'converting',
  10173. fn: function (){
  10174. var self=this;
  10175. return smalltalk.withContext(function($ctx1) {
  10176. var $1;
  10177. $1=_st(self._asArray())._collect_((function(each){
  10178. return smalltalk.withContext(function($ctx2) {
  10179. return _st(each)._asJSON();
  10180. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10181. return $1;
  10182. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Collection)})},
  10183. args: [],
  10184. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  10185. messageSends: ["collect:", "asJSON", "asArray"],
  10186. referencedClasses: []
  10187. }),
  10188. smalltalk.Collection);
  10189. smalltalk.addMethod(
  10190. smalltalk.method({
  10191. selector: "asOrderedCollection",
  10192. category: 'converting',
  10193. fn: function (){
  10194. var self=this;
  10195. return smalltalk.withContext(function($ctx1) {
  10196. var $1;
  10197. $1=self._asArray();
  10198. return $1;
  10199. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},smalltalk.Collection)})},
  10200. args: [],
  10201. source: "asOrderedCollection\x0a\x09^self asArray",
  10202. messageSends: ["asArray"],
  10203. referencedClasses: []
  10204. }),
  10205. smalltalk.Collection);
  10206. smalltalk.addMethod(
  10207. smalltalk.method({
  10208. selector: "asSet",
  10209. category: 'converting',
  10210. fn: function (){
  10211. var self=this;
  10212. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  10213. return smalltalk.withContext(function($ctx1) {
  10214. var $1;
  10215. $1=_st($Set())._withAll_(self);
  10216. return $1;
  10217. }, function($ctx1) {$ctx1.fill(self,"asSet",{},smalltalk.Collection)})},
  10218. args: [],
  10219. source: "asSet\x0a\x09^Set withAll: self",
  10220. messageSends: ["withAll:"],
  10221. referencedClasses: ["Set"]
  10222. }),
  10223. smalltalk.Collection);
  10224. smalltalk.addMethod(
  10225. smalltalk.method({
  10226. selector: "collect:",
  10227. category: 'enumerating',
  10228. fn: function (aBlock){
  10229. var self=this;
  10230. var stream;
  10231. return smalltalk.withContext(function($ctx1) {
  10232. var $1;
  10233. stream=_st(_st(self._class())._new())._writeStream();
  10234. self._do_((function(each){
  10235. return smalltalk.withContext(function($ctx2) {
  10236. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  10237. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10238. $1=_st(stream)._contents();
  10239. return $1;
  10240. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},smalltalk.Collection)})},
  10241. args: ["aBlock"],
  10242. 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",
  10243. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  10244. referencedClasses: []
  10245. }),
  10246. smalltalk.Collection);
  10247. smalltalk.addMethod(
  10248. smalltalk.method({
  10249. selector: "contains:",
  10250. category: 'testing',
  10251. fn: function (aBlock){
  10252. var self=this;
  10253. return smalltalk.withContext(function($ctx1) {
  10254. var $1;
  10255. var $early={};
  10256. try {
  10257. self._do_((function(each){
  10258. return smalltalk.withContext(function($ctx2) {
  10259. $1=_st(aBlock)._value_(each);
  10260. if(smalltalk.assert($1)){
  10261. throw $early=[true];
  10262. };
  10263. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10264. return false;
  10265. }
  10266. catch(e) {if(e===$early)return e[0]; throw e}
  10267. }, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},smalltalk.Collection)})},
  10268. args: ["aBlock"],
  10269. 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",
  10270. messageSends: ["do:", "ifTrue:", "value:"],
  10271. referencedClasses: []
  10272. }),
  10273. smalltalk.Collection);
  10274. smalltalk.addMethod(
  10275. smalltalk.method({
  10276. selector: "copyWith:",
  10277. category: 'copying',
  10278. fn: function (anObject){
  10279. var self=this;
  10280. return smalltalk.withContext(function($ctx1) {
  10281. var $2,$3,$1;
  10282. $2=self._copy();
  10283. _st($2)._add_(anObject);
  10284. $3=_st($2)._yourself();
  10285. $1=$3;
  10286. return $1;
  10287. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},smalltalk.Collection)})},
  10288. args: ["anObject"],
  10289. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  10290. messageSends: ["add:", "copy", "yourself"],
  10291. referencedClasses: []
  10292. }),
  10293. smalltalk.Collection);
  10294. smalltalk.addMethod(
  10295. smalltalk.method({
  10296. selector: "copyWithAll:",
  10297. category: 'copying',
  10298. fn: function (aCollection){
  10299. var self=this;
  10300. return smalltalk.withContext(function($ctx1) {
  10301. var $2,$3,$1;
  10302. $2=self._copy();
  10303. _st($2)._addAll_(aCollection);
  10304. $3=_st($2)._yourself();
  10305. $1=$3;
  10306. return $1;
  10307. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},smalltalk.Collection)})},
  10308. args: ["aCollection"],
  10309. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  10310. messageSends: ["addAll:", "copy", "yourself"],
  10311. referencedClasses: []
  10312. }),
  10313. smalltalk.Collection);
  10314. smalltalk.addMethod(
  10315. smalltalk.method({
  10316. selector: "copyWithoutAll:",
  10317. category: 'copying',
  10318. fn: function (aCollection){
  10319. var self=this;
  10320. return smalltalk.withContext(function($ctx1) {
  10321. var $1;
  10322. $1=self._reject_((function(each){
  10323. return smalltalk.withContext(function($ctx2) {
  10324. return _st(aCollection)._includes_(each);
  10325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10326. return $1;
  10327. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},smalltalk.Collection)})},
  10328. args: ["aCollection"],
  10329. 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]",
  10330. messageSends: ["reject:", "includes:"],
  10331. referencedClasses: []
  10332. }),
  10333. smalltalk.Collection);
  10334. smalltalk.addMethod(
  10335. smalltalk.method({
  10336. selector: "detect:",
  10337. category: 'enumerating',
  10338. fn: function (aBlock){
  10339. var self=this;
  10340. return smalltalk.withContext(function($ctx1) {
  10341. var $1;
  10342. $1=self._detect_ifNone_(aBlock,(function(){
  10343. return smalltalk.withContext(function($ctx2) {
  10344. return self._errorNotFound();
  10345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10346. return $1;
  10347. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},smalltalk.Collection)})},
  10348. args: ["aBlock"],
  10349. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  10350. messageSends: ["detect:ifNone:", "errorNotFound"],
  10351. referencedClasses: []
  10352. }),
  10353. smalltalk.Collection);
  10354. smalltalk.addMethod(
  10355. smalltalk.method({
  10356. selector: "detect:ifNone:",
  10357. category: 'enumerating',
  10358. fn: function (aBlock,anotherBlock){
  10359. var self=this;
  10360. return smalltalk.withContext(function($ctx1) {
  10361. self._subclassResponsibility();
  10362. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Collection)})},
  10363. args: ["aBlock", "anotherBlock"],
  10364. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10365. messageSends: ["subclassResponsibility"],
  10366. referencedClasses: []
  10367. }),
  10368. smalltalk.Collection);
  10369. smalltalk.addMethod(
  10370. smalltalk.method({
  10371. selector: "do:",
  10372. category: 'enumerating',
  10373. fn: function (aBlock){
  10374. var self=this;
  10375. return smalltalk.withContext(function($ctx1) {
  10376. self._subclassResponsibility();
  10377. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Collection)})},
  10378. args: ["aBlock"],
  10379. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10380. messageSends: ["subclassResponsibility"],
  10381. referencedClasses: []
  10382. }),
  10383. smalltalk.Collection);
  10384. smalltalk.addMethod(
  10385. smalltalk.method({
  10386. selector: "do:separatedBy:",
  10387. category: 'enumerating',
  10388. fn: function (aBlock,anotherBlock){
  10389. var self=this;
  10390. var actionBeforeElement;
  10391. return smalltalk.withContext(function($ctx1) {
  10392. actionBeforeElement=(function(){
  10393. return smalltalk.withContext(function($ctx2) {
  10394. actionBeforeElement=anotherBlock;
  10395. return actionBeforeElement;
  10396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  10397. self._do_((function(each){
  10398. return smalltalk.withContext(function($ctx2) {
  10399. _st(actionBeforeElement)._value();
  10400. return _st(aBlock)._value_(each);
  10401. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10402. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},smalltalk.Collection)})},
  10403. args: ["aBlock", "anotherBlock"],
  10404. 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]",
  10405. messageSends: ["do:", "value", "value:"],
  10406. referencedClasses: []
  10407. }),
  10408. smalltalk.Collection);
  10409. smalltalk.addMethod(
  10410. smalltalk.method({
  10411. selector: "errorNotFound",
  10412. category: 'error handling',
  10413. fn: function (){
  10414. var self=this;
  10415. return smalltalk.withContext(function($ctx1) {
  10416. self._error_("Object is not in the collection");
  10417. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},smalltalk.Collection)})},
  10418. args: [],
  10419. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  10420. messageSends: ["error:"],
  10421. referencedClasses: []
  10422. }),
  10423. smalltalk.Collection);
  10424. smalltalk.addMethod(
  10425. smalltalk.method({
  10426. selector: "ifEmpty:",
  10427. category: 'testing',
  10428. fn: function (aBlock){
  10429. var self=this;
  10430. return smalltalk.withContext(function($ctx1) {
  10431. var $2,$1;
  10432. $2=self._isEmpty();
  10433. if(smalltalk.assert($2)){
  10434. $1=_st(aBlock)._value();
  10435. } else {
  10436. $1=self;
  10437. };
  10438. return $1;
  10439. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},smalltalk.Collection)})},
  10440. args: ["aBlock"],
  10441. 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 ]",
  10442. messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"],
  10443. referencedClasses: []
  10444. }),
  10445. smalltalk.Collection);
  10446. smalltalk.addMethod(
  10447. smalltalk.method({
  10448. selector: "ifNotEmpty:",
  10449. category: 'testing',
  10450. fn: function (aBlock){
  10451. var self=this;
  10452. return smalltalk.withContext(function($ctx1) {
  10453. var $1;
  10454. $1=self._notEmpty();
  10455. _st($1)._ifTrue_(aBlock);
  10456. return self}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},smalltalk.Collection)})},
  10457. args: ["aBlock"],
  10458. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  10459. messageSends: ["ifTrue:", "notEmpty"],
  10460. referencedClasses: []
  10461. }),
  10462. smalltalk.Collection);
  10463. smalltalk.addMethod(
  10464. smalltalk.method({
  10465. selector: "includes:",
  10466. category: 'testing',
  10467. fn: function (anObject){
  10468. var self=this;
  10469. var sentinel;
  10470. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  10471. return smalltalk.withContext(function($ctx1) {
  10472. var $1;
  10473. sentinel=_st($Object())._new();
  10474. $1=_st(self._detect_ifNone_((function(each){
  10475. return smalltalk.withContext(function($ctx2) {
  10476. return _st(each).__eq(anObject);
  10477. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  10478. return smalltalk.withContext(function($ctx2) {
  10479. return sentinel;
  10480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__tild_eq(sentinel);
  10481. return $1;
  10482. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,sentinel:sentinel},smalltalk.Collection)})},
  10483. args: ["anObject"],
  10484. source: "includes: anObject\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel",
  10485. messageSends: ["new", "~=", "detect:ifNone:", "="],
  10486. referencedClasses: ["Object"]
  10487. }),
  10488. smalltalk.Collection);
  10489. smalltalk.addMethod(
  10490. smalltalk.method({
  10491. selector: "inject:into:",
  10492. category: 'enumerating',
  10493. fn: function (anObject,aBlock){
  10494. var self=this;
  10495. var result;
  10496. return smalltalk.withContext(function($ctx1) {
  10497. var $1;
  10498. result=anObject;
  10499. self._do_((function(each){
  10500. return smalltalk.withContext(function($ctx2) {
  10501. result=_st(aBlock)._value_value_(result,each);
  10502. return result;
  10503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10504. $1=result;
  10505. return $1;
  10506. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},smalltalk.Collection)})},
  10507. args: ["anObject", "aBlock"],
  10508. 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",
  10509. messageSends: ["do:", "value:value:"],
  10510. referencedClasses: []
  10511. }),
  10512. smalltalk.Collection);
  10513. smalltalk.addMethod(
  10514. smalltalk.method({
  10515. selector: "intersection:",
  10516. category: 'enumerating',
  10517. fn: function (aCollection){
  10518. var self=this;
  10519. var set,outputSet;
  10520. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  10521. return smalltalk.withContext(function($ctx1) {
  10522. var $1,$2;
  10523. set=self._asSet();
  10524. outputSet=_st($Set())._new();
  10525. _st(aCollection)._do_((function(each){
  10526. return smalltalk.withContext(function($ctx2) {
  10527. $1=_st(_st(set)._includes_(each))._and_((function(){
  10528. return smalltalk.withContext(function($ctx3) {
  10529. return _st(_st(outputSet)._includes_(each))._not();
  10530. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  10531. if(smalltalk.assert($1)){
  10532. return _st(outputSet)._add_(each);
  10533. };
  10534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10535. $2=_st(self._class())._withAll_(_st(outputSet)._asArray());
  10536. return $2;
  10537. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},smalltalk.Collection)})},
  10538. args: ["aCollection"],
  10539. 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",
  10540. messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"],
  10541. referencedClasses: ["Set"]
  10542. }),
  10543. smalltalk.Collection);
  10544. smalltalk.addMethod(
  10545. smalltalk.method({
  10546. selector: "isEmpty",
  10547. category: 'testing',
  10548. fn: function (){
  10549. var self=this;
  10550. return smalltalk.withContext(function($ctx1) {
  10551. var $1;
  10552. $1=_st(self._size()).__eq((0));
  10553. return $1;
  10554. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Collection)})},
  10555. args: [],
  10556. source: "isEmpty\x0a\x09^self size = 0",
  10557. messageSends: ["=", "size"],
  10558. referencedClasses: []
  10559. }),
  10560. smalltalk.Collection);
  10561. smalltalk.addMethod(
  10562. smalltalk.method({
  10563. selector: "notEmpty",
  10564. category: 'testing',
  10565. fn: function (){
  10566. var self=this;
  10567. return smalltalk.withContext(function($ctx1) {
  10568. var $1;
  10569. $1=_st(self._isEmpty())._not();
  10570. return $1;
  10571. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},smalltalk.Collection)})},
  10572. args: [],
  10573. source: "notEmpty\x0a\x09^self isEmpty not",
  10574. messageSends: ["not", "isEmpty"],
  10575. referencedClasses: []
  10576. }),
  10577. smalltalk.Collection);
  10578. smalltalk.addMethod(
  10579. smalltalk.method({
  10580. selector: "occurrencesOf:",
  10581. category: 'accessing',
  10582. fn: function (anObject){
  10583. var self=this;
  10584. var tally;
  10585. return smalltalk.withContext(function($ctx1) {
  10586. var $1,$2;
  10587. tally=(0);
  10588. self._do_((function(each){
  10589. return smalltalk.withContext(function($ctx2) {
  10590. $1=_st(anObject).__eq(each);
  10591. if(smalltalk.assert($1)){
  10592. tally=_st(tally).__plus((1));
  10593. return tally;
  10594. };
  10595. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10596. $2=tally;
  10597. return $2;
  10598. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},smalltalk.Collection)})},
  10599. args: ["anObject"],
  10600. 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",
  10601. messageSends: ["do:", "ifTrue:", "+", "="],
  10602. referencedClasses: []
  10603. }),
  10604. smalltalk.Collection);
  10605. smalltalk.addMethod(
  10606. smalltalk.method({
  10607. selector: "putOn:",
  10608. category: 'streaming',
  10609. fn: function (aStream){
  10610. var self=this;
  10611. return smalltalk.withContext(function($ctx1) {
  10612. self._do_((function(each){
  10613. return smalltalk.withContext(function($ctx2) {
  10614. return _st(each)._putOn_(aStream);
  10615. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10616. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Collection)})},
  10617. args: ["aStream"],
  10618. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  10619. messageSends: ["do:", "putOn:"],
  10620. referencedClasses: []
  10621. }),
  10622. smalltalk.Collection);
  10623. smalltalk.addMethod(
  10624. smalltalk.method({
  10625. selector: "reject:",
  10626. category: 'enumerating',
  10627. fn: function (aBlock){
  10628. var self=this;
  10629. return smalltalk.withContext(function($ctx1) {
  10630. var $1;
  10631. $1=self._select_((function(each){
  10632. return smalltalk.withContext(function($ctx2) {
  10633. return _st(_st(aBlock)._value_(each)).__eq(false);
  10634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10635. return $1;
  10636. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},smalltalk.Collection)})},
  10637. args: ["aBlock"],
  10638. source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
  10639. messageSends: ["select:", "=", "value:"],
  10640. referencedClasses: []
  10641. }),
  10642. smalltalk.Collection);
  10643. smalltalk.addMethod(
  10644. smalltalk.method({
  10645. selector: "remove:",
  10646. category: 'adding/removing',
  10647. fn: function (anObject){
  10648. var self=this;
  10649. return smalltalk.withContext(function($ctx1) {
  10650. var $1;
  10651. $1=self._remove_ifAbsent_(anObject,(function(){
  10652. return smalltalk.withContext(function($ctx2) {
  10653. return self._errorNotFound();
  10654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10655. return $1;
  10656. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Collection)})},
  10657. args: ["anObject"],
  10658. source: "remove: anObject\x0a\x09^self remove: anObject ifAbsent: [self errorNotFound]",
  10659. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  10660. referencedClasses: []
  10661. }),
  10662. smalltalk.Collection);
  10663. smalltalk.addMethod(
  10664. smalltalk.method({
  10665. selector: "remove:ifAbsent:",
  10666. category: 'adding/removing',
  10667. fn: function (anObject,aBlock){
  10668. var self=this;
  10669. return smalltalk.withContext(function($ctx1) {
  10670. self._subclassResponsibility();
  10671. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Collection)})},
  10672. args: ["anObject", "aBlock"],
  10673. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10674. messageSends: ["subclassResponsibility"],
  10675. referencedClasses: []
  10676. }),
  10677. smalltalk.Collection);
  10678. smalltalk.addMethod(
  10679. smalltalk.method({
  10680. selector: "select:",
  10681. category: 'enumerating',
  10682. fn: function (aBlock){
  10683. var self=this;
  10684. var stream;
  10685. return smalltalk.withContext(function($ctx1) {
  10686. var $1,$2;
  10687. stream=_st(_st(self._class())._new())._writeStream();
  10688. self._do_((function(each){
  10689. return smalltalk.withContext(function($ctx2) {
  10690. $1=_st(aBlock)._value_(each);
  10691. if(smalltalk.assert($1)){
  10692. return _st(stream)._nextPut_(each);
  10693. };
  10694. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10695. $2=_st(stream)._contents();
  10696. return $2;
  10697. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},smalltalk.Collection)})},
  10698. args: ["aBlock"],
  10699. 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",
  10700. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"],
  10701. referencedClasses: []
  10702. }),
  10703. smalltalk.Collection);
  10704. smalltalk.addMethod(
  10705. smalltalk.method({
  10706. selector: "size",
  10707. category: 'accessing',
  10708. fn: function (){
  10709. var self=this;
  10710. return smalltalk.withContext(function($ctx1) {
  10711. self._subclassResponsibility();
  10712. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Collection)})},
  10713. args: [],
  10714. source: "size\x0a\x09self subclassResponsibility",
  10715. messageSends: ["subclassResponsibility"],
  10716. referencedClasses: []
  10717. }),
  10718. smalltalk.Collection);
  10719. smalltalk.addMethod(
  10720. smalltalk.method({
  10721. selector: "heliosClass",
  10722. category: 'helios',
  10723. fn: function (){
  10724. var self=this;
  10725. return smalltalk.withContext(function($ctx1) {
  10726. return "collection";
  10727. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Collection.klass)})},
  10728. args: [],
  10729. source: "heliosClass\x0a\x09^ 'collection'",
  10730. messageSends: [],
  10731. referencedClasses: []
  10732. }),
  10733. smalltalk.Collection.klass);
  10734. smalltalk.addMethod(
  10735. smalltalk.method({
  10736. selector: "new:",
  10737. category: 'instance creation',
  10738. fn: function (anInteger){
  10739. var self=this;
  10740. return smalltalk.withContext(function($ctx1) {
  10741. var $1;
  10742. $1=self._new();
  10743. return $1;
  10744. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Collection.klass)})},
  10745. args: ["anInteger"],
  10746. source: "new: anInteger\x0a\x09^self new",
  10747. messageSends: ["new"],
  10748. referencedClasses: []
  10749. }),
  10750. smalltalk.Collection.klass);
  10751. smalltalk.addMethod(
  10752. smalltalk.method({
  10753. selector: "with:",
  10754. category: 'instance creation',
  10755. fn: function (anObject){
  10756. var self=this;
  10757. return smalltalk.withContext(function($ctx1) {
  10758. var $2,$3,$1;
  10759. $2=self._new();
  10760. _st($2)._add_(anObject);
  10761. $3=_st($2)._yourself();
  10762. $1=$3;
  10763. return $1;
  10764. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Collection.klass)})},
  10765. args: ["anObject"],
  10766. source: "with: anObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  10767. messageSends: ["add:", "new", "yourself"],
  10768. referencedClasses: []
  10769. }),
  10770. smalltalk.Collection.klass);
  10771. smalltalk.addMethod(
  10772. smalltalk.method({
  10773. selector: "with:with:",
  10774. category: 'instance creation',
  10775. fn: function (anObject,anotherObject){
  10776. var self=this;
  10777. return smalltalk.withContext(function($ctx1) {
  10778. var $2,$3,$1;
  10779. $2=self._new();
  10780. _st($2)._add_(anObject);
  10781. _st($2)._add_(anotherObject);
  10782. $3=_st($2)._yourself();
  10783. $1=$3;
  10784. return $1;
  10785. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},smalltalk.Collection.klass)})},
  10786. args: ["anObject", "anotherObject"],
  10787. source: "with: anObject with: anotherObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  10788. messageSends: ["add:", "new", "yourself"],
  10789. referencedClasses: []
  10790. }),
  10791. smalltalk.Collection.klass);
  10792. smalltalk.addMethod(
  10793. smalltalk.method({
  10794. selector: "with:with:with:",
  10795. category: 'instance creation',
  10796. fn: function (firstObject,secondObject,thirdObject){
  10797. var self=this;
  10798. return smalltalk.withContext(function($ctx1) {
  10799. var $2,$3,$1;
  10800. $2=self._new();
  10801. _st($2)._add_(firstObject);
  10802. _st($2)._add_(secondObject);
  10803. _st($2)._add_(thirdObject);
  10804. $3=_st($2)._yourself();
  10805. $1=$3;
  10806. return $1;
  10807. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},smalltalk.Collection.klass)})},
  10808. args: ["firstObject", "secondObject", "thirdObject"],
  10809. 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",
  10810. messageSends: ["add:", "new", "yourself"],
  10811. referencedClasses: []
  10812. }),
  10813. smalltalk.Collection.klass);
  10814. smalltalk.addMethod(
  10815. smalltalk.method({
  10816. selector: "withAll:",
  10817. category: 'instance creation',
  10818. fn: function (aCollection){
  10819. var self=this;
  10820. return smalltalk.withContext(function($ctx1) {
  10821. var $2,$3,$1;
  10822. $2=self._new();
  10823. _st($2)._addAll_(aCollection);
  10824. $3=_st($2)._yourself();
  10825. $1=$3;
  10826. return $1;
  10827. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},smalltalk.Collection.klass)})},
  10828. args: ["aCollection"],
  10829. source: "withAll: aCollection\x0a\x09\x09^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10830. messageSends: ["addAll:", "new", "yourself"],
  10831. referencedClasses: []
  10832. }),
  10833. smalltalk.Collection.klass);
  10834. smalltalk.addClass('IndexableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  10835. 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.";
  10836. smalltalk.addMethod(
  10837. smalltalk.method({
  10838. selector: "at:",
  10839. category: 'accessing',
  10840. fn: function (anIndex){
  10841. var self=this;
  10842. return smalltalk.withContext(function($ctx1) {
  10843. var $1;
  10844. $1=self._at_ifAbsent_(anIndex,(function(){
  10845. return smalltalk.withContext(function($ctx2) {
  10846. return self._errorNotFound();
  10847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10848. return $1;
  10849. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},smalltalk.IndexableCollection)})},
  10850. args: ["anIndex"],
  10851. 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 ]",
  10852. messageSends: ["at:ifAbsent:", "errorNotFound"],
  10853. referencedClasses: []
  10854. }),
  10855. smalltalk.IndexableCollection);
  10856. smalltalk.addMethod(
  10857. smalltalk.method({
  10858. selector: "at:ifAbsent:",
  10859. category: 'accessing',
  10860. fn: function (anIndex,aBlock){
  10861. var self=this;
  10862. return smalltalk.withContext(function($ctx1) {
  10863. self._subclassReponsibility();
  10864. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10865. args: ["anIndex", "aBlock"],
  10866. 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",
  10867. messageSends: ["subclassReponsibility"],
  10868. referencedClasses: []
  10869. }),
  10870. smalltalk.IndexableCollection);
  10871. smalltalk.addMethod(
  10872. smalltalk.method({
  10873. selector: "at:ifPresent:",
  10874. category: 'accessing',
  10875. fn: function (anIndex,aBlock){
  10876. var self=this;
  10877. return smalltalk.withContext(function($ctx1) {
  10878. var $1;
  10879. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  10880. return smalltalk.withContext(function($ctx2) {
  10881. return nil;
  10882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10883. return $1;
  10884. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10885. args: ["anIndex", "aBlock"],
  10886. 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 ]",
  10887. messageSends: ["at:ifPresent:ifAbsent:"],
  10888. referencedClasses: []
  10889. }),
  10890. smalltalk.IndexableCollection);
  10891. smalltalk.addMethod(
  10892. smalltalk.method({
  10893. selector: "at:ifPresent:ifAbsent:",
  10894. category: 'accessing',
  10895. fn: function (anIndex,aBlock,anotherBlock){
  10896. var self=this;
  10897. return smalltalk.withContext(function($ctx1) {
  10898. self._subclassResponsibility();
  10899. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.IndexableCollection)})},
  10900. args: ["anIndex", "aBlock", "anotherBlock"],
  10901. 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",
  10902. messageSends: ["subclassResponsibility"],
  10903. referencedClasses: []
  10904. }),
  10905. smalltalk.IndexableCollection);
  10906. smalltalk.addMethod(
  10907. smalltalk.method({
  10908. selector: "at:put:",
  10909. category: 'accessing',
  10910. fn: function (anIndex,anObject){
  10911. var self=this;
  10912. return smalltalk.withContext(function($ctx1) {
  10913. self._subclassReponsibility();
  10914. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.IndexableCollection)})},
  10915. args: ["anIndex", "anObject"],
  10916. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassReponsibility",
  10917. messageSends: ["subclassReponsibility"],
  10918. referencedClasses: []
  10919. }),
  10920. smalltalk.IndexableCollection);
  10921. smalltalk.addMethod(
  10922. smalltalk.method({
  10923. selector: "indexOf:",
  10924. category: 'accessing',
  10925. fn: function (anObject){
  10926. var self=this;
  10927. return smalltalk.withContext(function($ctx1) {
  10928. var $1;
  10929. $1=self._indexOf_ifAbsent_(anObject,(function(){
  10930. return smalltalk.withContext(function($ctx2) {
  10931. return self._errorNotFound();
  10932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10933. return $1;
  10934. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},smalltalk.IndexableCollection)})},
  10935. args: ["anObject"],
  10936. 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 ]",
  10937. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  10938. referencedClasses: []
  10939. }),
  10940. smalltalk.IndexableCollection);
  10941. smalltalk.addMethod(
  10942. smalltalk.method({
  10943. selector: "indexOf:ifAbsent:",
  10944. category: 'accessing',
  10945. fn: function (anObject,aBlock){
  10946. var self=this;
  10947. return smalltalk.withContext(function($ctx1) {
  10948. self._subclassResponsibility();
  10949. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10950. args: ["anObject", "aBlock"],
  10951. 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",
  10952. messageSends: ["subclassResponsibility"],
  10953. referencedClasses: []
  10954. }),
  10955. smalltalk.IndexableCollection);
  10956. smalltalk.addMethod(
  10957. smalltalk.method({
  10958. selector: "with:do:",
  10959. category: 'enumarating',
  10960. fn: function (anotherCollection,aBlock){
  10961. var self=this;
  10962. return smalltalk.withContext(function($ctx1) {
  10963. self._withIndexDo_((function(each,index){
  10964. return smalltalk.withContext(function($ctx2) {
  10965. return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
  10966. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  10967. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10968. args: ["anotherCollection", "aBlock"],
  10969. 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) ]",
  10970. messageSends: ["withIndexDo:", "value:value:", "at:"],
  10971. referencedClasses: []
  10972. }),
  10973. smalltalk.IndexableCollection);
  10974. smalltalk.addMethod(
  10975. smalltalk.method({
  10976. selector: "withIndexDo:",
  10977. category: 'enumarating',
  10978. fn: function (aBlock){
  10979. var self=this;
  10980. return smalltalk.withContext(function($ctx1) {
  10981. self._subclassReponsibility();
  10982. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.IndexableCollection)})},
  10983. args: ["aBlock"],
  10984. 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",
  10985. messageSends: ["subclassReponsibility"],
  10986. referencedClasses: []
  10987. }),
  10988. smalltalk.IndexableCollection);
  10989. smalltalk.addClass('HashedCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
  10990. smalltalk.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  10991. smalltalk.addMethod(
  10992. smalltalk.method({
  10993. selector: ",",
  10994. category: 'copying',
  10995. fn: function (aCollection){
  10996. var self=this;
  10997. return smalltalk.withContext(function($ctx1) {
  10998. self._shouldNotImplement();
  10999. return self}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.HashedCollection)})},
  11000. args: ["aCollection"],
  11001. source: ", aCollection\x0a\x09self shouldNotImplement",
  11002. messageSends: ["shouldNotImplement"],
  11003. referencedClasses: []
  11004. }),
  11005. smalltalk.HashedCollection);
  11006. smalltalk.addMethod(
  11007. smalltalk.method({
  11008. selector: "=",
  11009. category: 'comparing',
  11010. fn: function (aHashedCollection){
  11011. var self=this;
  11012. return smalltalk.withContext(function($ctx1) {
  11013. var $1,$2,$3;
  11014. $1=_st(self._class()).__eq(_st(aHashedCollection)._class());
  11015. if(! smalltalk.assert($1)){
  11016. return false;
  11017. };
  11018. $2=_st(self._size()).__eq(_st(aHashedCollection)._size());
  11019. if(! smalltalk.assert($2)){
  11020. return false;
  11021. };
  11022. $3=_st(self._associations()).__eq(_st(aHashedCollection)._associations());
  11023. return $3;
  11024. }, function($ctx1) {$ctx1.fill(self,"=",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})},
  11025. args: ["aHashedCollection"],
  11026. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  11027. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  11028. referencedClasses: []
  11029. }),
  11030. smalltalk.HashedCollection);
  11031. smalltalk.addMethod(
  11032. smalltalk.method({
  11033. selector: "add:",
  11034. category: 'adding/removing',
  11035. fn: function (anAssociation){
  11036. var self=this;
  11037. return smalltalk.withContext(function($ctx1) {
  11038. self._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  11039. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},smalltalk.HashedCollection)})},
  11040. args: ["anAssociation"],
  11041. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11042. messageSends: ["at:put:", "key", "value"],
  11043. referencedClasses: []
  11044. }),
  11045. smalltalk.HashedCollection);
  11046. smalltalk.addMethod(
  11047. smalltalk.method({
  11048. selector: "addAll:",
  11049. category: 'adding/removing',
  11050. fn: function (aHashedCollection){
  11051. var self=this;
  11052. return smalltalk.withContext(function($ctx1) {
  11053. var $1;
  11054. smalltalk.IndexableCollection.fn.prototype._addAll_.apply(_st(self), [_st(aHashedCollection)._associations()]);
  11055. $1=aHashedCollection;
  11056. return $1;
  11057. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})},
  11058. args: ["aHashedCollection"],
  11059. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  11060. messageSends: ["addAll:", "associations"],
  11061. referencedClasses: []
  11062. }),
  11063. smalltalk.HashedCollection);
  11064. smalltalk.addMethod(
  11065. smalltalk.method({
  11066. selector: "asDictionary",
  11067. category: 'converting',
  11068. fn: function (){
  11069. var self=this;
  11070. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  11071. return smalltalk.withContext(function($ctx1) {
  11072. var $1;
  11073. $1=_st($Dictionary())._from_(self._associations());
  11074. return $1;
  11075. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},smalltalk.HashedCollection)})},
  11076. args: [],
  11077. source: "asDictionary\x0a\x09^Dictionary from: self associations",
  11078. messageSends: ["from:", "associations"],
  11079. referencedClasses: ["Dictionary"]
  11080. }),
  11081. smalltalk.HashedCollection);
  11082. smalltalk.addMethod(
  11083. smalltalk.method({
  11084. selector: "asJSON",
  11085. category: 'converting',
  11086. fn: function (){
  11087. var self=this;
  11088. var c;
  11089. return smalltalk.withContext(function($ctx1) {
  11090. var $1;
  11091. c=_st(self._class())._new();
  11092. self._keysAndValuesDo_((function(key,value){
  11093. return smalltalk.withContext(function($ctx2) {
  11094. return _st(c)._at_put_(key,_st(value)._asJSON());
  11095. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11096. $1=c;
  11097. return $1;
  11098. }, function($ctx1) {$ctx1.fill(self,"asJSON",{c:c},smalltalk.HashedCollection)})},
  11099. args: [],
  11100. 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",
  11101. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  11102. referencedClasses: []
  11103. }),
  11104. smalltalk.HashedCollection);
  11105. smalltalk.addMethod(
  11106. smalltalk.method({
  11107. selector: "associations",
  11108. category: 'accessing',
  11109. fn: function (){
  11110. var self=this;
  11111. var associations;
  11112. return smalltalk.withContext(function($ctx1) {
  11113. var $1;
  11114. associations=[];
  11115. self._associationsDo_((function(each){
  11116. return smalltalk.withContext(function($ctx2) {
  11117. return _st(associations)._add_(each);
  11118. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11119. $1=associations;
  11120. return $1;
  11121. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},smalltalk.HashedCollection)})},
  11122. args: [],
  11123. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [:each | associations add: each].\x0a\x09^associations",
  11124. messageSends: ["associationsDo:", "add:"],
  11125. referencedClasses: []
  11126. }),
  11127. smalltalk.HashedCollection);
  11128. smalltalk.addMethod(
  11129. smalltalk.method({
  11130. selector: "associationsDo:",
  11131. category: 'enumerating',
  11132. fn: function (aBlock){
  11133. var self=this;
  11134. function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
  11135. return smalltalk.withContext(function($ctx1) {
  11136. self._keysAndValuesDo_((function(key,value){
  11137. return smalltalk.withContext(function($ctx2) {
  11138. return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
  11139. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11140. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11141. args: ["aBlock"],
  11142. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09aBlock value: (Association key: key value: value)]",
  11143. messageSends: ["keysAndValuesDo:", "value:", "key:value:"],
  11144. referencedClasses: ["Association"]
  11145. }),
  11146. smalltalk.HashedCollection);
  11147. smalltalk.addMethod(
  11148. smalltalk.method({
  11149. selector: "at:ifAbsent:",
  11150. category: 'accessing',
  11151. fn: function (aKey,aBlock){
  11152. var self=this;
  11153. return smalltalk.withContext(function($ctx1) {
  11154. var $2,$1;
  11155. $2=self._includesKey_(aKey);
  11156. $1=_st($2)._ifTrue_ifFalse_((function(){
  11157. return smalltalk.withContext(function($ctx2) {
  11158. return self._basicAt_(aKey);
  11159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  11160. return $1;
  11161. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  11162. args: ["aKey", "aBlock"],
  11163. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  11164. messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"],
  11165. referencedClasses: []
  11166. }),
  11167. smalltalk.HashedCollection);
  11168. smalltalk.addMethod(
  11169. smalltalk.method({
  11170. selector: "at:ifAbsentPut:",
  11171. category: 'accessing',
  11172. fn: function (aKey,aBlock){
  11173. var self=this;
  11174. return smalltalk.withContext(function($ctx1) {
  11175. var $1;
  11176. $1=self._at_ifAbsent_(aKey,(function(){
  11177. return smalltalk.withContext(function($ctx2) {
  11178. return self._at_put_(aKey,_st(aBlock)._value());
  11179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11180. return $1;
  11181. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  11182. args: ["aKey", "aBlock"],
  11183. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value]",
  11184. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  11185. referencedClasses: []
  11186. }),
  11187. smalltalk.HashedCollection);
  11188. smalltalk.addMethod(
  11189. smalltalk.method({
  11190. selector: "at:ifPresent:ifAbsent:",
  11191. category: 'accessing',
  11192. fn: function (aKey,aBlock,anotherBlock){
  11193. var self=this;
  11194. return smalltalk.withContext(function($ctx1) {
  11195. var $2,$1;
  11196. $2=self._includesKey_(aKey);
  11197. $1=_st($2)._ifTrue_ifFalse_((function(){
  11198. return smalltalk.withContext(function($ctx2) {
  11199. return _st(aBlock)._value_(self._at_(aKey));
  11200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),anotherBlock);
  11201. return $1;
  11202. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})},
  11203. args: ["aKey", "aBlock", "anotherBlock"],
  11204. 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",
  11205. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  11206. referencedClasses: []
  11207. }),
  11208. smalltalk.HashedCollection);
  11209. smalltalk.addMethod(
  11210. smalltalk.method({
  11211. selector: "at:put:",
  11212. category: 'accessing',
  11213. fn: function (aKey,aValue){
  11214. var self=this;
  11215. return smalltalk.withContext(function($ctx1) {
  11216. var $1;
  11217. $1=self._basicAt_put_(aKey,aValue);
  11218. return $1;
  11219. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.HashedCollection)})},
  11220. args: ["aKey", "aValue"],
  11221. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  11222. messageSends: ["basicAt:put:"],
  11223. referencedClasses: []
  11224. }),
  11225. smalltalk.HashedCollection);
  11226. smalltalk.addMethod(
  11227. smalltalk.method({
  11228. selector: "collect:",
  11229. category: 'enumerating',
  11230. fn: function (aBlock){
  11231. var self=this;
  11232. var newDict;
  11233. return smalltalk.withContext(function($ctx1) {
  11234. var $1;
  11235. newDict=_st(self._class())._new();
  11236. self._keysAndValuesDo_((function(key,value){
  11237. return smalltalk.withContext(function($ctx2) {
  11238. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  11239. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11240. $1=newDict;
  11241. return $1;
  11242. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})},
  11243. args: ["aBlock"],
  11244. 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",
  11245. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  11246. referencedClasses: []
  11247. }),
  11248. smalltalk.HashedCollection);
  11249. smalltalk.addMethod(
  11250. smalltalk.method({
  11251. selector: "deepCopy",
  11252. category: 'copying',
  11253. fn: function (){
  11254. var self=this;
  11255. var copy;
  11256. return smalltalk.withContext(function($ctx1) {
  11257. var $1;
  11258. copy=_st(self._class())._new();
  11259. self._keysAndValuesDo_((function(key,value){
  11260. return smalltalk.withContext(function($ctx2) {
  11261. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  11262. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11263. $1=copy;
  11264. return $1;
  11265. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},smalltalk.HashedCollection)})},
  11266. args: [],
  11267. 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",
  11268. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"],
  11269. referencedClasses: []
  11270. }),
  11271. smalltalk.HashedCollection);
  11272. smalltalk.addMethod(
  11273. smalltalk.method({
  11274. selector: "detect:ifNone:",
  11275. category: 'enumerating',
  11276. fn: function (aBlock,anotherBlock){
  11277. var self=this;
  11278. return smalltalk.withContext(function($ctx1) {
  11279. var $1;
  11280. $1=_st(self._values())._detect_ifNone_(aBlock,anotherBlock);
  11281. return $1;
  11282. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})},
  11283. args: ["aBlock", "anotherBlock"],
  11284. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  11285. messageSends: ["detect:ifNone:", "values"],
  11286. referencedClasses: []
  11287. }),
  11288. smalltalk.HashedCollection);
  11289. smalltalk.addMethod(
  11290. smalltalk.method({
  11291. selector: "do:",
  11292. category: 'enumerating',
  11293. fn: function (aBlock){
  11294. var self=this;
  11295. return smalltalk.withContext(function($ctx1) {
  11296. self._valuesDo_(aBlock);
  11297. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11298. args: ["aBlock"],
  11299. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  11300. messageSends: ["valuesDo:"],
  11301. referencedClasses: []
  11302. }),
  11303. smalltalk.HashedCollection);
  11304. smalltalk.addMethod(
  11305. smalltalk.method({
  11306. selector: "includes:",
  11307. category: 'enumerating',
  11308. fn: function (anObject){
  11309. var self=this;
  11310. return smalltalk.withContext(function($ctx1) {
  11311. var $1;
  11312. $1=_st(self._values())._includes_(anObject);
  11313. return $1;
  11314. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.HashedCollection)})},
  11315. args: ["anObject"],
  11316. source: "includes: anObject\x0a\x09^self values includes: anObject",
  11317. messageSends: ["includes:", "values"],
  11318. referencedClasses: []
  11319. }),
  11320. smalltalk.HashedCollection);
  11321. smalltalk.addMethod(
  11322. smalltalk.method({
  11323. selector: "includesKey:",
  11324. category: 'testing',
  11325. fn: function (aKey){
  11326. var self=this;
  11327. return smalltalk.withContext(function($ctx1) {
  11328. return self.hasOwnProperty(aKey);
  11329. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.HashedCollection)})},
  11330. args: ["aKey"],
  11331. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  11332. messageSends: [],
  11333. referencedClasses: []
  11334. }),
  11335. smalltalk.HashedCollection);
  11336. smalltalk.addMethod(
  11337. smalltalk.method({
  11338. selector: "indexOf:ifAbsent:",
  11339. category: 'accessing',
  11340. fn: function (anObject,aBlock){
  11341. var self=this;
  11342. return smalltalk.withContext(function($ctx1) {
  11343. var $1;
  11344. $1=_st(self._keys())._detect_ifNone_((function(each){
  11345. return smalltalk.withContext(function($ctx2) {
  11346. return _st(self._at_(each)).__eq(anObject);
  11347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),aBlock);
  11348. return $1;
  11349. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.HashedCollection)})},
  11350. args: ["anObject", "aBlock"],
  11351. source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09^ self keys detect: [ :each | (self at: each) = anObject ] ifNone: aBlock",
  11352. messageSends: ["detect:ifNone:", "=", "at:", "keys"],
  11353. referencedClasses: []
  11354. }),
  11355. smalltalk.HashedCollection);
  11356. smalltalk.addMethod(
  11357. smalltalk.method({
  11358. selector: "keys",
  11359. category: 'accessing',
  11360. fn: function (){
  11361. var self=this;
  11362. return smalltalk.withContext(function($ctx1) {
  11363. if ('function'===typeof Object.keys) return Object.keys(self);
  11364. var keys = [];
  11365. for(var i in self) {
  11366. if(self.hasOwnProperty(i)) {
  11367. keys.push(i);
  11368. }
  11369. };
  11370. return keys;
  11371. ;
  11372. return self}, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.HashedCollection)})},
  11373. args: [],
  11374. 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>",
  11375. messageSends: [],
  11376. referencedClasses: []
  11377. }),
  11378. smalltalk.HashedCollection);
  11379. smalltalk.addMethod(
  11380. smalltalk.method({
  11381. selector: "keysAndValuesDo:",
  11382. category: 'enumerating',
  11383. fn: function (aBlock){
  11384. var self=this;
  11385. return smalltalk.withContext(function($ctx1) {
  11386. self._keysDo_((function(each){
  11387. return smalltalk.withContext(function($ctx2) {
  11388. return _st(aBlock)._value_value_(each,self._at_(each));
  11389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11390. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11391. args: ["aBlock"],
  11392. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [:each |\x0a\x09\x09aBlock value: each value: (self at: each)]",
  11393. messageSends: ["keysDo:", "value:value:", "at:"],
  11394. referencedClasses: []
  11395. }),
  11396. smalltalk.HashedCollection);
  11397. smalltalk.addMethod(
  11398. smalltalk.method({
  11399. selector: "keysDo:",
  11400. category: 'enumerating',
  11401. fn: function (aBlock){
  11402. var self=this;
  11403. return smalltalk.withContext(function($ctx1) {
  11404. _st(self._keys())._do_(aBlock);
  11405. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11406. args: ["aBlock"],
  11407. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  11408. messageSends: ["do:", "keys"],
  11409. referencedClasses: []
  11410. }),
  11411. smalltalk.HashedCollection);
  11412. smalltalk.addMethod(
  11413. smalltalk.method({
  11414. selector: "printOn:",
  11415. category: 'printing',
  11416. fn: function (aStream){
  11417. var self=this;
  11418. return smalltalk.withContext(function($ctx1) {
  11419. smalltalk.IndexableCollection.fn.prototype._printOn_.apply(_st(self), [aStream]);
  11420. _st(aStream)._nextPutAll_(" (");
  11421. _st(self._associations())._do_separatedBy_((function(each){
  11422. return smalltalk.withContext(function($ctx2) {
  11423. return _st(each)._printOn_(aStream);
  11424. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  11425. return smalltalk.withContext(function($ctx2) {
  11426. return _st(aStream)._nextPutAll_(" , ");
  11427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11428. _st(aStream)._nextPutAll_(")");
  11429. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.HashedCollection)})},
  11430. args: ["aStream"],
  11431. 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: ')'",
  11432. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"],
  11433. referencedClasses: []
  11434. }),
  11435. smalltalk.HashedCollection);
  11436. smalltalk.addMethod(
  11437. smalltalk.method({
  11438. selector: "remove:ifAbsent:",
  11439. category: 'adding/removing',
  11440. fn: function (aKey,aBlock){
  11441. var self=this;
  11442. return smalltalk.withContext(function($ctx1) {
  11443. var $1;
  11444. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  11445. return $1;
  11446. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  11447. args: ["aKey", "aBlock"],
  11448. source: "remove: aKey ifAbsent: aBlock\x0a\x09^self removeKey: aKey ifAbsent: aBlock",
  11449. messageSends: ["removeKey:ifAbsent:"],
  11450. referencedClasses: []
  11451. }),
  11452. smalltalk.HashedCollection);
  11453. smalltalk.addMethod(
  11454. smalltalk.method({
  11455. selector: "removeKey:",
  11456. category: 'adding/removing',
  11457. fn: function (aKey){
  11458. var self=this;
  11459. return smalltalk.withContext(function($ctx1) {
  11460. var $1;
  11461. $1=self._remove_(aKey);
  11462. return $1;
  11463. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},smalltalk.HashedCollection)})},
  11464. args: ["aKey"],
  11465. source: "removeKey: aKey\x0a\x09^self remove: aKey",
  11466. messageSends: ["remove:"],
  11467. referencedClasses: []
  11468. }),
  11469. smalltalk.HashedCollection);
  11470. smalltalk.addMethod(
  11471. smalltalk.method({
  11472. selector: "removeKey:ifAbsent:",
  11473. category: 'adding/removing',
  11474. fn: function (aKey,aBlock){
  11475. var self=this;
  11476. return smalltalk.withContext(function($ctx1) {
  11477. var $2,$1;
  11478. $2=self._includesKey_(aKey);
  11479. if(smalltalk.assert($2)){
  11480. $1=self._basicDelete_(aKey);
  11481. } else {
  11482. $1=_st(aBlock)._value();
  11483. };
  11484. return $1;
  11485. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  11486. args: ["aKey", "aBlock"],
  11487. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  11488. messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"],
  11489. referencedClasses: []
  11490. }),
  11491. smalltalk.HashedCollection);
  11492. smalltalk.addMethod(
  11493. smalltalk.method({
  11494. selector: "select:",
  11495. category: 'enumerating',
  11496. fn: function (aBlock){
  11497. var self=this;
  11498. var newDict;
  11499. return smalltalk.withContext(function($ctx1) {
  11500. var $1,$2;
  11501. newDict=_st(self._class())._new();
  11502. self._keysAndValuesDo_((function(key,value){
  11503. return smalltalk.withContext(function($ctx2) {
  11504. $1=_st(aBlock)._value_(value);
  11505. if(smalltalk.assert($1)){
  11506. return _st(newDict)._at_put_(key,value);
  11507. };
  11508. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11509. $2=newDict;
  11510. return $2;
  11511. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})},
  11512. args: ["aBlock"],
  11513. 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",
  11514. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"],
  11515. referencedClasses: []
  11516. }),
  11517. smalltalk.HashedCollection);
  11518. smalltalk.addMethod(
  11519. smalltalk.method({
  11520. selector: "shallowCopy",
  11521. category: 'copying',
  11522. fn: function (){
  11523. var self=this;
  11524. var copy;
  11525. return smalltalk.withContext(function($ctx1) {
  11526. var $1;
  11527. copy=_st(self._class())._new();
  11528. self._keysAndValuesDo_((function(key,value){
  11529. return smalltalk.withContext(function($ctx2) {
  11530. return _st(copy)._at_put_(key,value);
  11531. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11532. $1=copy;
  11533. return $1;
  11534. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},smalltalk.HashedCollection)})},
  11535. args: [],
  11536. 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",
  11537. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"],
  11538. referencedClasses: []
  11539. }),
  11540. smalltalk.HashedCollection);
  11541. smalltalk.addMethod(
  11542. smalltalk.method({
  11543. selector: "size",
  11544. category: 'accessing',
  11545. fn: function (){
  11546. var self=this;
  11547. return smalltalk.withContext(function($ctx1) {
  11548. var $1;
  11549. $1=_st(self._keys())._size();
  11550. return $1;
  11551. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.HashedCollection)})},
  11552. args: [],
  11553. source: "size\x0a\x09^self keys size",
  11554. messageSends: ["size", "keys"],
  11555. referencedClasses: []
  11556. }),
  11557. smalltalk.HashedCollection);
  11558. smalltalk.addMethod(
  11559. smalltalk.method({
  11560. selector: "values",
  11561. category: 'accessing',
  11562. fn: function (){
  11563. var self=this;
  11564. return smalltalk.withContext(function($ctx1) {
  11565. var $1;
  11566. $1=_st(self._keys())._collect_((function(each){
  11567. return smalltalk.withContext(function($ctx2) {
  11568. return self._at_(each);
  11569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11570. return $1;
  11571. }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.HashedCollection)})},
  11572. args: [],
  11573. source: "values\x0a\x09^self keys collect: [:each | self at: each]",
  11574. messageSends: ["collect:", "at:", "keys"],
  11575. referencedClasses: []
  11576. }),
  11577. smalltalk.HashedCollection);
  11578. smalltalk.addMethod(
  11579. smalltalk.method({
  11580. selector: "valuesDo:",
  11581. category: 'enumerating',
  11582. fn: function (aBlock){
  11583. var self=this;
  11584. return smalltalk.withContext(function($ctx1) {
  11585. self._keysAndValuesDo_((function(key,value){
  11586. return smalltalk.withContext(function($ctx2) {
  11587. return _st(aBlock)._value_(value);
  11588. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11589. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11590. args: ["aBlock"],
  11591. source: "valuesDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value ]",
  11592. messageSends: ["keysAndValuesDo:", "value:"],
  11593. referencedClasses: []
  11594. }),
  11595. smalltalk.HashedCollection);
  11596. smalltalk.addMethod(
  11597. smalltalk.method({
  11598. selector: "withIndexDo:",
  11599. category: 'enumerating',
  11600. fn: function (aBlock){
  11601. var self=this;
  11602. return smalltalk.withContext(function($ctx1) {
  11603. self._keysAndValuesDo_((function(key,value){
  11604. return smalltalk.withContext(function($ctx2) {
  11605. return _st(aBlock)._value_value_(value,key);
  11606. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11607. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11608. args: ["aBlock"],
  11609. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  11610. messageSends: ["keysAndValuesDo:", "value:value:"],
  11611. referencedClasses: []
  11612. }),
  11613. smalltalk.HashedCollection);
  11614. smalltalk.addMethod(
  11615. smalltalk.method({
  11616. selector: "from:",
  11617. category: 'instance creation',
  11618. fn: function (aCollection){
  11619. var self=this;
  11620. var newCollection;
  11621. return smalltalk.withContext(function($ctx1) {
  11622. var $1;
  11623. newCollection=self._new();
  11624. _st(aCollection)._do_((function(each){
  11625. return smalltalk.withContext(function($ctx2) {
  11626. return _st(newCollection)._add_(each);
  11627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11628. $1=newCollection;
  11629. return $1;
  11630. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},smalltalk.HashedCollection.klass)})},
  11631. args: ["aCollection"],
  11632. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  11633. messageSends: ["new", "do:", "add:"],
  11634. referencedClasses: []
  11635. }),
  11636. smalltalk.HashedCollection.klass);
  11637. smalltalk.addMethod(
  11638. smalltalk.method({
  11639. selector: "fromPairs:",
  11640. category: 'instance creation',
  11641. fn: function (aCollection){
  11642. var self=this;
  11643. return smalltalk.withContext(function($ctx1) {
  11644. var $1;
  11645. $1=self._from_(aCollection);
  11646. return $1;
  11647. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},smalltalk.HashedCollection.klass)})},
  11648. args: ["aCollection"],
  11649. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  11650. messageSends: ["from:"],
  11651. referencedClasses: []
  11652. }),
  11653. smalltalk.HashedCollection.klass);
  11654. smalltalk.addMethod(
  11655. smalltalk.method({
  11656. selector: "newFromPairs:",
  11657. category: 'instance creation',
  11658. fn: function (aCollection){
  11659. var self=this;
  11660. var newCollection;
  11661. return smalltalk.withContext(function($ctx1) {
  11662. var $1,$2;
  11663. $1=_st(_st(aCollection)._size())._even();
  11664. if(! smalltalk.assert($1)){
  11665. self._error_("#newFromPairs only accepts arrays of an even length");
  11666. };
  11667. newCollection=self._new();
  11668. _st((1)._to_by_(_st(aCollection)._size(),(2)))._do_((function(each){
  11669. return smalltalk.withContext(function($ctx2) {
  11670. return _st(newCollection)._at_put_(_st(aCollection)._at_(each),_st(aCollection)._at_(_st(each).__plus((1))));
  11671. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11672. $2=newCollection;
  11673. return $2;
  11674. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},smalltalk.HashedCollection.klass)})},
  11675. args: ["aCollection"],
  11676. 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",
  11677. messageSends: ["ifFalse:", "error:", "even", "size", "new", "do:", "at:put:", "at:", "+", "to:by:"],
  11678. referencedClasses: []
  11679. }),
  11680. smalltalk.HashedCollection.klass);
  11681. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  11682. 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.";
  11683. smalltalk.addMethod(
  11684. smalltalk.method({
  11685. selector: "asHashedCollection",
  11686. category: 'converting',
  11687. fn: function (){
  11688. var self=this;
  11689. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11690. return smalltalk.withContext(function($ctx1) {
  11691. var $1;
  11692. $1=_st($HashedCollection())._from_(self._associations());
  11693. return $1;
  11694. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},smalltalk.Dictionary)})},
  11695. args: [],
  11696. source: "asHashedCollection\x0a\x09^HashedCollection from: self associations",
  11697. messageSends: ["from:", "associations"],
  11698. referencedClasses: ["HashedCollection"]
  11699. }),
  11700. smalltalk.Dictionary);
  11701. smalltalk.addMethod(
  11702. smalltalk.method({
  11703. selector: "asJSON",
  11704. category: 'converting',
  11705. fn: function (){
  11706. var self=this;
  11707. return smalltalk.withContext(function($ctx1) {
  11708. var $1;
  11709. $1=_st(self._asHashedCollection())._asJSON();
  11710. return $1;
  11711. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Dictionary)})},
  11712. args: [],
  11713. source: "asJSON\x0a\x09^self asHashedCollection asJSON",
  11714. messageSends: ["asJSON", "asHashedCollection"],
  11715. referencedClasses: []
  11716. }),
  11717. smalltalk.Dictionary);
  11718. smalltalk.addMethod(
  11719. smalltalk.method({
  11720. selector: "at:ifAbsent:",
  11721. category: 'accessing',
  11722. fn: function (aKey,aBlock){
  11723. var self=this;
  11724. return smalltalk.withContext(function($ctx1) {
  11725. var index = self._positionOfKey_(aKey);
  11726. return index >=0 ? self['@values'][index] : aBlock._value();
  11727. ;
  11728. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Dictionary)})},
  11729. args: ["aKey", "aBlock"],
  11730. 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>",
  11731. messageSends: [],
  11732. referencedClasses: []
  11733. }),
  11734. smalltalk.Dictionary);
  11735. smalltalk.addMethod(
  11736. smalltalk.method({
  11737. selector: "at:put:",
  11738. category: 'accessing',
  11739. fn: function (aKey,aValue){
  11740. var self=this;
  11741. return smalltalk.withContext(function($ctx1) {
  11742. var index = self._positionOfKey_(aKey);
  11743. if(index === -1) {
  11744. var keys = self['@keys'];
  11745. index = keys.length;
  11746. keys.push(aKey);
  11747. }
  11748. return self['@values'][index] = aValue;
  11749. ;
  11750. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.Dictionary)})},
  11751. args: ["aKey", "aValue"],
  11752. 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>",
  11753. messageSends: [],
  11754. referencedClasses: []
  11755. }),
  11756. smalltalk.Dictionary);
  11757. smalltalk.addMethod(
  11758. smalltalk.method({
  11759. selector: "includesKey:",
  11760. category: 'testing',
  11761. fn: function (aKey){
  11762. var self=this;
  11763. return smalltalk.withContext(function($ctx1) {
  11764. return self._positionOfKey_(aKey) >= 0; ;
  11765. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.Dictionary)})},
  11766. args: ["aKey"],
  11767. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  11768. messageSends: [],
  11769. referencedClasses: []
  11770. }),
  11771. smalltalk.Dictionary);
  11772. smalltalk.addMethod(
  11773. smalltalk.method({
  11774. selector: "indexOf:ifAbsent:",
  11775. category: 'accessing',
  11776. fn: function (anObject,aBlock){
  11777. var self=this;
  11778. var index;
  11779. return smalltalk.withContext(function($ctx1) {
  11780. var $2,$1;
  11781. index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  11782. return smalltalk.withContext(function($ctx2) {
  11783. return (0);
  11784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11785. $2=_st(index).__eq((0));
  11786. if(smalltalk.assert($2)){
  11787. $1=_st(aBlock)._value();
  11788. } else {
  11789. $1=_st(self["@keys"])._at_(index);
  11790. };
  11791. return $1;
  11792. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},smalltalk.Dictionary)})},
  11793. args: ["anObject", "aBlock"],
  11794. source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09| index |\x0a\x09index := values indexOf: anObject ifAbsent: [0].\x0a\x09^ index = 0 ifTrue: [ aBlock value ] ifFalse: [ keys at: index ]",
  11795. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "value", "at:", "="],
  11796. referencedClasses: []
  11797. }),
  11798. smalltalk.Dictionary);
  11799. smalltalk.addMethod(
  11800. smalltalk.method({
  11801. selector: "initialize",
  11802. category: 'initialization',
  11803. fn: function (){
  11804. var self=this;
  11805. return smalltalk.withContext(function($ctx1) {
  11806. smalltalk.HashedCollection.fn.prototype._initialize.apply(_st(self), []);
  11807. self["@keys"]=[];
  11808. self["@values"]=[];
  11809. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Dictionary)})},
  11810. args: [],
  11811. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  11812. messageSends: ["initialize"],
  11813. referencedClasses: []
  11814. }),
  11815. smalltalk.Dictionary);
  11816. smalltalk.addMethod(
  11817. smalltalk.method({
  11818. selector: "keys",
  11819. category: 'accessing',
  11820. fn: function (){
  11821. var self=this;
  11822. return smalltalk.withContext(function($ctx1) {
  11823. var $1;
  11824. $1=_st(self["@keys"])._copy();
  11825. return $1;
  11826. }, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.Dictionary)})},
  11827. args: [],
  11828. source: "keys\x0a\x09^keys copy",
  11829. messageSends: ["copy"],
  11830. referencedClasses: []
  11831. }),
  11832. smalltalk.Dictionary);
  11833. smalltalk.addMethod(
  11834. smalltalk.method({
  11835. selector: "keysAndValuesDo:",
  11836. category: 'enumerating',
  11837. fn: function (aBlock){
  11838. var self=this;
  11839. return smalltalk.withContext(function($ctx1) {
  11840. var $1;
  11841. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  11842. return $1;
  11843. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  11844. args: ["aBlock"],
  11845. source: "keysAndValuesDo: aBlock\x0a\x09^keys with: values do: aBlock",
  11846. messageSends: ["with:do:"],
  11847. referencedClasses: []
  11848. }),
  11849. smalltalk.Dictionary);
  11850. smalltalk.addMethod(
  11851. smalltalk.method({
  11852. selector: "keysDo:",
  11853. category: 'enumerating',
  11854. fn: function (aBlock){
  11855. var self=this;
  11856. return smalltalk.withContext(function($ctx1) {
  11857. var $1;
  11858. $1=_st(self["@keys"])._do_(aBlock);
  11859. return $1;
  11860. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  11861. args: ["aBlock"],
  11862. source: "keysDo: aBlock\x0a\x09^keys do: aBlock",
  11863. messageSends: ["do:"],
  11864. referencedClasses: []
  11865. }),
  11866. smalltalk.Dictionary);
  11867. smalltalk.addMethod(
  11868. smalltalk.method({
  11869. selector: "positionOfKey:",
  11870. category: 'private',
  11871. fn: function (anObject){
  11872. var self=this;
  11873. return smalltalk.withContext(function($ctx1) {
  11874. var keys = self['@keys'];
  11875. for(var i=0;i<keys.length;i++){
  11876. if(keys[i].__eq(anObject)) { return i;}
  11877. }
  11878. return -1;
  11879. ;
  11880. return self}, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},smalltalk.Dictionary)})},
  11881. args: ["anObject"],
  11882. 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>",
  11883. messageSends: [],
  11884. referencedClasses: []
  11885. }),
  11886. smalltalk.Dictionary);
  11887. smalltalk.addMethod(
  11888. smalltalk.method({
  11889. selector: "removeKey:ifAbsent:",
  11890. category: 'adding/removing',
  11891. fn: function (aKey,aBlock){
  11892. var self=this;
  11893. return smalltalk.withContext(function($ctx1) {
  11894. var index = self._positionOfKey_(aKey);
  11895. if(index === -1) {
  11896. return aBlock._value()
  11897. } else {
  11898. var keys = self['@keys'], values = self['@values'];
  11899. var value = values[index], l = keys.length;
  11900. keys[index] = keys[l-1];
  11901. keys.pop();
  11902. values[index] = values[l-1];
  11903. values.pop();
  11904. return value;
  11905. }
  11906. ;
  11907. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Dictionary)})},
  11908. args: ["aKey", "aBlock"],
  11909. 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>",
  11910. messageSends: [],
  11911. referencedClasses: []
  11912. }),
  11913. smalltalk.Dictionary);
  11914. smalltalk.addMethod(
  11915. smalltalk.method({
  11916. selector: "values",
  11917. category: 'accessing',
  11918. fn: function (){
  11919. var self=this;
  11920. return smalltalk.withContext(function($ctx1) {
  11921. var $1;
  11922. $1=_st(self["@values"])._copy();
  11923. return $1;
  11924. }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.Dictionary)})},
  11925. args: [],
  11926. source: "values\x0a\x09^values copy",
  11927. messageSends: ["copy"],
  11928. referencedClasses: []
  11929. }),
  11930. smalltalk.Dictionary);
  11931. smalltalk.addMethod(
  11932. smalltalk.method({
  11933. selector: "valuesDo:",
  11934. category: 'enumerating',
  11935. fn: function (aBlock){
  11936. var self=this;
  11937. return smalltalk.withContext(function($ctx1) {
  11938. var $1;
  11939. $1=_st(self["@values"])._do_(aBlock);
  11940. return $1;
  11941. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  11942. args: ["aBlock"],
  11943. source: "valuesDo: aBlock\x0a\x09^values do: aBlock",
  11944. messageSends: ["do:"],
  11945. referencedClasses: []
  11946. }),
  11947. smalltalk.Dictionary);
  11948. smalltalk.addClass('SequenceableCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
  11949. smalltalk.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  11950. smalltalk.addMethod(
  11951. smalltalk.method({
  11952. selector: "=",
  11953. category: 'comparing',
  11954. fn: function (aCollection){
  11955. var self=this;
  11956. return smalltalk.withContext(function($ctx1) {
  11957. var $1,$2;
  11958. var $early={};
  11959. try {
  11960. $1=_st(_st(self._class()).__eq(_st(aCollection)._class()))._and_((function(){
  11961. return smalltalk.withContext(function($ctx2) {
  11962. return _st(self._size()).__eq(_st(aCollection)._size());
  11963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11964. if(! smalltalk.assert($1)){
  11965. return false;
  11966. };
  11967. self._withIndexDo_((function(each,i){
  11968. return smalltalk.withContext(function($ctx2) {
  11969. $2=_st(_st(aCollection)._at_(i)).__eq(each);
  11970. if(! smalltalk.assert($2)){
  11971. throw $early=[false];
  11972. };
  11973. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  11974. return true;
  11975. }
  11976. catch(e) {if(e===$early)return e[0]; throw e}
  11977. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.SequenceableCollection)})},
  11978. args: ["aCollection"],
  11979. 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",
  11980. messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"],
  11981. referencedClasses: []
  11982. }),
  11983. smalltalk.SequenceableCollection);
  11984. smalltalk.addMethod(
  11985. smalltalk.method({
  11986. selector: "addLast:",
  11987. category: 'adding',
  11988. fn: function (anObject){
  11989. var self=this;
  11990. return smalltalk.withContext(function($ctx1) {
  11991. self._add_(anObject);
  11992. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},smalltalk.SequenceableCollection)})},
  11993. args: ["anObject"],
  11994. source: "addLast: anObject\x0a\x09self add: anObject",
  11995. messageSends: ["add:"],
  11996. referencedClasses: []
  11997. }),
  11998. smalltalk.SequenceableCollection);
  11999. smalltalk.addMethod(
  12000. smalltalk.method({
  12001. selector: "allButFirst",
  12002. category: 'accessing',
  12003. fn: function (){
  12004. var self=this;
  12005. return smalltalk.withContext(function($ctx1) {
  12006. var $1;
  12007. $1=self._copyFrom_to_((2),self._size());
  12008. return $1;
  12009. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},smalltalk.SequenceableCollection)})},
  12010. args: [],
  12011. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  12012. messageSends: ["copyFrom:to:", "size"],
  12013. referencedClasses: []
  12014. }),
  12015. smalltalk.SequenceableCollection);
  12016. smalltalk.addMethod(
  12017. smalltalk.method({
  12018. selector: "allButLast",
  12019. category: 'accessing',
  12020. fn: function (){
  12021. var self=this;
  12022. return smalltalk.withContext(function($ctx1) {
  12023. var $1;
  12024. $1=self._copyFrom_to_((1),_st(self._size()).__minus((1)));
  12025. return $1;
  12026. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},smalltalk.SequenceableCollection)})},
  12027. args: [],
  12028. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  12029. messageSends: ["copyFrom:to:", "-", "size"],
  12030. referencedClasses: []
  12031. }),
  12032. smalltalk.SequenceableCollection);
  12033. smalltalk.addMethod(
  12034. smalltalk.method({
  12035. selector: "atRandom",
  12036. category: 'accessing',
  12037. fn: function (){
  12038. var self=this;
  12039. return smalltalk.withContext(function($ctx1) {
  12040. var $1;
  12041. $1=self._at_(_st(self._size())._atRandom());
  12042. return $1;
  12043. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.SequenceableCollection)})},
  12044. args: [],
  12045. source: "atRandom\x0a\x09^ self at: self size atRandom",
  12046. messageSends: ["at:", "atRandom", "size"],
  12047. referencedClasses: []
  12048. }),
  12049. smalltalk.SequenceableCollection);
  12050. smalltalk.addMethod(
  12051. smalltalk.method({
  12052. selector: "copyFrom:to:",
  12053. category: 'copying',
  12054. fn: function (anIndex,anotherIndex){
  12055. var self=this;
  12056. var range,newCollection;
  12057. return smalltalk.withContext(function($ctx1) {
  12058. var $1;
  12059. range=_st(anIndex)._to_(anotherIndex);
  12060. newCollection=_st(self._class())._new_(_st(range)._size());
  12061. _st(range)._withIndexDo_((function(each,i){
  12062. return smalltalk.withContext(function($ctx2) {
  12063. return _st(newCollection)._at_put_(i,self._at_(each));
  12064. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  12065. $1=newCollection;
  12066. return $1;
  12067. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},smalltalk.SequenceableCollection)})},
  12068. args: ["anIndex", "anotherIndex"],
  12069. 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",
  12070. messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"],
  12071. referencedClasses: []
  12072. }),
  12073. smalltalk.SequenceableCollection);
  12074. smalltalk.addMethod(
  12075. smalltalk.method({
  12076. selector: "deepCopy",
  12077. category: 'copying',
  12078. fn: function (){
  12079. var self=this;
  12080. var newCollection;
  12081. return smalltalk.withContext(function($ctx1) {
  12082. var $1;
  12083. newCollection=_st(self._class())._new_(self._size());
  12084. self._withIndexDo_((function(each,index){
  12085. return smalltalk.withContext(function($ctx2) {
  12086. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  12087. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  12088. $1=newCollection;
  12089. return $1;
  12090. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})},
  12091. args: [],
  12092. 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",
  12093. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"],
  12094. referencedClasses: []
  12095. }),
  12096. smalltalk.SequenceableCollection);
  12097. smalltalk.addMethod(
  12098. smalltalk.method({
  12099. selector: "detect:ifNone:",
  12100. category: 'enumerating',
  12101. fn: function (aBlock,anotherBlock){
  12102. var self=this;
  12103. return smalltalk.withContext(function($ctx1) {
  12104. for(var i = 0; i < self.length; i++)
  12105. if(aBlock._value_(self[i]))
  12106. return self[i];
  12107. return anotherBlock._value();
  12108. ;
  12109. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.SequenceableCollection)})},
  12110. args: ["aBlock", "anotherBlock"],
  12111. 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>",
  12112. messageSends: [],
  12113. referencedClasses: []
  12114. }),
  12115. smalltalk.SequenceableCollection);
  12116. smalltalk.addMethod(
  12117. smalltalk.method({
  12118. selector: "do:",
  12119. category: 'enumerating',
  12120. fn: function (aBlock){
  12121. var self=this;
  12122. return smalltalk.withContext(function($ctx1) {
  12123. for(var i=0;i<self.length;i++){aBlock._value_(self[i]);};
  12124. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
  12125. args: ["aBlock"],
  12126. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_(self[i]);}>",
  12127. messageSends: [],
  12128. referencedClasses: []
  12129. }),
  12130. smalltalk.SequenceableCollection);
  12131. smalltalk.addMethod(
  12132. smalltalk.method({
  12133. selector: "do:displayingProgress:",
  12134. category: 'enumerating',
  12135. fn: function (aBlock,aString){
  12136. var self=this;
  12137. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  12138. return smalltalk.withContext(function($ctx1) {
  12139. _st(_st($ProgressHandler())._current())._do_on_displaying_(aBlock,self,aString);
  12140. return self}, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},smalltalk.SequenceableCollection)})},
  12141. args: ["aBlock", "aString"],
  12142. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler current\x0a\x09\x09do: aBlock on: self displaying: aString",
  12143. messageSends: ["do:on:displaying:", "current"],
  12144. referencedClasses: ["ProgressHandler"]
  12145. }),
  12146. smalltalk.SequenceableCollection);
  12147. smalltalk.addMethod(
  12148. smalltalk.method({
  12149. selector: "first",
  12150. category: 'accessing',
  12151. fn: function (){
  12152. var self=this;
  12153. return smalltalk.withContext(function($ctx1) {
  12154. var $1;
  12155. $1=self._at_((1));
  12156. return $1;
  12157. }, function($ctx1) {$ctx1.fill(self,"first",{},smalltalk.SequenceableCollection)})},
  12158. args: [],
  12159. source: "first\x0a\x09^self at: 1",
  12160. messageSends: ["at:"],
  12161. referencedClasses: []
  12162. }),
  12163. smalltalk.SequenceableCollection);
  12164. smalltalk.addMethod(
  12165. smalltalk.method({
  12166. selector: "first:",
  12167. category: 'accessing',
  12168. fn: function (n){
  12169. var self=this;
  12170. return smalltalk.withContext(function($ctx1) {
  12171. var $1;
  12172. $1=self._copyFrom_to_((1),n);
  12173. return $1;
  12174. }, function($ctx1) {$ctx1.fill(self,"first:",{n:n},smalltalk.SequenceableCollection)})},
  12175. args: ["n"],
  12176. 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",
  12177. messageSends: ["copyFrom:to:"],
  12178. referencedClasses: []
  12179. }),
  12180. smalltalk.SequenceableCollection);
  12181. smalltalk.addMethod(
  12182. smalltalk.method({
  12183. selector: "fourth",
  12184. category: 'accessing',
  12185. fn: function (){
  12186. var self=this;
  12187. return smalltalk.withContext(function($ctx1) {
  12188. var $1;
  12189. $1=self._at_((4));
  12190. return $1;
  12191. }, function($ctx1) {$ctx1.fill(self,"fourth",{},smalltalk.SequenceableCollection)})},
  12192. args: [],
  12193. source: "fourth\x0a\x09^self at: 4",
  12194. messageSends: ["at:"],
  12195. referencedClasses: []
  12196. }),
  12197. smalltalk.SequenceableCollection);
  12198. smalltalk.addMethod(
  12199. smalltalk.method({
  12200. selector: "includes:",
  12201. category: 'testing',
  12202. fn: function (anObject){
  12203. var self=this;
  12204. return smalltalk.withContext(function($ctx1) {
  12205. var $1;
  12206. $1=_st(self._indexOf_ifAbsent_(anObject,(function(){
  12207. return smalltalk.withContext(function($ctx2) {
  12208. return nil;
  12209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._notNil();
  12210. return $1;
  12211. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.SequenceableCollection)})},
  12212. args: ["anObject"],
  12213. source: "includes: anObject\x0a\x09^(self indexOf: anObject ifAbsent: [nil]) notNil",
  12214. messageSends: ["notNil", "indexOf:ifAbsent:"],
  12215. referencedClasses: []
  12216. }),
  12217. smalltalk.SequenceableCollection);
  12218. smalltalk.addMethod(
  12219. smalltalk.method({
  12220. selector: "indexOf:ifAbsent:",
  12221. category: 'accessing',
  12222. fn: function (anObject,aBlock){
  12223. var self=this;
  12224. return smalltalk.withContext(function($ctx1) {
  12225. for(var i=0;i<self.length;i++) {
  12226. if(self[i].__eq(anObject)) {return i+1}
  12227. };
  12228. return aBlock._value();
  12229. ;
  12230. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  12231. args: ["anObject", "aBlock"],
  12232. 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>",
  12233. messageSends: [],
  12234. referencedClasses: []
  12235. }),
  12236. smalltalk.SequenceableCollection);
  12237. smalltalk.addMethod(
  12238. smalltalk.method({
  12239. selector: "indexOf:startingAt:",
  12240. category: 'accessing',
  12241. fn: function (anObject,start){
  12242. var self=this;
  12243. return smalltalk.withContext(function($ctx1) {
  12244. var $1;
  12245. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  12246. return smalltalk.withContext(function($ctx2) {
  12247. return (0);
  12248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  12249. return $1;
  12250. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},smalltalk.SequenceableCollection)})},
  12251. args: ["anObject", "start"],
  12252. 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]",
  12253. messageSends: ["indexOf:startingAt:ifAbsent:"],
  12254. referencedClasses: []
  12255. }),
  12256. smalltalk.SequenceableCollection);
  12257. smalltalk.addMethod(
  12258. smalltalk.method({
  12259. selector: "indexOf:startingAt:ifAbsent:",
  12260. category: 'accessing',
  12261. fn: function (anObject,start,aBlock){
  12262. var self=this;
  12263. return smalltalk.withContext(function($ctx1) {
  12264. for(var i=start-1;i<self.length;i++){
  12265. if(self[i].__eq(anObject)) {return i+1}
  12266. }
  12267. return aBlock._value();
  12268. ;
  12269. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  12270. args: ["anObject", "start", "aBlock"],
  12271. 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>",
  12272. messageSends: [],
  12273. referencedClasses: []
  12274. }),
  12275. smalltalk.SequenceableCollection);
  12276. smalltalk.addMethod(
  12277. smalltalk.method({
  12278. selector: "last",
  12279. category: 'accessing',
  12280. fn: function (){
  12281. var self=this;
  12282. return smalltalk.withContext(function($ctx1) {
  12283. var $1;
  12284. $1=self._at_(self._size());
  12285. return $1;
  12286. }, function($ctx1) {$ctx1.fill(self,"last",{},smalltalk.SequenceableCollection)})},
  12287. args: [],
  12288. source: "last\x0a\x09^self at: self size",
  12289. messageSends: ["at:", "size"],
  12290. referencedClasses: []
  12291. }),
  12292. smalltalk.SequenceableCollection);
  12293. smalltalk.addMethod(
  12294. smalltalk.method({
  12295. selector: "newStream",
  12296. category: 'streaming',
  12297. fn: function (){
  12298. var self=this;
  12299. return smalltalk.withContext(function($ctx1) {
  12300. var $1;
  12301. $1=_st(self._streamClass())._on_(self);
  12302. return $1;
  12303. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.SequenceableCollection)})},
  12304. args: [],
  12305. source: "newStream\x0a\x09^self streamClass on: self",
  12306. messageSends: ["on:", "streamClass"],
  12307. referencedClasses: []
  12308. }),
  12309. smalltalk.SequenceableCollection);
  12310. smalltalk.addMethod(
  12311. smalltalk.method({
  12312. selector: "readStream",
  12313. category: 'streaming',
  12314. fn: function (){
  12315. var self=this;
  12316. return smalltalk.withContext(function($ctx1) {
  12317. var $1;
  12318. $1=self._stream();
  12319. return $1;
  12320. }, function($ctx1) {$ctx1.fill(self,"readStream",{},smalltalk.SequenceableCollection)})},
  12321. args: [],
  12322. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
  12323. messageSends: ["stream"],
  12324. referencedClasses: []
  12325. }),
  12326. smalltalk.SequenceableCollection);
  12327. smalltalk.addMethod(
  12328. smalltalk.method({
  12329. selector: "removeLast",
  12330. category: 'adding',
  12331. fn: function (){
  12332. var self=this;
  12333. return smalltalk.withContext(function($ctx1) {
  12334. self._remove_(self._last());
  12335. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{},smalltalk.SequenceableCollection)})},
  12336. args: [],
  12337. source: "removeLast\x0a\x09self remove: self last",
  12338. messageSends: ["remove:", "last"],
  12339. referencedClasses: []
  12340. }),
  12341. smalltalk.SequenceableCollection);
  12342. smalltalk.addMethod(
  12343. smalltalk.method({
  12344. selector: "reversed",
  12345. category: 'converting',
  12346. fn: function (){
  12347. var self=this;
  12348. return smalltalk.withContext(function($ctx1) {
  12349. self._subclassResponsibility();
  12350. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.SequenceableCollection)})},
  12351. args: [],
  12352. source: "reversed\x0a\x09self subclassResponsibility",
  12353. messageSends: ["subclassResponsibility"],
  12354. referencedClasses: []
  12355. }),
  12356. smalltalk.SequenceableCollection);
  12357. smalltalk.addMethod(
  12358. smalltalk.method({
  12359. selector: "second",
  12360. category: 'accessing',
  12361. fn: function (){
  12362. var self=this;
  12363. return smalltalk.withContext(function($ctx1) {
  12364. var $1;
  12365. $1=self._at_((2));
  12366. return $1;
  12367. }, function($ctx1) {$ctx1.fill(self,"second",{},smalltalk.SequenceableCollection)})},
  12368. args: [],
  12369. source: "second\x0a\x09^self at: 2",
  12370. messageSends: ["at:"],
  12371. referencedClasses: []
  12372. }),
  12373. smalltalk.SequenceableCollection);
  12374. smalltalk.addMethod(
  12375. smalltalk.method({
  12376. selector: "shallowCopy",
  12377. category: 'copying',
  12378. fn: function (){
  12379. var self=this;
  12380. var newCollection;
  12381. return smalltalk.withContext(function($ctx1) {
  12382. var $1;
  12383. newCollection=_st(self._class())._new_(self._size());
  12384. self._withIndexDo_((function(each,index){
  12385. return smalltalk.withContext(function($ctx2) {
  12386. return _st(newCollection)._at_put_(index,each);
  12387. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  12388. $1=newCollection;
  12389. return $1;
  12390. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})},
  12391. args: [],
  12392. 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",
  12393. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"],
  12394. referencedClasses: []
  12395. }),
  12396. smalltalk.SequenceableCollection);
  12397. smalltalk.addMethod(
  12398. smalltalk.method({
  12399. selector: "stream",
  12400. category: 'streaming',
  12401. fn: function (){
  12402. var self=this;
  12403. return smalltalk.withContext(function($ctx1) {
  12404. var $1;
  12405. $1=self._newStream();
  12406. return $1;
  12407. }, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.SequenceableCollection)})},
  12408. args: [],
  12409. source: "stream\x0a\x09^self newStream",
  12410. messageSends: ["newStream"],
  12411. referencedClasses: []
  12412. }),
  12413. smalltalk.SequenceableCollection);
  12414. smalltalk.addMethod(
  12415. smalltalk.method({
  12416. selector: "streamClass",
  12417. category: 'streaming',
  12418. fn: function (){
  12419. var self=this;
  12420. return smalltalk.withContext(function($ctx1) {
  12421. var $1;
  12422. $1=_st(self._class())._streamClass();
  12423. return $1;
  12424. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection)})},
  12425. args: [],
  12426. source: "streamClass\x0a\x09^self class streamClass",
  12427. messageSends: ["streamClass", "class"],
  12428. referencedClasses: []
  12429. }),
  12430. smalltalk.SequenceableCollection);
  12431. smalltalk.addMethod(
  12432. smalltalk.method({
  12433. selector: "third",
  12434. category: 'accessing',
  12435. fn: function (){
  12436. var self=this;
  12437. return smalltalk.withContext(function($ctx1) {
  12438. var $1;
  12439. $1=self._at_((3));
  12440. return $1;
  12441. }, function($ctx1) {$ctx1.fill(self,"third",{},smalltalk.SequenceableCollection)})},
  12442. args: [],
  12443. source: "third\x0a\x09^self at: 3",
  12444. messageSends: ["at:"],
  12445. referencedClasses: []
  12446. }),
  12447. smalltalk.SequenceableCollection);
  12448. smalltalk.addMethod(
  12449. smalltalk.method({
  12450. selector: "with:do:",
  12451. category: 'enumerating',
  12452. fn: function (anotherCollection,aBlock){
  12453. var self=this;
  12454. return smalltalk.withContext(function($ctx1) {
  12455. for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], anotherCollection[i]);};
  12456. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  12457. args: ["anotherCollection", "aBlock"],
  12458. source: "with: anotherCollection do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], anotherCollection[i]);}>",
  12459. messageSends: [],
  12460. referencedClasses: []
  12461. }),
  12462. smalltalk.SequenceableCollection);
  12463. smalltalk.addMethod(
  12464. smalltalk.method({
  12465. selector: "withIndexDo:",
  12466. category: 'enumerating',
  12467. fn: function (aBlock){
  12468. var self=this;
  12469. return smalltalk.withContext(function($ctx1) {
  12470. for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], i+1);};
  12471. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
  12472. args: ["aBlock"],
  12473. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], i+1);}>",
  12474. messageSends: [],
  12475. referencedClasses: []
  12476. }),
  12477. smalltalk.SequenceableCollection);
  12478. smalltalk.addMethod(
  12479. smalltalk.method({
  12480. selector: "writeStream",
  12481. category: 'streaming',
  12482. fn: function (){
  12483. var self=this;
  12484. return smalltalk.withContext(function($ctx1) {
  12485. var $1;
  12486. $1=self._stream();
  12487. return $1;
  12488. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},smalltalk.SequenceableCollection)})},
  12489. args: [],
  12490. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
  12491. messageSends: ["stream"],
  12492. referencedClasses: []
  12493. }),
  12494. smalltalk.SequenceableCollection);
  12495. smalltalk.addMethod(
  12496. smalltalk.method({
  12497. selector: "streamClass",
  12498. category: 'accessing',
  12499. fn: function (){
  12500. var self=this;
  12501. function $Stream(){return smalltalk.Stream||(typeof Stream=="undefined"?nil:Stream)}
  12502. return smalltalk.withContext(function($ctx1) {
  12503. var $1;
  12504. $1=$Stream();
  12505. return $1;
  12506. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection.klass)})},
  12507. args: [],
  12508. source: "streamClass\x0a\x09\x09^Stream",
  12509. messageSends: [],
  12510. referencedClasses: ["Stream"]
  12511. }),
  12512. smalltalk.SequenceableCollection.klass);
  12513. smalltalk.addMethod(
  12514. smalltalk.method({
  12515. selector: "streamContents:",
  12516. category: 'streaming',
  12517. fn: function (aBlock){
  12518. var self=this;
  12519. var stream;
  12520. return smalltalk.withContext(function($ctx1) {
  12521. var $1;
  12522. stream=_st(self._streamClass())._on_(self._new());
  12523. _st(aBlock)._value_(stream);
  12524. $1=_st(stream)._contents();
  12525. return $1;
  12526. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},smalltalk.SequenceableCollection.klass)})},
  12527. args: ["aBlock"],
  12528. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  12529. messageSends: ["on:", "new", "streamClass", "value:", "contents"],
  12530. referencedClasses: []
  12531. }),
  12532. smalltalk.SequenceableCollection.klass);
  12533. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  12534. 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`.";
  12535. smalltalk.addMethod(
  12536. smalltalk.method({
  12537. selector: "add:",
  12538. category: 'adding/removing',
  12539. fn: function (anObject){
  12540. var self=this;
  12541. return smalltalk.withContext(function($ctx1) {
  12542. self.push(anObject); return anObject;;
  12543. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Array)})},
  12544. args: ["anObject"],
  12545. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  12546. messageSends: [],
  12547. referencedClasses: []
  12548. }),
  12549. smalltalk.Array);
  12550. smalltalk.addMethod(
  12551. smalltalk.method({
  12552. selector: "asJavascript",
  12553. category: 'converting',
  12554. fn: function (){
  12555. var self=this;
  12556. return smalltalk.withContext(function($ctx1) {
  12557. var $1;
  12558. $1=_st("[".__comma(_st(self._collect_((function(each){
  12559. return smalltalk.withContext(function($ctx2) {
  12560. return _st(each)._asJavascript();
  12561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._join_(", "))).__comma("]");
  12562. return $1;
  12563. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Array)})},
  12564. args: [],
  12565. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  12566. messageSends: [",", "join:", "collect:", "asJavascript"],
  12567. referencedClasses: []
  12568. }),
  12569. smalltalk.Array);
  12570. smalltalk.addMethod(
  12571. smalltalk.method({
  12572. selector: "at:ifAbsent:",
  12573. category: 'accessing',
  12574. fn: function (anIndex,aBlock){
  12575. var self=this;
  12576. return smalltalk.withContext(function($ctx1) {
  12577. if((anIndex < 1) || (self.length < anIndex)) {return aBlock._value()};
  12578. return self[anIndex - 1];
  12579. ;
  12580. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.Array)})},
  12581. args: ["anIndex", "aBlock"],
  12582. 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>",
  12583. messageSends: [],
  12584. referencedClasses: []
  12585. }),
  12586. smalltalk.Array);
  12587. smalltalk.addMethod(
  12588. smalltalk.method({
  12589. selector: "at:ifPresent:ifAbsent:",
  12590. category: 'accessing',
  12591. fn: function (anIndex,aBlock,anotherBlock){
  12592. var self=this;
  12593. return smalltalk.withContext(function($ctx1) {
  12594. return anIndex < 1 || self.length < anIndex ? anotherBlock._value() : aBlock._value_(self[anIndex - 1]);;
  12595. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Array)})},
  12596. args: ["anIndex", "aBlock", "anotherBlock"],
  12597. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<return anIndex < 1 || self.length < anIndex ? anotherBlock._value() : aBlock._value_(self[anIndex - 1]);>",
  12598. messageSends: [],
  12599. referencedClasses: []
  12600. }),
  12601. smalltalk.Array);
  12602. smalltalk.addMethod(
  12603. smalltalk.method({
  12604. selector: "at:put:",
  12605. category: 'accessing',
  12606. fn: function (anIndex,anObject){
  12607. var self=this;
  12608. return smalltalk.withContext(function($ctx1) {
  12609. return self[anIndex - 1] = anObject;
  12610. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.Array)})},
  12611. args: ["anIndex", "anObject"],
  12612. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  12613. messageSends: [],
  12614. referencedClasses: []
  12615. }),
  12616. smalltalk.Array);
  12617. smalltalk.addMethod(
  12618. smalltalk.method({
  12619. selector: "join:",
  12620. category: 'enumerating',
  12621. fn: function (aString){
  12622. var self=this;
  12623. return smalltalk.withContext(function($ctx1) {
  12624. return self.join(aString);
  12625. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},smalltalk.Array)})},
  12626. args: ["aString"],
  12627. source: "join: aString\x0a\x09<return self.join(aString)>",
  12628. messageSends: [],
  12629. referencedClasses: []
  12630. }),
  12631. smalltalk.Array);
  12632. smalltalk.addMethod(
  12633. smalltalk.method({
  12634. selector: "printOn:",
  12635. category: 'printing',
  12636. fn: function (aStream){
  12637. var self=this;
  12638. return smalltalk.withContext(function($ctx1) {
  12639. smalltalk.SequenceableCollection.fn.prototype._printOn_.apply(_st(self), [aStream]);
  12640. _st(aStream)._nextPutAll_(" (");
  12641. self._do_separatedBy_((function(each){
  12642. return smalltalk.withContext(function($ctx2) {
  12643. return _st(each)._printOn_(aStream);
  12644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  12645. return smalltalk.withContext(function($ctx2) {
  12646. return _st(aStream)._nextPutAll_(" ");
  12647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  12648. _st(aStream)._nextPutAll_(")");
  12649. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Array)})},
  12650. args: ["aStream"],
  12651. 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: ')'",
  12652. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  12653. referencedClasses: []
  12654. }),
  12655. smalltalk.Array);
  12656. smalltalk.addMethod(
  12657. smalltalk.method({
  12658. selector: "remove:ifAbsent:",
  12659. category: 'adding/removing',
  12660. fn: function (anObject,aBlock){
  12661. var self=this;
  12662. return smalltalk.withContext(function($ctx1) {
  12663. for(var i=0;i<self.length;i++) {
  12664. if(_st(self[i]).__eq(anObject)) {
  12665. self.splice(i,1);
  12666. return self;
  12667. }
  12668. };
  12669. aBlock._value();
  12670. ;
  12671. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Array)})},
  12672. args: ["anObject", "aBlock"],
  12673. 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>",
  12674. messageSends: [],
  12675. referencedClasses: []
  12676. }),
  12677. smalltalk.Array);
  12678. smalltalk.addMethod(
  12679. smalltalk.method({
  12680. selector: "removeFrom:to:",
  12681. category: 'adding/removing',
  12682. fn: function (aNumber,anotherNumber){
  12683. var self=this;
  12684. return smalltalk.withContext(function($ctx1) {
  12685. self.splice(aNumber - 1,anotherNumber - 1);
  12686. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Array)})},
  12687. args: ["aNumber", "anotherNumber"],
  12688. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  12689. messageSends: [],
  12690. referencedClasses: []
  12691. }),
  12692. smalltalk.Array);
  12693. smalltalk.addMethod(
  12694. smalltalk.method({
  12695. selector: "reversed",
  12696. category: 'converting',
  12697. fn: function (){
  12698. var self=this;
  12699. return smalltalk.withContext(function($ctx1) {
  12700. return self._copy().reverse();
  12701. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.Array)})},
  12702. args: [],
  12703. source: "reversed\x0a\x09<return self._copy().reverse()>",
  12704. messageSends: [],
  12705. referencedClasses: []
  12706. }),
  12707. smalltalk.Array);
  12708. smalltalk.addMethod(
  12709. smalltalk.method({
  12710. selector: "size",
  12711. category: 'accessing',
  12712. fn: function (){
  12713. var self=this;
  12714. return smalltalk.withContext(function($ctx1) {
  12715. return self.length;
  12716. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Array)})},
  12717. args: [],
  12718. source: "size\x0a\x09<return self.length>",
  12719. messageSends: [],
  12720. referencedClasses: []
  12721. }),
  12722. smalltalk.Array);
  12723. smalltalk.addMethod(
  12724. smalltalk.method({
  12725. selector: "sort",
  12726. category: 'enumerating',
  12727. fn: function (){
  12728. var self=this;
  12729. return smalltalk.withContext(function($ctx1) {
  12730. var $1;
  12731. $1=self._basicPerform_("sort");
  12732. return $1;
  12733. }, function($ctx1) {$ctx1.fill(self,"sort",{},smalltalk.Array)})},
  12734. args: [],
  12735. source: "sort\x0a\x09^self basicPerform: 'sort'",
  12736. messageSends: ["basicPerform:"],
  12737. referencedClasses: []
  12738. }),
  12739. smalltalk.Array);
  12740. smalltalk.addMethod(
  12741. smalltalk.method({
  12742. selector: "sort:",
  12743. category: 'enumerating',
  12744. fn: function (aBlock){
  12745. var self=this;
  12746. return smalltalk.withContext(function($ctx1) {
  12747. return self.sort(function(a, b) {
  12748. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  12749. })
  12750. ;
  12751. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},smalltalk.Array)})},
  12752. args: ["aBlock"],
  12753. 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>",
  12754. messageSends: [],
  12755. referencedClasses: []
  12756. }),
  12757. smalltalk.Array);
  12758. smalltalk.addMethod(
  12759. smalltalk.method({
  12760. selector: "sorted",
  12761. category: 'enumerating',
  12762. fn: function (){
  12763. var self=this;
  12764. return smalltalk.withContext(function($ctx1) {
  12765. var $1;
  12766. $1=_st(self._copy())._sort();
  12767. return $1;
  12768. }, function($ctx1) {$ctx1.fill(self,"sorted",{},smalltalk.Array)})},
  12769. args: [],
  12770. source: "sorted\x0a\x09^self copy sort",
  12771. messageSends: ["sort", "copy"],
  12772. referencedClasses: []
  12773. }),
  12774. smalltalk.Array);
  12775. smalltalk.addMethod(
  12776. smalltalk.method({
  12777. selector: "sorted:",
  12778. category: 'enumerating',
  12779. fn: function (aBlock){
  12780. var self=this;
  12781. return smalltalk.withContext(function($ctx1) {
  12782. var $1;
  12783. $1=_st(self._copy())._sort_(aBlock);
  12784. return $1;
  12785. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},smalltalk.Array)})},
  12786. args: ["aBlock"],
  12787. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  12788. messageSends: ["sort:", "copy"],
  12789. referencedClasses: []
  12790. }),
  12791. smalltalk.Array);
  12792. smalltalk.addMethod(
  12793. smalltalk.method({
  12794. selector: "new:",
  12795. category: 'instance creation',
  12796. fn: function (anInteger){
  12797. var self=this;
  12798. return smalltalk.withContext(function($ctx1) {
  12799. return new Array(anInteger);
  12800. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Array.klass)})},
  12801. args: ["anInteger"],
  12802. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  12803. messageSends: [],
  12804. referencedClasses: []
  12805. }),
  12806. smalltalk.Array.klass);
  12807. smalltalk.addMethod(
  12808. smalltalk.method({
  12809. selector: "with:",
  12810. category: 'instance creation',
  12811. fn: function (anObject){
  12812. var self=this;
  12813. return smalltalk.withContext(function($ctx1) {
  12814. var $2,$3,$1;
  12815. $2=self._new_((1));
  12816. _st($2)._at_put_((1),anObject);
  12817. $3=_st($2)._yourself();
  12818. $1=$3;
  12819. return $1;
  12820. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Array.klass)})},
  12821. args: ["anObject"],
  12822. source: "with: anObject\x0a\x09\x09^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  12823. messageSends: ["at:put:", "new:", "yourself"],
  12824. referencedClasses: []
  12825. }),
  12826. smalltalk.Array.klass);
  12827. smalltalk.addMethod(
  12828. smalltalk.method({
  12829. selector: "with:with:",
  12830. category: 'instance creation',
  12831. fn: function (anObject,anObject2){
  12832. var self=this;
  12833. return smalltalk.withContext(function($ctx1) {
  12834. var $2,$3,$1;
  12835. $2=self._new_((2));
  12836. _st($2)._at_put_((1),anObject);
  12837. _st($2)._at_put_((2),anObject2);
  12838. $3=_st($2)._yourself();
  12839. $1=$3;
  12840. return $1;
  12841. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},smalltalk.Array.klass)})},
  12842. args: ["anObject", "anObject2"],
  12843. 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",
  12844. messageSends: ["at:put:", "new:", "yourself"],
  12845. referencedClasses: []
  12846. }),
  12847. smalltalk.Array.klass);
  12848. smalltalk.addMethod(
  12849. smalltalk.method({
  12850. selector: "with:with:with:",
  12851. category: 'instance creation',
  12852. fn: function (anObject,anObject2,anObject3){
  12853. var self=this;
  12854. return smalltalk.withContext(function($ctx1) {
  12855. var $2,$3,$1;
  12856. $2=self._new_((3));
  12857. _st($2)._at_put_((1),anObject);
  12858. _st($2)._at_put_((2),anObject2);
  12859. _st($2)._at_put_((3),anObject3);
  12860. $3=_st($2)._yourself();
  12861. $1=$3;
  12862. return $1;
  12863. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.Array.klass)})},
  12864. args: ["anObject", "anObject2", "anObject3"],
  12865. 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",
  12866. messageSends: ["at:put:", "new:", "yourself"],
  12867. referencedClasses: []
  12868. }),
  12869. smalltalk.Array.klass);
  12870. smalltalk.addMethod(
  12871. smalltalk.method({
  12872. selector: "withAll:",
  12873. category: 'instance creation',
  12874. fn: function (aCollection){
  12875. var self=this;
  12876. var instance,index;
  12877. return smalltalk.withContext(function($ctx1) {
  12878. var $1;
  12879. index=(1);
  12880. instance=self._new_(_st(aCollection)._size());
  12881. _st(aCollection)._do_((function(each){
  12882. return smalltalk.withContext(function($ctx2) {
  12883. _st(instance)._at_put_(index,each);
  12884. index=_st(index).__plus((1));
  12885. return index;
  12886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  12887. $1=instance;
  12888. return $1;
  12889. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},smalltalk.Array.klass)})},
  12890. args: ["aCollection"],
  12891. 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",
  12892. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  12893. referencedClasses: []
  12894. }),
  12895. smalltalk.Array.klass);
  12896. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  12897. smalltalk.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  12898. smalltalk.addMethod(
  12899. smalltalk.method({
  12900. selector: ",",
  12901. category: 'copying',
  12902. fn: function (aString){
  12903. var self=this;
  12904. return smalltalk.withContext(function($ctx1) {
  12905. var $1;
  12906. $1=_st(self._asString()).__comma(_st(aString)._asString());
  12907. return $1;
  12908. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.CharacterArray)})},
  12909. args: ["aString"],
  12910. source: ", aString\x0a\x09^self asString, aString asString",
  12911. messageSends: [",", "asString"],
  12912. referencedClasses: []
  12913. }),
  12914. smalltalk.CharacterArray);
  12915. smalltalk.addMethod(
  12916. smalltalk.method({
  12917. selector: "add:",
  12918. category: 'adding',
  12919. fn: function (anObject){
  12920. var self=this;
  12921. return smalltalk.withContext(function($ctx1) {
  12922. self._errorReadOnly();
  12923. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.CharacterArray)})},
  12924. args: ["anObject"],
  12925. source: "add: anObject\x0a\x09self errorReadOnly",
  12926. messageSends: ["errorReadOnly"],
  12927. referencedClasses: []
  12928. }),
  12929. smalltalk.CharacterArray);
  12930. smalltalk.addMethod(
  12931. smalltalk.method({
  12932. selector: "asLowercase",
  12933. category: 'converting',
  12934. fn: function (){
  12935. var self=this;
  12936. return smalltalk.withContext(function($ctx1) {
  12937. var $1;
  12938. $1=_st(self._class())._fromString_(_st(self._asString())._asLowercase());
  12939. return $1;
  12940. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.CharacterArray)})},
  12941. args: [],
  12942. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  12943. messageSends: ["fromString:", "asLowercase", "asString", "class"],
  12944. referencedClasses: []
  12945. }),
  12946. smalltalk.CharacterArray);
  12947. smalltalk.addMethod(
  12948. smalltalk.method({
  12949. selector: "asNumber",
  12950. category: 'converting',
  12951. fn: function (){
  12952. var self=this;
  12953. return smalltalk.withContext(function($ctx1) {
  12954. var $1;
  12955. $1=_st(self._asString())._asNumber();
  12956. return $1;
  12957. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.CharacterArray)})},
  12958. args: [],
  12959. source: "asNumber\x0a\x09^self asString asNumber",
  12960. messageSends: ["asNumber", "asString"],
  12961. referencedClasses: []
  12962. }),
  12963. smalltalk.CharacterArray);
  12964. smalltalk.addMethod(
  12965. smalltalk.method({
  12966. selector: "asString",
  12967. category: 'converting',
  12968. fn: function (){
  12969. var self=this;
  12970. return smalltalk.withContext(function($ctx1) {
  12971. var $1;
  12972. $1=self._subclassResponsibility();
  12973. return $1;
  12974. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.CharacterArray)})},
  12975. args: [],
  12976. source: "asString\x0a\x09^self subclassResponsibility",
  12977. messageSends: ["subclassResponsibility"],
  12978. referencedClasses: []
  12979. }),
  12980. smalltalk.CharacterArray);
  12981. smalltalk.addMethod(
  12982. smalltalk.method({
  12983. selector: "asSymbol",
  12984. category: 'converting',
  12985. fn: function (){
  12986. var self=this;
  12987. return smalltalk.withContext(function($ctx1) {
  12988. var $1;
  12989. $1=self._asString();
  12990. return $1;
  12991. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.CharacterArray)})},
  12992. args: [],
  12993. source: "asSymbol\x0a\x09^self asString",
  12994. messageSends: ["asString"],
  12995. referencedClasses: []
  12996. }),
  12997. smalltalk.CharacterArray);
  12998. smalltalk.addMethod(
  12999. smalltalk.method({
  13000. selector: "asUppercase",
  13001. category: 'converting',
  13002. fn: function (){
  13003. var self=this;
  13004. return smalltalk.withContext(function($ctx1) {
  13005. var $1;
  13006. $1=_st(self._class())._fromString_(_st(self._asString())._asUppercase());
  13007. return $1;
  13008. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.CharacterArray)})},
  13009. args: [],
  13010. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  13011. messageSends: ["fromString:", "asUppercase", "asString", "class"],
  13012. referencedClasses: []
  13013. }),
  13014. smalltalk.CharacterArray);
  13015. smalltalk.addMethod(
  13016. smalltalk.method({
  13017. selector: "at:put:",
  13018. category: 'accessing',
  13019. fn: function (anIndex,anObject){
  13020. var self=this;
  13021. return smalltalk.withContext(function($ctx1) {
  13022. self._errorReadOnly();
  13023. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.CharacterArray)})},
  13024. args: ["anIndex", "anObject"],
  13025. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  13026. messageSends: ["errorReadOnly"],
  13027. referencedClasses: []
  13028. }),
  13029. smalltalk.CharacterArray);
  13030. smalltalk.addMethod(
  13031. smalltalk.method({
  13032. selector: "errorReadOnly",
  13033. category: 'error handling',
  13034. fn: function (){
  13035. var self=this;
  13036. return smalltalk.withContext(function($ctx1) {
  13037. self._error_("Object is read-only");
  13038. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},smalltalk.CharacterArray)})},
  13039. args: [],
  13040. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  13041. messageSends: ["error:"],
  13042. referencedClasses: []
  13043. }),
  13044. smalltalk.CharacterArray);
  13045. smalltalk.addMethod(
  13046. smalltalk.method({
  13047. selector: "printOn:",
  13048. category: 'printing',
  13049. fn: function (aStream){
  13050. var self=this;
  13051. return smalltalk.withContext(function($ctx1) {
  13052. _st(self._asString())._printOn_(aStream);
  13053. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.CharacterArray)})},
  13054. args: ["aStream"],
  13055. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  13056. messageSends: ["printOn:", "asString"],
  13057. referencedClasses: []
  13058. }),
  13059. smalltalk.CharacterArray);
  13060. smalltalk.addMethod(
  13061. smalltalk.method({
  13062. selector: "putOn:",
  13063. category: 'streaming',
  13064. fn: function (aStream){
  13065. var self=this;
  13066. return smalltalk.withContext(function($ctx1) {
  13067. _st(aStream)._nextPutString_(self);
  13068. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.CharacterArray)})},
  13069. args: ["aStream"],
  13070. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  13071. messageSends: ["nextPutString:"],
  13072. referencedClasses: []
  13073. }),
  13074. smalltalk.CharacterArray);
  13075. smalltalk.addMethod(
  13076. smalltalk.method({
  13077. selector: "remove:",
  13078. category: 'adding',
  13079. fn: function (anObject){
  13080. var self=this;
  13081. return smalltalk.withContext(function($ctx1) {
  13082. self._errorReadOnly();
  13083. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.CharacterArray)})},
  13084. args: ["anObject"],
  13085. source: "remove: anObject\x0a\x09self errorReadOnly",
  13086. messageSends: ["errorReadOnly"],
  13087. referencedClasses: []
  13088. }),
  13089. smalltalk.CharacterArray);
  13090. smalltalk.addMethod(
  13091. smalltalk.method({
  13092. selector: "fromString:",
  13093. category: 'instance creation',
  13094. fn: function (aString){
  13095. var self=this;
  13096. return smalltalk.withContext(function($ctx1) {
  13097. self._subclassResponsibility();
  13098. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.CharacterArray.klass)})},
  13099. args: ["aString"],
  13100. source: "fromString: aString\x0a\x09self subclassResponsibility",
  13101. messageSends: ["subclassResponsibility"],
  13102. referencedClasses: []
  13103. }),
  13104. smalltalk.CharacterArray.klass);
  13105. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  13106. 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 >> #,`";
  13107. smalltalk.addMethod(
  13108. smalltalk.method({
  13109. selector: ",",
  13110. category: 'copying',
  13111. fn: function (aString){
  13112. var self=this;
  13113. return smalltalk.withContext(function($ctx1) {
  13114. return self + aString;
  13115. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.String)})},
  13116. args: ["aString"],
  13117. source: ", aString\x0a\x09<return self + aString>",
  13118. messageSends: [],
  13119. referencedClasses: []
  13120. }),
  13121. smalltalk.String);
  13122. smalltalk.addMethod(
  13123. smalltalk.method({
  13124. selector: "<",
  13125. category: 'comparing',
  13126. fn: function (aString){
  13127. var self=this;
  13128. return smalltalk.withContext(function($ctx1) {
  13129. return String(self) < aString._asString();
  13130. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},smalltalk.String)})},
  13131. args: ["aString"],
  13132. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  13133. messageSends: [],
  13134. referencedClasses: []
  13135. }),
  13136. smalltalk.String);
  13137. smalltalk.addMethod(
  13138. smalltalk.method({
  13139. selector: "<=",
  13140. category: 'comparing',
  13141. fn: function (aString){
  13142. var self=this;
  13143. return smalltalk.withContext(function($ctx1) {
  13144. return String(self) <= aString._asString();
  13145. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},smalltalk.String)})},
  13146. args: ["aString"],
  13147. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  13148. messageSends: [],
  13149. referencedClasses: []
  13150. }),
  13151. smalltalk.String);
  13152. smalltalk.addMethod(
  13153. smalltalk.method({
  13154. selector: "=",
  13155. category: 'comparing',
  13156. fn: function (aString){
  13157. var self=this;
  13158. return smalltalk.withContext(function($ctx1) {
  13159. if(typeof aString === 'undefined') { return false }
  13160. if(!aString._isString || ! aString._isString()) {
  13161. return false;
  13162. }
  13163. return String(self) === String(aString)
  13164. ;
  13165. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},smalltalk.String)})},
  13166. args: ["aString"],
  13167. 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>",
  13168. messageSends: [],
  13169. referencedClasses: []
  13170. }),
  13171. smalltalk.String);
  13172. smalltalk.addMethod(
  13173. smalltalk.method({
  13174. selector: "==",
  13175. category: 'comparing',
  13176. fn: function (aString){
  13177. var self=this;
  13178. return smalltalk.withContext(function($ctx1) {
  13179. var $1;
  13180. $1=self.__eq(aString);
  13181. return $1;
  13182. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},smalltalk.String)})},
  13183. args: ["aString"],
  13184. source: "== aString\x0a\x09^self = aString",
  13185. messageSends: ["="],
  13186. referencedClasses: []
  13187. }),
  13188. smalltalk.String);
  13189. smalltalk.addMethod(
  13190. smalltalk.method({
  13191. selector: ">",
  13192. category: 'comparing',
  13193. fn: function (aString){
  13194. var self=this;
  13195. return smalltalk.withContext(function($ctx1) {
  13196. return String(self) > aString._asString();
  13197. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString},smalltalk.String)})},
  13198. args: ["aString"],
  13199. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  13200. messageSends: [],
  13201. referencedClasses: []
  13202. }),
  13203. smalltalk.String);
  13204. smalltalk.addMethod(
  13205. smalltalk.method({
  13206. selector: ">=",
  13207. category: 'comparing',
  13208. fn: function (aString){
  13209. var self=this;
  13210. return smalltalk.withContext(function($ctx1) {
  13211. return String(self) >= aString._asString();
  13212. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},smalltalk.String)})},
  13213. args: ["aString"],
  13214. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  13215. messageSends: [],
  13216. referencedClasses: []
  13217. }),
  13218. smalltalk.String);
  13219. smalltalk.addMethod(
  13220. smalltalk.method({
  13221. selector: "asJSON",
  13222. category: 'converting',
  13223. fn: function (){
  13224. var self=this;
  13225. return smalltalk.withContext(function($ctx1) {
  13226. var $1;
  13227. $1=self;
  13228. return $1;
  13229. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.String)})},
  13230. args: [],
  13231. source: "asJSON\x0a\x09^self",
  13232. messageSends: [],
  13233. referencedClasses: []
  13234. }),
  13235. smalltalk.String);
  13236. smalltalk.addMethod(
  13237. smalltalk.method({
  13238. selector: "asJavascript",
  13239. category: 'converting',
  13240. fn: function (){
  13241. var self=this;
  13242. return smalltalk.withContext(function($ctx1) {
  13243. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  13244. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  13245. else
  13246. return "\"" + self + "\"";
  13247. ;
  13248. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.String)})},
  13249. args: [],
  13250. 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>",
  13251. messageSends: [],
  13252. referencedClasses: []
  13253. }),
  13254. smalltalk.String);
  13255. smalltalk.addMethod(
  13256. smalltalk.method({
  13257. selector: "asLowercase",
  13258. category: 'converting',
  13259. fn: function (){
  13260. var self=this;
  13261. return smalltalk.withContext(function($ctx1) {
  13262. return self.toLowerCase();
  13263. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.String)})},
  13264. args: [],
  13265. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  13266. messageSends: [],
  13267. referencedClasses: []
  13268. }),
  13269. smalltalk.String);
  13270. smalltalk.addMethod(
  13271. smalltalk.method({
  13272. selector: "asNumber",
  13273. category: 'converting',
  13274. fn: function (){
  13275. var self=this;
  13276. return smalltalk.withContext(function($ctx1) {
  13277. return Number(self);
  13278. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.String)})},
  13279. args: [],
  13280. source: "asNumber\x0a\x09<return Number(self)>",
  13281. messageSends: [],
  13282. referencedClasses: []
  13283. }),
  13284. smalltalk.String);
  13285. smalltalk.addMethod(
  13286. smalltalk.method({
  13287. selector: "asRegexp",
  13288. category: 'converting',
  13289. fn: function (){
  13290. var self=this;
  13291. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13292. return smalltalk.withContext(function($ctx1) {
  13293. var $1;
  13294. $1=_st($RegularExpression())._fromString_(self);
  13295. return $1;
  13296. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},smalltalk.String)})},
  13297. args: [],
  13298. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  13299. messageSends: ["fromString:"],
  13300. referencedClasses: ["RegularExpression"]
  13301. }),
  13302. smalltalk.String);
  13303. smalltalk.addMethod(
  13304. smalltalk.method({
  13305. selector: "asSelector",
  13306. category: 'converting',
  13307. fn: function (){
  13308. var self=this;
  13309. return smalltalk.withContext(function($ctx1) {
  13310. return smalltalk.selector(self);
  13311. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{},smalltalk.String)})},
  13312. args: [],
  13313. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  13314. messageSends: [],
  13315. referencedClasses: []
  13316. }),
  13317. smalltalk.String);
  13318. smalltalk.addMethod(
  13319. smalltalk.method({
  13320. selector: "asString",
  13321. category: 'converting',
  13322. fn: function (){
  13323. var self=this;
  13324. return smalltalk.withContext(function($ctx1) {
  13325. var $1;
  13326. $1=self;
  13327. return $1;
  13328. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.String)})},
  13329. args: [],
  13330. source: "asString\x0a\x09^self",
  13331. messageSends: [],
  13332. referencedClasses: []
  13333. }),
  13334. smalltalk.String);
  13335. smalltalk.addMethod(
  13336. smalltalk.method({
  13337. selector: "asSymbol",
  13338. category: 'converting',
  13339. fn: function (){
  13340. var self=this;
  13341. return smalltalk.withContext(function($ctx1) {
  13342. var $1;
  13343. $1=self;
  13344. return $1;
  13345. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.String)})},
  13346. args: [],
  13347. source: "asSymbol\x0a\x09^ self",
  13348. messageSends: [],
  13349. referencedClasses: []
  13350. }),
  13351. smalltalk.String);
  13352. smalltalk.addMethod(
  13353. smalltalk.method({
  13354. selector: "asUppercase",
  13355. category: 'converting',
  13356. fn: function (){
  13357. var self=this;
  13358. return smalltalk.withContext(function($ctx1) {
  13359. return self.toUpperCase();
  13360. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.String)})},
  13361. args: [],
  13362. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  13363. messageSends: [],
  13364. referencedClasses: []
  13365. }),
  13366. smalltalk.String);
  13367. smalltalk.addMethod(
  13368. smalltalk.method({
  13369. selector: "asciiValue",
  13370. category: 'accessing',
  13371. fn: function (){
  13372. var self=this;
  13373. return smalltalk.withContext(function($ctx1) {
  13374. return self.charCodeAt(0);;
  13375. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{},smalltalk.String)})},
  13376. args: [],
  13377. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  13378. messageSends: [],
  13379. referencedClasses: []
  13380. }),
  13381. smalltalk.String);
  13382. smalltalk.addMethod(
  13383. smalltalk.method({
  13384. selector: "at:ifAbsent:",
  13385. category: 'accessing',
  13386. fn: function (anIndex,aBlock){
  13387. var self=this;
  13388. return smalltalk.withContext(function($ctx1) {
  13389. return String(self).charAt(anIndex - 1) || aBlock._value();
  13390. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.String)})},
  13391. args: ["anIndex", "aBlock"],
  13392. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock._value()>",
  13393. messageSends: [],
  13394. referencedClasses: []
  13395. }),
  13396. smalltalk.String);
  13397. smalltalk.addMethod(
  13398. smalltalk.method({
  13399. selector: "at:ifPresent:ifAbsent:",
  13400. category: 'accessing',
  13401. fn: function (anIndex,aBlock,anotherBlock){
  13402. var self=this;
  13403. return smalltalk.withContext(function($ctx1) {
  13404. var result = String(self).charAt(anIndex - 1);
  13405. return result ? aBlock._value_(result) : anotherBlock._value();
  13406. ;
  13407. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.String)})},
  13408. args: ["anIndex", "aBlock", "anotherBlock"],
  13409. 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>",
  13410. messageSends: [],
  13411. referencedClasses: []
  13412. }),
  13413. smalltalk.String);
  13414. smalltalk.addMethod(
  13415. smalltalk.method({
  13416. selector: "charCodeAt:",
  13417. category: 'accessing',
  13418. fn: function (anInteger){
  13419. var self=this;
  13420. return smalltalk.withContext(function($ctx1) {
  13421. return self.charCodeAt(anInteger - 1) ;
  13422. return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},smalltalk.String)})},
  13423. args: ["anInteger"],
  13424. source: "charCodeAt: anInteger\x0a\x09< return self.charCodeAt(anInteger - 1) >",
  13425. messageSends: [],
  13426. referencedClasses: []
  13427. }),
  13428. smalltalk.String);
  13429. smalltalk.addMethod(
  13430. smalltalk.method({
  13431. selector: "copyFrom:to:",
  13432. category: 'copying',
  13433. fn: function (anIndex,anotherIndex){
  13434. var self=this;
  13435. return smalltalk.withContext(function($ctx1) {
  13436. return self.substring(anIndex - 1, anotherIndex);
  13437. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},smalltalk.String)})},
  13438. args: ["anIndex", "anotherIndex"],
  13439. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  13440. messageSends: [],
  13441. referencedClasses: []
  13442. }),
  13443. smalltalk.String);
  13444. smalltalk.addMethod(
  13445. smalltalk.method({
  13446. selector: "crlfSanitized",
  13447. category: 'converting',
  13448. fn: function (){
  13449. var self=this;
  13450. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  13451. return smalltalk.withContext(function($ctx1) {
  13452. var $1;
  13453. $1=_st(self._lines())._join_(_st($String())._lf());
  13454. return $1;
  13455. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},smalltalk.String)})},
  13456. args: [],
  13457. source: "crlfSanitized\x0a\x09^self lines join: String lf",
  13458. messageSends: ["join:", "lf", "lines"],
  13459. referencedClasses: ["String"]
  13460. }),
  13461. smalltalk.String);
  13462. smalltalk.addMethod(
  13463. smalltalk.method({
  13464. selector: "deepCopy",
  13465. category: 'copying',
  13466. fn: function (){
  13467. var self=this;
  13468. return smalltalk.withContext(function($ctx1) {
  13469. var $1;
  13470. $1=self._shallowCopy();
  13471. return $1;
  13472. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.String)})},
  13473. args: [],
  13474. source: "deepCopy\x0a\x09^self shallowCopy",
  13475. messageSends: ["shallowCopy"],
  13476. referencedClasses: []
  13477. }),
  13478. smalltalk.String);
  13479. smalltalk.addMethod(
  13480. smalltalk.method({
  13481. selector: "do:",
  13482. category: 'enumerating',
  13483. fn: function (aBlock){
  13484. var self=this;
  13485. return smalltalk.withContext(function($ctx1) {
  13486. for(var i=0;i<self.length;i++){aBlock._value_(self.charAt(i));};
  13487. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.String)})},
  13488. args: ["aBlock"],
  13489. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_(self.charAt(i));}>",
  13490. messageSends: [],
  13491. referencedClasses: []
  13492. }),
  13493. smalltalk.String);
  13494. smalltalk.addMethod(
  13495. smalltalk.method({
  13496. selector: "escaped",
  13497. category: 'accessing',
  13498. fn: function (){
  13499. var self=this;
  13500. return smalltalk.withContext(function($ctx1) {
  13501. return escape(self);
  13502. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{},smalltalk.String)})},
  13503. args: [],
  13504. source: "escaped\x0a\x09<return escape(self)>",
  13505. messageSends: [],
  13506. referencedClasses: []
  13507. }),
  13508. smalltalk.String);
  13509. smalltalk.addMethod(
  13510. smalltalk.method({
  13511. selector: "includesSubString:",
  13512. category: 'testing',
  13513. fn: function (subString){
  13514. var self=this;
  13515. return smalltalk.withContext(function($ctx1) {
  13516. return self.indexOf(subString) != -1 ;
  13517. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},smalltalk.String)})},
  13518. args: ["subString"],
  13519. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  13520. messageSends: [],
  13521. referencedClasses: []
  13522. }),
  13523. smalltalk.String);
  13524. smalltalk.addMethod(
  13525. smalltalk.method({
  13526. selector: "isImmutable",
  13527. category: 'testing',
  13528. fn: function (){
  13529. var self=this;
  13530. return smalltalk.withContext(function($ctx1) {
  13531. return true;
  13532. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.String)})},
  13533. args: [],
  13534. source: "isImmutable\x0a\x09^ true",
  13535. messageSends: [],
  13536. referencedClasses: []
  13537. }),
  13538. smalltalk.String);
  13539. smalltalk.addMethod(
  13540. smalltalk.method({
  13541. selector: "isString",
  13542. category: 'testing',
  13543. fn: function (){
  13544. var self=this;
  13545. return smalltalk.withContext(function($ctx1) {
  13546. return true;
  13547. }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.String)})},
  13548. args: [],
  13549. source: "isString\x0a\x09^true",
  13550. messageSends: [],
  13551. referencedClasses: []
  13552. }),
  13553. smalltalk.String);
  13554. smalltalk.addMethod(
  13555. smalltalk.method({
  13556. selector: "isVowel",
  13557. category: 'testing',
  13558. fn: function (){
  13559. var self=this;
  13560. return smalltalk.withContext(function($ctx1) {
  13561. var $1;
  13562. $1=_st(_st(self._size()).__eq((1)))._and_((function(){
  13563. return smalltalk.withContext(function($ctx2) {
  13564. return "aeiou"._includes_(self._asLowercase());
  13565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  13566. return $1;
  13567. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},smalltalk.String)})},
  13568. args: [],
  13569. 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 ]",
  13570. messageSends: ["and:", "includes:", "asLowercase", "=", "size"],
  13571. referencedClasses: []
  13572. }),
  13573. smalltalk.String);
  13574. smalltalk.addMethod(
  13575. smalltalk.method({
  13576. selector: "join:",
  13577. category: 'split join',
  13578. fn: function (aCollection){
  13579. var self=this;
  13580. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  13581. return smalltalk.withContext(function($ctx1) {
  13582. var $1;
  13583. $1=_st($String())._streamContents_((function(stream){
  13584. return smalltalk.withContext(function($ctx2) {
  13585. return _st(aCollection)._do_separatedBy_((function(each){
  13586. return smalltalk.withContext(function($ctx3) {
  13587. return _st(stream)._nextPutAll_(_st(each)._asString());
  13588. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}),(function(){
  13589. return smalltalk.withContext(function($ctx3) {
  13590. return _st(stream)._nextPutAll_(self);
  13591. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  13592. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  13593. return $1;
  13594. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},smalltalk.String)})},
  13595. args: ["aCollection"],
  13596. 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]]",
  13597. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  13598. referencedClasses: ["String"]
  13599. }),
  13600. smalltalk.String);
  13601. smalltalk.addMethod(
  13602. smalltalk.method({
  13603. selector: "lineIndicesDo:",
  13604. category: 'split join',
  13605. fn: function (aBlock){
  13606. var self=this;
  13607. var cr,lf,start,sz,nextLF,nextCR;
  13608. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  13609. return smalltalk.withContext(function($ctx1) {
  13610. var $1,$2,$3,$4;
  13611. var $early={};
  13612. try {
  13613. start=(1);
  13614. sz=self._size();
  13615. cr=_st($String())._cr();
  13616. nextCR=self._indexOf_startingAt_(cr,(1));
  13617. lf=_st($String())._lf();
  13618. nextLF=self._indexOf_startingAt_(lf,(1));
  13619. _st((function(){
  13620. return smalltalk.withContext(function($ctx2) {
  13621. return _st(start).__lt_eq(sz);
  13622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  13623. return smalltalk.withContext(function($ctx2) {
  13624. $1=_st(_st(nextLF).__eq((0)))._and_((function(){
  13625. return smalltalk.withContext(function($ctx3) {
  13626. return _st(nextCR).__eq((0));
  13627. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  13628. if(smalltalk.assert($1)){
  13629. _st(aBlock)._value_value_value_(start,sz,sz);
  13630. $2=self;
  13631. throw $early=[$2];
  13632. };
  13633. $3=_st(_st(nextCR).__eq((0)))._or_((function(){
  13634. return smalltalk.withContext(function($ctx3) {
  13635. return _st((0).__lt(nextLF))._and_((function(){
  13636. return smalltalk.withContext(function($ctx4) {
  13637. return _st(nextLF).__lt(nextCR);
  13638. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  13639. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  13640. if(smalltalk.assert($3)){
  13641. _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
  13642. start=(1).__plus(nextLF);
  13643. start;
  13644. nextLF=self._indexOf_startingAt_(lf,start);
  13645. return nextLF;
  13646. } else {
  13647. $4=_st((1).__plus(nextCR)).__eq(nextLF);
  13648. if(smalltalk.assert($4)){
  13649. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
  13650. start=(1).__plus(nextLF);
  13651. start;
  13652. nextCR=self._indexOf_startingAt_(cr,start);
  13653. nextCR;
  13654. nextLF=self._indexOf_startingAt_(lf,start);
  13655. return nextLF;
  13656. } else {
  13657. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  13658. start=(1).__plus(nextCR);
  13659. start;
  13660. nextCR=self._indexOf_startingAt_(cr,start);
  13661. return nextCR;
  13662. };
  13663. };
  13664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  13665. return self}
  13666. catch(e) {if(e===$early)return e[0]; throw e}
  13667. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},smalltalk.String)})},
  13668. args: ["aBlock"],
  13669. 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 ]]]",
  13670. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
  13671. referencedClasses: ["String"]
  13672. }),
  13673. smalltalk.String);
  13674. smalltalk.addMethod(
  13675. smalltalk.method({
  13676. selector: "lineNumber:",
  13677. category: 'split join',
  13678. fn: function (anIndex){
  13679. var self=this;
  13680. var lineCount;
  13681. return smalltalk.withContext(function($ctx1) {
  13682. var $1,$2;
  13683. var $early={};
  13684. try {
  13685. lineCount=(0);
  13686. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  13687. return smalltalk.withContext(function($ctx2) {
  13688. lineCount=_st(lineCount).__plus((1));
  13689. $1=_st(lineCount).__eq(anIndex);
  13690. if(smalltalk.assert($1)){
  13691. $2=self._copyFrom_to_(start,endWithoutDelimiters);
  13692. throw $early=[$2];
  13693. };
  13694. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  13695. return nil;
  13696. }
  13697. catch(e) {if(e===$early)return e[0]; throw e}
  13698. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},smalltalk.String)})},
  13699. args: ["anIndex"],
  13700. 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",
  13701. messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
  13702. referencedClasses: []
  13703. }),
  13704. smalltalk.String);
  13705. smalltalk.addMethod(
  13706. smalltalk.method({
  13707. selector: "lines",
  13708. category: 'split join',
  13709. fn: function (){
  13710. var self=this;
  13711. var lines;
  13712. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  13713. return smalltalk.withContext(function($ctx1) {
  13714. var $1;
  13715. lines=_st($Array())._new();
  13716. self._linesDo_((function(aLine){
  13717. return smalltalk.withContext(function($ctx2) {
  13718. return _st(lines)._add_(aLine);
  13719. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1)})}));
  13720. $1=lines;
  13721. return $1;
  13722. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},smalltalk.String)})},
  13723. args: [],
  13724. 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",
  13725. messageSends: ["new", "linesDo:", "add:"],
  13726. referencedClasses: ["Array"]
  13727. }),
  13728. smalltalk.String);
  13729. smalltalk.addMethod(
  13730. smalltalk.method({
  13731. selector: "linesDo:",
  13732. category: 'split join',
  13733. fn: function (aBlock){
  13734. var self=this;
  13735. return smalltalk.withContext(function($ctx1) {
  13736. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  13737. return smalltalk.withContext(function($ctx2) {
  13738. return _st(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  13739. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  13740. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},smalltalk.String)})},
  13741. args: ["aBlock"],
  13742. 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)]",
  13743. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  13744. referencedClasses: []
  13745. }),
  13746. smalltalk.String);
  13747. smalltalk.addMethod(
  13748. smalltalk.method({
  13749. selector: "match:",
  13750. category: 'regular expressions',
  13751. fn: function (aRegexp){
  13752. var self=this;
  13753. return smalltalk.withContext(function($ctx1) {
  13754. return self.search(aRegexp) != -1;
  13755. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},smalltalk.String)})},
  13756. args: ["aRegexp"],
  13757. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  13758. messageSends: [],
  13759. referencedClasses: []
  13760. }),
  13761. smalltalk.String);
  13762. smalltalk.addMethod(
  13763. smalltalk.method({
  13764. selector: "matchesOf:",
  13765. category: 'regular expressions',
  13766. fn: function (aRegularExpression){
  13767. var self=this;
  13768. return smalltalk.withContext(function($ctx1) {
  13769. return self.match(aRegularExpression);
  13770. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},smalltalk.String)})},
  13771. args: ["aRegularExpression"],
  13772. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  13773. messageSends: [],
  13774. referencedClasses: []
  13775. }),
  13776. smalltalk.String);
  13777. smalltalk.addMethod(
  13778. smalltalk.method({
  13779. selector: "printNl",
  13780. category: 'printing',
  13781. fn: function (){
  13782. var self=this;
  13783. return smalltalk.withContext(function($ctx1) {
  13784. console.log(self);
  13785. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{},smalltalk.String)})},
  13786. args: [],
  13787. source: "printNl\x0a\x09<console.log(self)>",
  13788. messageSends: [],
  13789. referencedClasses: []
  13790. }),
  13791. smalltalk.String);
  13792. smalltalk.addMethod(
  13793. smalltalk.method({
  13794. selector: "printOn:",
  13795. category: 'printing',
  13796. fn: function (aStream){
  13797. var self=this;
  13798. return smalltalk.withContext(function($ctx1) {
  13799. var $1,$2;
  13800. $1=aStream;
  13801. _st($1)._nextPutAll_("'");
  13802. _st($1)._nextPutAll_(self);
  13803. $2=_st($1)._nextPutAll_("'");
  13804. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.String)})},
  13805. args: ["aStream"],
  13806. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  13807. messageSends: ["nextPutAll:"],
  13808. referencedClasses: []
  13809. }),
  13810. smalltalk.String);
  13811. smalltalk.addMethod(
  13812. smalltalk.method({
  13813. selector: "replace:with:",
  13814. category: 'regular expressions',
  13815. fn: function (aString,anotherString){
  13816. var self=this;
  13817. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13818. return smalltalk.withContext(function($ctx1) {
  13819. var $1;
  13820. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  13821. return $1;
  13822. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},smalltalk.String)})},
  13823. args: ["aString", "anotherString"],
  13824. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  13825. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  13826. referencedClasses: ["RegularExpression"]
  13827. }),
  13828. smalltalk.String);
  13829. smalltalk.addMethod(
  13830. smalltalk.method({
  13831. selector: "replaceRegexp:with:",
  13832. category: 'regular expressions',
  13833. fn: function (aRegexp,aString){
  13834. var self=this;
  13835. return smalltalk.withContext(function($ctx1) {
  13836. return self.replace(aRegexp, aString);
  13837. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},smalltalk.String)})},
  13838. args: ["aRegexp", "aString"],
  13839. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  13840. messageSends: [],
  13841. referencedClasses: []
  13842. }),
  13843. smalltalk.String);
  13844. smalltalk.addMethod(
  13845. smalltalk.method({
  13846. selector: "reversed",
  13847. category: 'converting',
  13848. fn: function (){
  13849. var self=this;
  13850. return smalltalk.withContext(function($ctx1) {
  13851. return self.split("").reverse().join("");
  13852. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.String)})},
  13853. args: [],
  13854. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  13855. messageSends: [],
  13856. referencedClasses: []
  13857. }),
  13858. smalltalk.String);
  13859. smalltalk.addMethod(
  13860. smalltalk.method({
  13861. selector: "shallowCopy",
  13862. category: 'copying',
  13863. fn: function (){
  13864. var self=this;
  13865. return smalltalk.withContext(function($ctx1) {
  13866. var $1;
  13867. $1=_st(self._class())._fromString_(self);
  13868. return $1;
  13869. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.String)})},
  13870. args: [],
  13871. source: "shallowCopy\x0a\x09^self class fromString: self",
  13872. messageSends: ["fromString:", "class"],
  13873. referencedClasses: []
  13874. }),
  13875. smalltalk.String);
  13876. smalltalk.addMethod(
  13877. smalltalk.method({
  13878. selector: "size",
  13879. category: 'accessing',
  13880. fn: function (){
  13881. var self=this;
  13882. return smalltalk.withContext(function($ctx1) {
  13883. return self.length;
  13884. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.String)})},
  13885. args: [],
  13886. source: "size\x0a\x09<return self.length>",
  13887. messageSends: [],
  13888. referencedClasses: []
  13889. }),
  13890. smalltalk.String);
  13891. smalltalk.addMethod(
  13892. smalltalk.method({
  13893. selector: "subStrings:",
  13894. category: 'split join',
  13895. fn: function (aString){
  13896. var self=this;
  13897. return smalltalk.withContext(function($ctx1) {
  13898. var $1;
  13899. $1=self._tokenize_(aString);
  13900. return $1;
  13901. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},smalltalk.String)})},
  13902. args: ["aString"],
  13903. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  13904. messageSends: ["tokenize:"],
  13905. referencedClasses: []
  13906. }),
  13907. smalltalk.String);
  13908. smalltalk.addMethod(
  13909. smalltalk.method({
  13910. selector: "tokenize:",
  13911. category: 'split join',
  13912. fn: function (aString){
  13913. var self=this;
  13914. return smalltalk.withContext(function($ctx1) {
  13915. return self.split(aString);
  13916. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},smalltalk.String)})},
  13917. args: ["aString"],
  13918. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  13919. messageSends: [],
  13920. referencedClasses: []
  13921. }),
  13922. smalltalk.String);
  13923. smalltalk.addMethod(
  13924. smalltalk.method({
  13925. selector: "trimBoth",
  13926. category: 'regular expressions',
  13927. fn: function (){
  13928. var self=this;
  13929. return smalltalk.withContext(function($ctx1) {
  13930. var $1;
  13931. $1=self._trimBoth_("\x5cs");
  13932. return $1;
  13933. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},smalltalk.String)})},
  13934. args: [],
  13935. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  13936. messageSends: ["trimBoth:"],
  13937. referencedClasses: []
  13938. }),
  13939. smalltalk.String);
  13940. smalltalk.addMethod(
  13941. smalltalk.method({
  13942. selector: "trimBoth:",
  13943. category: 'regular expressions',
  13944. fn: function (separators){
  13945. var self=this;
  13946. return smalltalk.withContext(function($ctx1) {
  13947. var $1;
  13948. $1=_st(self._trimLeft_(separators))._trimRight_(separators);
  13949. return $1;
  13950. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},smalltalk.String)})},
  13951. args: ["separators"],
  13952. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  13953. messageSends: ["trimRight:", "trimLeft:"],
  13954. referencedClasses: []
  13955. }),
  13956. smalltalk.String);
  13957. smalltalk.addMethod(
  13958. smalltalk.method({
  13959. selector: "trimLeft",
  13960. category: 'regular expressions',
  13961. fn: function (){
  13962. var self=this;
  13963. return smalltalk.withContext(function($ctx1) {
  13964. var $1;
  13965. $1=self._trimLeft_("\x5cs");
  13966. return $1;
  13967. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},smalltalk.String)})},
  13968. args: [],
  13969. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  13970. messageSends: ["trimLeft:"],
  13971. referencedClasses: []
  13972. }),
  13973. smalltalk.String);
  13974. smalltalk.addMethod(
  13975. smalltalk.method({
  13976. selector: "trimLeft:",
  13977. category: 'regular expressions',
  13978. fn: function (separators){
  13979. var self=this;
  13980. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13981. return smalltalk.withContext(function($ctx1) {
  13982. var $1;
  13983. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st("^[".__comma(separators)).__comma("]+"),"g"),"");
  13984. return $1;
  13985. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},smalltalk.String)})},
  13986. args: ["separators"],
  13987. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  13988. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  13989. referencedClasses: ["RegularExpression"]
  13990. }),
  13991. smalltalk.String);
  13992. smalltalk.addMethod(
  13993. smalltalk.method({
  13994. selector: "trimRight",
  13995. category: 'regular expressions',
  13996. fn: function (){
  13997. var self=this;
  13998. return smalltalk.withContext(function($ctx1) {
  13999. var $1;
  14000. $1=self._trimRight_("\x5cs");
  14001. return $1;
  14002. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},smalltalk.String)})},
  14003. args: [],
  14004. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  14005. messageSends: ["trimRight:"],
  14006. referencedClasses: []
  14007. }),
  14008. smalltalk.String);
  14009. smalltalk.addMethod(
  14010. smalltalk.method({
  14011. selector: "trimRight:",
  14012. category: 'regular expressions',
  14013. fn: function (separators){
  14014. var self=this;
  14015. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14016. return smalltalk.withContext(function($ctx1) {
  14017. var $1;
  14018. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st("[".__comma(separators)).__comma("]+$"),"g"),"");
  14019. return $1;
  14020. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},smalltalk.String)})},
  14021. args: ["separators"],
  14022. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  14023. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  14024. referencedClasses: ["RegularExpression"]
  14025. }),
  14026. smalltalk.String);
  14027. smalltalk.addMethod(
  14028. smalltalk.method({
  14029. selector: "unescaped",
  14030. category: 'accessing',
  14031. fn: function (){
  14032. var self=this;
  14033. return smalltalk.withContext(function($ctx1) {
  14034. return unescape(self);
  14035. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{},smalltalk.String)})},
  14036. args: [],
  14037. source: "unescaped\x0a\x09<return unescape(self)>",
  14038. messageSends: [],
  14039. referencedClasses: []
  14040. }),
  14041. smalltalk.String);
  14042. smalltalk.addMethod(
  14043. smalltalk.method({
  14044. selector: "withIndexDo:",
  14045. category: 'enumerating',
  14046. fn: function (aBlock){
  14047. var self=this;
  14048. return smalltalk.withContext(function($ctx1) {
  14049. for(var i=0;i<self.length;i++){aBlock._value_value_(self.charAt(i), i+1);};
  14050. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.String)})},
  14051. args: ["aBlock"],
  14052. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_value_(self.charAt(i), i+1);}>",
  14053. messageSends: [],
  14054. referencedClasses: []
  14055. }),
  14056. smalltalk.String);
  14057. smalltalk.addMethod(
  14058. smalltalk.method({
  14059. selector: "cr",
  14060. category: 'accessing',
  14061. fn: function (){
  14062. var self=this;
  14063. return smalltalk.withContext(function($ctx1) {
  14064. return '\r';
  14065. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.String.klass)})},
  14066. args: [],
  14067. source: "cr\x0a\x09<return '\x5cr'>",
  14068. messageSends: [],
  14069. referencedClasses: []
  14070. }),
  14071. smalltalk.String.klass);
  14072. smalltalk.addMethod(
  14073. smalltalk.method({
  14074. selector: "crlf",
  14075. category: 'accessing',
  14076. fn: function (){
  14077. var self=this;
  14078. return smalltalk.withContext(function($ctx1) {
  14079. return '\r\n';
  14080. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.String.klass)})},
  14081. args: [],
  14082. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  14083. messageSends: [],
  14084. referencedClasses: []
  14085. }),
  14086. smalltalk.String.klass);
  14087. smalltalk.addMethod(
  14088. smalltalk.method({
  14089. selector: "fromCharCode:",
  14090. category: 'instance creation',
  14091. fn: function (anInteger){
  14092. var self=this;
  14093. return smalltalk.withContext(function($ctx1) {
  14094. return String.fromCharCode(anInteger);
  14095. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},smalltalk.String.klass)})},
  14096. args: ["anInteger"],
  14097. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  14098. messageSends: [],
  14099. referencedClasses: []
  14100. }),
  14101. smalltalk.String.klass);
  14102. smalltalk.addMethod(
  14103. smalltalk.method({
  14104. selector: "fromString:",
  14105. category: 'instance creation',
  14106. fn: function (aString){
  14107. var self=this;
  14108. return smalltalk.withContext(function($ctx1) {
  14109. return String(aString);
  14110. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.String.klass)})},
  14111. args: ["aString"],
  14112. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  14113. messageSends: [],
  14114. referencedClasses: []
  14115. }),
  14116. smalltalk.String.klass);
  14117. smalltalk.addMethod(
  14118. smalltalk.method({
  14119. selector: "lf",
  14120. category: 'accessing',
  14121. fn: function (){
  14122. var self=this;
  14123. return smalltalk.withContext(function($ctx1) {
  14124. return '\n';
  14125. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.String.klass)})},
  14126. args: [],
  14127. source: "lf\x0a\x09<return '\x5cn'>",
  14128. messageSends: [],
  14129. referencedClasses: []
  14130. }),
  14131. smalltalk.String.klass);
  14132. smalltalk.addMethod(
  14133. smalltalk.method({
  14134. selector: "random",
  14135. category: 'random',
  14136. fn: function (){
  14137. var self=this;
  14138. return smalltalk.withContext(function($ctx1) {
  14139. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  14140. return self}, function($ctx1) {$ctx1.fill(self,"random",{},smalltalk.String.klass)})},
  14141. args: [],
  14142. 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);>",
  14143. messageSends: [],
  14144. referencedClasses: []
  14145. }),
  14146. smalltalk.String.klass);
  14147. smalltalk.addMethod(
  14148. smalltalk.method({
  14149. selector: "randomNotIn:",
  14150. category: 'random',
  14151. fn: function (aString){
  14152. var self=this;
  14153. var result;
  14154. return smalltalk.withContext(function($ctx1) {
  14155. var $1;
  14156. _st((function(){
  14157. return smalltalk.withContext(function($ctx2) {
  14158. result=self._random();
  14159. result;
  14160. return _st(aString)._includesSubString_(result);
  14161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  14162. $1=result;
  14163. return $1;
  14164. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},smalltalk.String.klass)})},
  14165. args: ["aString"],
  14166. source: "randomNotIn: aString\x0a\x09| result |\x0a [ result := self random. aString includesSubString: result ] whileTrue.\x0a ^result",
  14167. messageSends: ["whileTrue", "random", "includesSubString:"],
  14168. referencedClasses: []
  14169. }),
  14170. smalltalk.String.klass);
  14171. smalltalk.addMethod(
  14172. smalltalk.method({
  14173. selector: "space",
  14174. category: 'accessing',
  14175. fn: function (){
  14176. var self=this;
  14177. return smalltalk.withContext(function($ctx1) {
  14178. return ' ';
  14179. return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.String.klass)})},
  14180. args: [],
  14181. source: "space\x0a\x09<return ' '>",
  14182. messageSends: [],
  14183. referencedClasses: []
  14184. }),
  14185. smalltalk.String.klass);
  14186. smalltalk.addMethod(
  14187. smalltalk.method({
  14188. selector: "streamClass",
  14189. category: 'accessing',
  14190. fn: function (){
  14191. var self=this;
  14192. function $StringStream(){return smalltalk.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  14193. return smalltalk.withContext(function($ctx1) {
  14194. var $1;
  14195. $1=$StringStream();
  14196. return $1;
  14197. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.String.klass)})},
  14198. args: [],
  14199. source: "streamClass\x0a\x09\x09^StringStream",
  14200. messageSends: [],
  14201. referencedClasses: ["StringStream"]
  14202. }),
  14203. smalltalk.String.klass);
  14204. smalltalk.addMethod(
  14205. smalltalk.method({
  14206. selector: "tab",
  14207. category: 'accessing',
  14208. fn: function (){
  14209. var self=this;
  14210. return smalltalk.withContext(function($ctx1) {
  14211. return '\t';
  14212. return self}, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.String.klass)})},
  14213. args: [],
  14214. source: "tab\x0a\x09<return '\x5ct'>",
  14215. messageSends: [],
  14216. referencedClasses: []
  14217. }),
  14218. smalltalk.String.klass);
  14219. smalltalk.addMethod(
  14220. smalltalk.method({
  14221. selector: "value:",
  14222. category: 'instance creation',
  14223. fn: function (aUTFCharCode){
  14224. var self=this;
  14225. return smalltalk.withContext(function($ctx1) {
  14226. return String.fromCharCode(aUTFCharCode);;
  14227. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},smalltalk.String.klass)})},
  14228. args: ["aUTFCharCode"],
  14229. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  14230. messageSends: [],
  14231. referencedClasses: []
  14232. }),
  14233. smalltalk.String.klass);
  14234. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  14235. smalltalk.Set.comment="I represent an unordered set of objects without duplicates.";
  14236. smalltalk.addMethod(
  14237. smalltalk.method({
  14238. selector: "=",
  14239. category: 'comparing',
  14240. fn: function (aCollection){
  14241. var self=this;
  14242. return smalltalk.withContext(function($ctx1) {
  14243. var $1,$2,$3;
  14244. var $early={};
  14245. try {
  14246. $1=_st(self._class()).__eq(_st(aCollection)._class());
  14247. if(! smalltalk.assert($1)){
  14248. return false;
  14249. };
  14250. $2=_st(self._size()).__eq(_st(aCollection)._size());
  14251. if(! smalltalk.assert($2)){
  14252. return false;
  14253. };
  14254. self._do_((function(each){
  14255. return smalltalk.withContext(function($ctx2) {
  14256. $3=_st(aCollection)._includes_(each);
  14257. if(! smalltalk.assert($3)){
  14258. throw $early=[false];
  14259. };
  14260. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  14261. return true;
  14262. }
  14263. catch(e) {if(e===$early)return e[0]; throw e}
  14264. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.Set)})},
  14265. args: ["aCollection"],
  14266. 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",
  14267. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
  14268. referencedClasses: []
  14269. }),
  14270. smalltalk.Set);
  14271. smalltalk.addMethod(
  14272. smalltalk.method({
  14273. selector: "add:",
  14274. category: 'adding/removing',
  14275. fn: function (anObject){
  14276. var self=this;
  14277. return smalltalk.withContext(function($ctx1) {
  14278. var found;
  14279. for(var i=0; i < self['@elements'].length; i++) {
  14280. if(_st(anObject).__eq(self['@elements'][i])) {
  14281. found = true;
  14282. break;
  14283. }
  14284. }
  14285. if(!found) {self['@elements'].push(anObject)}
  14286. ;
  14287. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Set)})},
  14288. args: ["anObject"],
  14289. 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>",
  14290. messageSends: [],
  14291. referencedClasses: []
  14292. }),
  14293. smalltalk.Set);
  14294. smalltalk.addMethod(
  14295. smalltalk.method({
  14296. selector: "asArray",
  14297. category: 'converting',
  14298. fn: function (){
  14299. var self=this;
  14300. return smalltalk.withContext(function($ctx1) {
  14301. var $1;
  14302. $1=_st(self["@elements"])._copy();
  14303. return $1;
  14304. }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Set)})},
  14305. args: [],
  14306. source: "asArray\x0a\x09^elements copy",
  14307. messageSends: ["copy"],
  14308. referencedClasses: []
  14309. }),
  14310. smalltalk.Set);
  14311. smalltalk.addMethod(
  14312. smalltalk.method({
  14313. selector: "collect:",
  14314. category: 'enumerating',
  14315. fn: function (aBlock){
  14316. var self=this;
  14317. return smalltalk.withContext(function($ctx1) {
  14318. var $1;
  14319. $1=_st(self._class())._withAll_(_st(self["@elements"])._collect_(aBlock));
  14320. return $1;
  14321. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},smalltalk.Set)})},
  14322. args: ["aBlock"],
  14323. source: "collect: aBlock\x0a\x09^self class withAll: (elements collect: aBlock)",
  14324. messageSends: ["withAll:", "collect:", "class"],
  14325. referencedClasses: []
  14326. }),
  14327. smalltalk.Set);
  14328. smalltalk.addMethod(
  14329. smalltalk.method({
  14330. selector: "detect:ifNone:",
  14331. category: 'enumerating',
  14332. fn: function (aBlock,anotherBlock){
  14333. var self=this;
  14334. return smalltalk.withContext(function($ctx1) {
  14335. var $1;
  14336. $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock);
  14337. return $1;
  14338. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Set)})},
  14339. args: ["aBlock", "anotherBlock"],
  14340. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  14341. messageSends: ["detect:ifNone:"],
  14342. referencedClasses: []
  14343. }),
  14344. smalltalk.Set);
  14345. smalltalk.addMethod(
  14346. smalltalk.method({
  14347. selector: "do:",
  14348. category: 'enumerating',
  14349. fn: function (aBlock){
  14350. var self=this;
  14351. return smalltalk.withContext(function($ctx1) {
  14352. _st(self["@elements"])._do_(aBlock);
  14353. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Set)})},
  14354. args: ["aBlock"],
  14355. source: "do: aBlock\x0a\x09elements do: aBlock",
  14356. messageSends: ["do:"],
  14357. referencedClasses: []
  14358. }),
  14359. smalltalk.Set);
  14360. smalltalk.addMethod(
  14361. smalltalk.method({
  14362. selector: "includes:",
  14363. category: 'testing',
  14364. fn: function (anObject){
  14365. var self=this;
  14366. return smalltalk.withContext(function($ctx1) {
  14367. var $1;
  14368. $1=_st(self["@elements"])._includes_(anObject);
  14369. return $1;
  14370. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.Set)})},
  14371. args: ["anObject"],
  14372. source: "includes: anObject\x0a\x09^elements includes: anObject",
  14373. messageSends: ["includes:"],
  14374. referencedClasses: []
  14375. }),
  14376. smalltalk.Set);
  14377. smalltalk.addMethod(
  14378. smalltalk.method({
  14379. selector: "initialize",
  14380. category: 'initialization',
  14381. fn: function (){
  14382. var self=this;
  14383. return smalltalk.withContext(function($ctx1) {
  14384. smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []);
  14385. self["@elements"]=[];
  14386. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Set)})},
  14387. args: [],
  14388. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  14389. messageSends: ["initialize"],
  14390. referencedClasses: []
  14391. }),
  14392. smalltalk.Set);
  14393. smalltalk.addMethod(
  14394. smalltalk.method({
  14395. selector: "printOn:",
  14396. category: 'printing',
  14397. fn: function (aStream){
  14398. var self=this;
  14399. return smalltalk.withContext(function($ctx1) {
  14400. smalltalk.Collection.fn.prototype._printOn_.apply(_st(self), [aStream]);
  14401. _st(aStream)._nextPutAll_(" (");
  14402. self._do_separatedBy_((function(each){
  14403. return smalltalk.withContext(function($ctx2) {
  14404. return _st(each)._printOn_(aStream);
  14405. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  14406. return smalltalk.withContext(function($ctx2) {
  14407. return _st(aStream)._nextPutAll_(" ");
  14408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14409. _st(aStream)._nextPutAll_(")");
  14410. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Set)})},
  14411. args: ["aStream"],
  14412. 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: ')'",
  14413. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  14414. referencedClasses: []
  14415. }),
  14416. smalltalk.Set);
  14417. smalltalk.addMethod(
  14418. smalltalk.method({
  14419. selector: "remove:",
  14420. category: 'adding/removing',
  14421. fn: function (anObject){
  14422. var self=this;
  14423. return smalltalk.withContext(function($ctx1) {
  14424. _st(self["@elements"])._remove_(anObject);
  14425. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Set)})},
  14426. args: ["anObject"],
  14427. source: "remove: anObject\x0a\x09elements remove: anObject",
  14428. messageSends: ["remove:"],
  14429. referencedClasses: []
  14430. }),
  14431. smalltalk.Set);
  14432. smalltalk.addMethod(
  14433. smalltalk.method({
  14434. selector: "remove:ifAbsent:",
  14435. category: 'adding/removing',
  14436. fn: function (anObject,aBlock){
  14437. var self=this;
  14438. return smalltalk.withContext(function($ctx1) {
  14439. _st(self["@elements"])._remove_ifAbsent_(anObject,aBlock);
  14440. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Set)})},
  14441. args: ["anObject", "aBlock"],
  14442. source: "remove: anObject ifAbsent: aBlock\x0a\x09elements remove: anObject ifAbsent: aBlock",
  14443. messageSends: ["remove:ifAbsent:"],
  14444. referencedClasses: []
  14445. }),
  14446. smalltalk.Set);
  14447. smalltalk.addMethod(
  14448. smalltalk.method({
  14449. selector: "select:",
  14450. category: 'enumerating',
  14451. fn: function (aBlock){
  14452. var self=this;
  14453. var collection;
  14454. return smalltalk.withContext(function($ctx1) {
  14455. var $1,$2;
  14456. collection=_st(self._class())._new();
  14457. self._do_((function(each){
  14458. return smalltalk.withContext(function($ctx2) {
  14459. $1=_st(aBlock)._value_(each);
  14460. if(smalltalk.assert($1)){
  14461. return _st(collection)._add_(each);
  14462. };
  14463. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  14464. $2=collection;
  14465. return $2;
  14466. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},smalltalk.Set)})},
  14467. args: ["aBlock"],
  14468. 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",
  14469. messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
  14470. referencedClasses: []
  14471. }),
  14472. smalltalk.Set);
  14473. smalltalk.addMethod(
  14474. smalltalk.method({
  14475. selector: "size",
  14476. category: 'accessing',
  14477. fn: function (){
  14478. var self=this;
  14479. return smalltalk.withContext(function($ctx1) {
  14480. var $1;
  14481. $1=_st(self["@elements"])._size();
  14482. return $1;
  14483. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Set)})},
  14484. args: [],
  14485. source: "size\x0a\x09^elements size",
  14486. messageSends: ["size"],
  14487. referencedClasses: []
  14488. }),
  14489. smalltalk.Set);
  14490. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  14491. 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.";
  14492. smalltalk.addMethod(
  14493. smalltalk.method({
  14494. selector: "initialize",
  14495. category: 'initialization',
  14496. fn: function (){
  14497. var self=this;
  14498. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  14499. return smalltalk.withContext(function($ctx1) {
  14500. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  14501. self["@read"]=_st($OrderedCollection())._new();
  14502. self["@write"]=_st($OrderedCollection())._new();
  14503. self["@readIndex"]=(1);
  14504. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Queue)})},
  14505. args: [],
  14506. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14507. messageSends: ["initialize", "new"],
  14508. referencedClasses: ["OrderedCollection"]
  14509. }),
  14510. smalltalk.Queue);
  14511. smalltalk.addMethod(
  14512. smalltalk.method({
  14513. selector: "next",
  14514. category: 'accessing',
  14515. fn: function (){
  14516. var self=this;
  14517. return smalltalk.withContext(function($ctx1) {
  14518. var $1;
  14519. $1=self._nextIfAbsent_((function(){
  14520. return smalltalk.withContext(function($ctx2) {
  14521. return self._error_("Cannot read from empty Queue.");
  14522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14523. return $1;
  14524. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Queue)})},
  14525. args: [],
  14526. source: "next\x0a\x09^self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14527. messageSends: ["nextIfAbsent:", "error:"],
  14528. referencedClasses: []
  14529. }),
  14530. smalltalk.Queue);
  14531. smalltalk.addMethod(
  14532. smalltalk.method({
  14533. selector: "nextIfAbsent:",
  14534. category: 'accessing',
  14535. fn: function (aBlock){
  14536. var self=this;
  14537. var result;
  14538. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  14539. return smalltalk.withContext(function($ctx1) {
  14540. var $1,$2,$3,$4;
  14541. var $early={};
  14542. try {
  14543. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  14544. return smalltalk.withContext(function($ctx2) {
  14545. $1=_st(self["@write"])._isEmpty();
  14546. if(smalltalk.assert($1)){
  14547. $2=_st(self["@readIndex"]).__gt((1));
  14548. if(smalltalk.assert($2)){
  14549. self["@read"]=[];
  14550. self["@read"];
  14551. self["@readIndex"]=(1);
  14552. self["@readIndex"];
  14553. };
  14554. $3=_st(aBlock)._value();
  14555. throw $early=[$3];
  14556. };
  14557. self["@read"]=self["@write"];
  14558. self["@read"];
  14559. self["@readIndex"]=(1);
  14560. self["@readIndex"];
  14561. self["@write"]=_st($OrderedCollection())._new();
  14562. self["@write"];
  14563. return _st(self["@read"])._first();
  14564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14565. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  14566. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  14567. $4=result;
  14568. return $4;
  14569. }
  14570. catch(e) {if(e===$early)return e[0]; throw e}
  14571. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},smalltalk.Queue)})},
  14572. args: ["aBlock"],
  14573. 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",
  14574. messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"],
  14575. referencedClasses: ["OrderedCollection"]
  14576. }),
  14577. smalltalk.Queue);
  14578. smalltalk.addMethod(
  14579. smalltalk.method({
  14580. selector: "nextPut:",
  14581. category: 'accessing',
  14582. fn: function (anObject){
  14583. var self=this;
  14584. return smalltalk.withContext(function($ctx1) {
  14585. _st(self["@write"])._add_(anObject);
  14586. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Queue)})},
  14587. args: ["anObject"],
  14588. source: "nextPut: anObject\x0a\x09write add: anObject",
  14589. messageSends: ["add:"],
  14590. referencedClasses: []
  14591. }),
  14592. smalltalk.Queue);
  14593. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  14594. smalltalk.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14595. smalltalk.addMethod(
  14596. smalltalk.method({
  14597. selector: "compile:",
  14598. category: 'evaluating',
  14599. fn: function (aString){
  14600. var self=this;
  14601. return smalltalk.withContext(function($ctx1) {
  14602. return self.compile(aString);
  14603. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.RegularExpression)})},
  14604. args: ["aString"],
  14605. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  14606. messageSends: [],
  14607. referencedClasses: []
  14608. }),
  14609. smalltalk.RegularExpression);
  14610. smalltalk.addMethod(
  14611. smalltalk.method({
  14612. selector: "exec:",
  14613. category: 'evaluating',
  14614. fn: function (aString){
  14615. var self=this;
  14616. return smalltalk.withContext(function($ctx1) {
  14617. return self.exec(aString) || nil;
  14618. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},smalltalk.RegularExpression)})},
  14619. args: ["aString"],
  14620. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  14621. messageSends: [],
  14622. referencedClasses: []
  14623. }),
  14624. smalltalk.RegularExpression);
  14625. smalltalk.addMethod(
  14626. smalltalk.method({
  14627. selector: "test:",
  14628. category: 'evaluating',
  14629. fn: function (aString){
  14630. var self=this;
  14631. return smalltalk.withContext(function($ctx1) {
  14632. return self.test(aString);
  14633. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},smalltalk.RegularExpression)})},
  14634. args: ["aString"],
  14635. source: "test: aString\x0a\x09<return self.test(aString)>",
  14636. messageSends: [],
  14637. referencedClasses: []
  14638. }),
  14639. smalltalk.RegularExpression);
  14640. smalltalk.addMethod(
  14641. smalltalk.method({
  14642. selector: "fromString:",
  14643. category: 'instance creation',
  14644. fn: function (aString){
  14645. var self=this;
  14646. return smalltalk.withContext(function($ctx1) {
  14647. var $1;
  14648. $1=self._fromString_flag_(aString,"");
  14649. return $1;
  14650. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.RegularExpression.klass)})},
  14651. args: ["aString"],
  14652. source: "fromString: aString\x0a\x09\x09^self fromString: aString flag: ''",
  14653. messageSends: ["fromString:flag:"],
  14654. referencedClasses: []
  14655. }),
  14656. smalltalk.RegularExpression.klass);
  14657. smalltalk.addMethod(
  14658. smalltalk.method({
  14659. selector: "fromString:flag:",
  14660. category: 'instance creation',
  14661. fn: function (aString,anotherString){
  14662. var self=this;
  14663. return smalltalk.withContext(function($ctx1) {
  14664. return new RegExp(aString, anotherString);
  14665. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},smalltalk.RegularExpression.klass)})},
  14666. args: ["aString", "anotherString"],
  14667. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  14668. messageSends: [],
  14669. referencedClasses: []
  14670. }),
  14671. smalltalk.RegularExpression.klass);
  14672. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  14673. 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.";
  14674. smalltalk.addMethod(
  14675. smalltalk.method({
  14676. selector: "<<",
  14677. category: 'writing',
  14678. fn: function (anObject){
  14679. var self=this;
  14680. return smalltalk.withContext(function($ctx1) {
  14681. self._write_(anObject);
  14682. return self}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},smalltalk.Stream)})},
  14683. args: ["anObject"],
  14684. source: "<< anObject\x0a\x09self write: anObject",
  14685. messageSends: ["write:"],
  14686. referencedClasses: []
  14687. }),
  14688. smalltalk.Stream);
  14689. smalltalk.addMethod(
  14690. smalltalk.method({
  14691. selector: "atEnd",
  14692. category: 'testing',
  14693. fn: function (){
  14694. var self=this;
  14695. return smalltalk.withContext(function($ctx1) {
  14696. var $1;
  14697. $1=_st(self._position()).__eq(self._size());
  14698. return $1;
  14699. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.Stream)})},
  14700. args: [],
  14701. source: "atEnd\x0a\x09^self position = self size",
  14702. messageSends: ["=", "size", "position"],
  14703. referencedClasses: []
  14704. }),
  14705. smalltalk.Stream);
  14706. smalltalk.addMethod(
  14707. smalltalk.method({
  14708. selector: "atStart",
  14709. category: 'testing',
  14710. fn: function (){
  14711. var self=this;
  14712. return smalltalk.withContext(function($ctx1) {
  14713. var $1;
  14714. $1=_st(self._position()).__eq((0));
  14715. return $1;
  14716. }, function($ctx1) {$ctx1.fill(self,"atStart",{},smalltalk.Stream)})},
  14717. args: [],
  14718. source: "atStart\x0a\x09^self position = 0",
  14719. messageSends: ["=", "position"],
  14720. referencedClasses: []
  14721. }),
  14722. smalltalk.Stream);
  14723. smalltalk.addMethod(
  14724. smalltalk.method({
  14725. selector: "close",
  14726. category: 'actions',
  14727. fn: function (){
  14728. var self=this;
  14729. return smalltalk.withContext(function($ctx1) {
  14730. return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Stream)})},
  14731. args: [],
  14732. source: "close",
  14733. messageSends: [],
  14734. referencedClasses: []
  14735. }),
  14736. smalltalk.Stream);
  14737. smalltalk.addMethod(
  14738. smalltalk.method({
  14739. selector: "collection",
  14740. category: 'accessing',
  14741. fn: function (){
  14742. var self=this;
  14743. return smalltalk.withContext(function($ctx1) {
  14744. var $1;
  14745. $1=self["@collection"];
  14746. return $1;
  14747. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.Stream)})},
  14748. args: [],
  14749. source: "collection\x0a\x09^collection",
  14750. messageSends: [],
  14751. referencedClasses: []
  14752. }),
  14753. smalltalk.Stream);
  14754. smalltalk.addMethod(
  14755. smalltalk.method({
  14756. selector: "contents",
  14757. category: 'accessing',
  14758. fn: function (){
  14759. var self=this;
  14760. return smalltalk.withContext(function($ctx1) {
  14761. var $1;
  14762. $1=_st(self._collection())._copyFrom_to_((1),self._streamSize());
  14763. return $1;
  14764. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.Stream)})},
  14765. args: [],
  14766. source: "contents\x0a\x09^self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  14767. messageSends: ["copyFrom:to:", "streamSize", "collection"],
  14768. referencedClasses: []
  14769. }),
  14770. smalltalk.Stream);
  14771. smalltalk.addMethod(
  14772. smalltalk.method({
  14773. selector: "do:",
  14774. category: 'enumerating',
  14775. fn: function (aBlock){
  14776. var self=this;
  14777. return smalltalk.withContext(function($ctx1) {
  14778. _st((function(){
  14779. return smalltalk.withContext(function($ctx2) {
  14780. return self._atEnd();
  14781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  14782. return smalltalk.withContext(function($ctx2) {
  14783. return _st(aBlock)._value_(self._next());
  14784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14785. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Stream)})},
  14786. args: ["aBlock"],
  14787. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  14788. messageSends: ["whileFalse:", "value:", "next", "atEnd"],
  14789. referencedClasses: []
  14790. }),
  14791. smalltalk.Stream);
  14792. smalltalk.addMethod(
  14793. smalltalk.method({
  14794. selector: "flush",
  14795. category: 'actions',
  14796. fn: function (){
  14797. var self=this;
  14798. return smalltalk.withContext(function($ctx1) {
  14799. return self}, function($ctx1) {$ctx1.fill(self,"flush",{},smalltalk.Stream)})},
  14800. args: [],
  14801. source: "flush",
  14802. messageSends: [],
  14803. referencedClasses: []
  14804. }),
  14805. smalltalk.Stream);
  14806. smalltalk.addMethod(
  14807. smalltalk.method({
  14808. selector: "isEmpty",
  14809. category: 'testing',
  14810. fn: function (){
  14811. var self=this;
  14812. return smalltalk.withContext(function($ctx1) {
  14813. var $1;
  14814. $1=_st(self._size()).__eq((0));
  14815. return $1;
  14816. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Stream)})},
  14817. args: [],
  14818. source: "isEmpty\x0a\x09^self size = 0",
  14819. messageSends: ["=", "size"],
  14820. referencedClasses: []
  14821. }),
  14822. smalltalk.Stream);
  14823. smalltalk.addMethod(
  14824. smalltalk.method({
  14825. selector: "next",
  14826. category: 'reading',
  14827. fn: function (){
  14828. var self=this;
  14829. return smalltalk.withContext(function($ctx1) {
  14830. var $2,$1;
  14831. $2=self._atEnd();
  14832. if(smalltalk.assert($2)){
  14833. $1=nil;
  14834. } else {
  14835. self._position_(_st(self._position()).__plus((1)));
  14836. $1=_st(self["@collection"])._at_(self._position());
  14837. };
  14838. return $1;
  14839. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Stream)})},
  14840. args: [],
  14841. 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]",
  14842. messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
  14843. referencedClasses: []
  14844. }),
  14845. smalltalk.Stream);
  14846. smalltalk.addMethod(
  14847. smalltalk.method({
  14848. selector: "next:",
  14849. category: 'reading',
  14850. fn: function (anInteger){
  14851. var self=this;
  14852. var tempCollection;
  14853. return smalltalk.withContext(function($ctx1) {
  14854. var $1,$2;
  14855. tempCollection=_st(_st(self._collection())._class())._new();
  14856. _st(anInteger)._timesRepeat_((function(){
  14857. return smalltalk.withContext(function($ctx2) {
  14858. $1=self._atEnd();
  14859. if(! smalltalk.assert($1)){
  14860. return _st(tempCollection)._add_(self._next());
  14861. };
  14862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14863. $2=tempCollection;
  14864. return $2;
  14865. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.Stream)})},
  14866. args: ["anInteger"],
  14867. 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",
  14868. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
  14869. referencedClasses: []
  14870. }),
  14871. smalltalk.Stream);
  14872. smalltalk.addMethod(
  14873. smalltalk.method({
  14874. selector: "nextPut:",
  14875. category: 'writing',
  14876. fn: function (anObject){
  14877. var self=this;
  14878. return smalltalk.withContext(function($ctx1) {
  14879. self._position_(_st(self._position()).__plus((1)));
  14880. _st(self._collection())._at_put_(self._position(),anObject);
  14881. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  14882. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Stream)})},
  14883. args: ["anObject"],
  14884. 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)",
  14885. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  14886. referencedClasses: []
  14887. }),
  14888. smalltalk.Stream);
  14889. smalltalk.addMethod(
  14890. smalltalk.method({
  14891. selector: "nextPutAll:",
  14892. category: 'writing',
  14893. fn: function (aCollection){
  14894. var self=this;
  14895. return smalltalk.withContext(function($ctx1) {
  14896. _st(aCollection)._do_((function(each){
  14897. return smalltalk.withContext(function($ctx2) {
  14898. return self._nextPut_(each);
  14899. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  14900. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},smalltalk.Stream)})},
  14901. args: ["aCollection"],
  14902. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self nextPut: each]",
  14903. messageSends: ["do:", "nextPut:"],
  14904. referencedClasses: []
  14905. }),
  14906. smalltalk.Stream);
  14907. smalltalk.addMethod(
  14908. smalltalk.method({
  14909. selector: "nextPutString:",
  14910. category: 'writing',
  14911. fn: function (aString){
  14912. var self=this;
  14913. return smalltalk.withContext(function($ctx1) {
  14914. self._nextPut_(aString);
  14915. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.Stream)})},
  14916. args: ["aString"],
  14917. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  14918. messageSends: ["nextPut:"],
  14919. referencedClasses: []
  14920. }),
  14921. smalltalk.Stream);
  14922. smalltalk.addMethod(
  14923. smalltalk.method({
  14924. selector: "peek",
  14925. category: 'reading',
  14926. fn: function (){
  14927. var self=this;
  14928. return smalltalk.withContext(function($ctx1) {
  14929. var $2,$1;
  14930. $2=self._atEnd();
  14931. if(! smalltalk.assert($2)){
  14932. $1=_st(self._collection())._at_(_st(self._position()).__plus((1)));
  14933. };
  14934. return $1;
  14935. }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.Stream)})},
  14936. args: [],
  14937. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1]",
  14938. messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
  14939. referencedClasses: []
  14940. }),
  14941. smalltalk.Stream);
  14942. smalltalk.addMethod(
  14943. smalltalk.method({
  14944. selector: "position",
  14945. category: 'accessing',
  14946. fn: function (){
  14947. var self=this;
  14948. return smalltalk.withContext(function($ctx1) {
  14949. var $2,$1;
  14950. $2=self["@position"];
  14951. if(($receiver = $2) == nil || $receiver == undefined){
  14952. self["@position"]=(0);
  14953. $1=self["@position"];
  14954. } else {
  14955. $1=$2;
  14956. };
  14957. return $1;
  14958. }, function($ctx1) {$ctx1.fill(self,"position",{},smalltalk.Stream)})},
  14959. args: [],
  14960. source: "position\x0a\x09^position ifNil: [position := 0]",
  14961. messageSends: ["ifNil:"],
  14962. referencedClasses: []
  14963. }),
  14964. smalltalk.Stream);
  14965. smalltalk.addMethod(
  14966. smalltalk.method({
  14967. selector: "position:",
  14968. category: 'accessing',
  14969. fn: function (anInteger){
  14970. var self=this;
  14971. return smalltalk.withContext(function($ctx1) {
  14972. self["@position"]=anInteger;
  14973. return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger},smalltalk.Stream)})},
  14974. args: ["anInteger"],
  14975. source: "position: anInteger\x0a\x09position := anInteger",
  14976. messageSends: [],
  14977. referencedClasses: []
  14978. }),
  14979. smalltalk.Stream);
  14980. smalltalk.addMethod(
  14981. smalltalk.method({
  14982. selector: "reset",
  14983. category: 'actions',
  14984. fn: function (){
  14985. var self=this;
  14986. return smalltalk.withContext(function($ctx1) {
  14987. self._position_((0));
  14988. return self}, function($ctx1) {$ctx1.fill(self,"reset",{},smalltalk.Stream)})},
  14989. args: [],
  14990. source: "reset\x0a\x09self position: 0",
  14991. messageSends: ["position:"],
  14992. referencedClasses: []
  14993. }),
  14994. smalltalk.Stream);
  14995. smalltalk.addMethod(
  14996. smalltalk.method({
  14997. selector: "resetContents",
  14998. category: 'actions',
  14999. fn: function (){
  15000. var self=this;
  15001. return smalltalk.withContext(function($ctx1) {
  15002. self._reset();
  15003. self._setStreamSize_((0));
  15004. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{},smalltalk.Stream)})},
  15005. args: [],
  15006. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  15007. messageSends: ["reset", "setStreamSize:"],
  15008. referencedClasses: []
  15009. }),
  15010. smalltalk.Stream);
  15011. smalltalk.addMethod(
  15012. smalltalk.method({
  15013. selector: "setCollection:",
  15014. category: 'accessing',
  15015. fn: function (aCollection){
  15016. var self=this;
  15017. return smalltalk.withContext(function($ctx1) {
  15018. self["@collection"]=aCollection;
  15019. return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection},smalltalk.Stream)})},
  15020. args: ["aCollection"],
  15021. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  15022. messageSends: [],
  15023. referencedClasses: []
  15024. }),
  15025. smalltalk.Stream);
  15026. smalltalk.addMethod(
  15027. smalltalk.method({
  15028. selector: "setStreamSize:",
  15029. category: 'accessing',
  15030. fn: function (anInteger){
  15031. var self=this;
  15032. return smalltalk.withContext(function($ctx1) {
  15033. self["@streamSize"]=anInteger;
  15034. return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger},smalltalk.Stream)})},
  15035. args: ["anInteger"],
  15036. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  15037. messageSends: [],
  15038. referencedClasses: []
  15039. }),
  15040. smalltalk.Stream);
  15041. smalltalk.addMethod(
  15042. smalltalk.method({
  15043. selector: "setToEnd",
  15044. category: 'positioning',
  15045. fn: function (){
  15046. var self=this;
  15047. return smalltalk.withContext(function($ctx1) {
  15048. self._position_(self._size());
  15049. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},smalltalk.Stream)})},
  15050. args: [],
  15051. source: "setToEnd\x0a\x09self position: self size",
  15052. messageSends: ["position:", "size"],
  15053. referencedClasses: []
  15054. }),
  15055. smalltalk.Stream);
  15056. smalltalk.addMethod(
  15057. smalltalk.method({
  15058. selector: "size",
  15059. category: 'accessing',
  15060. fn: function (){
  15061. var self=this;
  15062. return smalltalk.withContext(function($ctx1) {
  15063. var $1;
  15064. $1=self._streamSize();
  15065. return $1;
  15066. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Stream)})},
  15067. args: [],
  15068. source: "size\x0a\x09^self streamSize",
  15069. messageSends: ["streamSize"],
  15070. referencedClasses: []
  15071. }),
  15072. smalltalk.Stream);
  15073. smalltalk.addMethod(
  15074. smalltalk.method({
  15075. selector: "skip:",
  15076. category: 'positioning',
  15077. fn: function (anInteger){
  15078. var self=this;
  15079. return smalltalk.withContext(function($ctx1) {
  15080. self._position_(_st(_st(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  15081. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},smalltalk.Stream)})},
  15082. args: ["anInteger"],
  15083. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  15084. messageSends: ["position:", "min:max:", "size", "+", "position"],
  15085. referencedClasses: []
  15086. }),
  15087. smalltalk.Stream);
  15088. smalltalk.addMethod(
  15089. smalltalk.method({
  15090. selector: "streamSize",
  15091. category: 'accessing',
  15092. fn: function (){
  15093. var self=this;
  15094. return smalltalk.withContext(function($ctx1) {
  15095. var $1;
  15096. $1=self["@streamSize"];
  15097. return $1;
  15098. }, function($ctx1) {$ctx1.fill(self,"streamSize",{},smalltalk.Stream)})},
  15099. args: [],
  15100. source: "streamSize\x0a\x09^streamSize",
  15101. messageSends: [],
  15102. referencedClasses: []
  15103. }),
  15104. smalltalk.Stream);
  15105. smalltalk.addMethod(
  15106. smalltalk.method({
  15107. selector: "write:",
  15108. category: 'writing',
  15109. fn: function (anObject){
  15110. var self=this;
  15111. return smalltalk.withContext(function($ctx1) {
  15112. _st(anObject)._putOn_(self);
  15113. return self}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},smalltalk.Stream)})},
  15114. args: ["anObject"],
  15115. source: "write: anObject\x0a\x09anObject putOn: self",
  15116. messageSends: ["putOn:"],
  15117. referencedClasses: []
  15118. }),
  15119. smalltalk.Stream);
  15120. smalltalk.addMethod(
  15121. smalltalk.method({
  15122. selector: "on:",
  15123. category: 'instance creation',
  15124. fn: function (aCollection){
  15125. var self=this;
  15126. return smalltalk.withContext(function($ctx1) {
  15127. var $2,$3,$1;
  15128. $2=self._new();
  15129. _st($2)._setCollection_(aCollection);
  15130. _st($2)._setStreamSize_(_st(aCollection)._size());
  15131. $3=_st($2)._yourself();
  15132. $1=$3;
  15133. return $1;
  15134. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},smalltalk.Stream.klass)})},
  15135. args: ["aCollection"],
  15136. source: "on: aCollection\x0a\x09\x09^self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  15137. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  15138. referencedClasses: []
  15139. }),
  15140. smalltalk.Stream.klass);
  15141. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  15142. smalltalk.StringStream.comment="I am a Stream specific to `String` objects.";
  15143. smalltalk.addMethod(
  15144. smalltalk.method({
  15145. selector: "cr",
  15146. category: 'writing',
  15147. fn: function (){
  15148. var self=this;
  15149. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  15150. return smalltalk.withContext(function($ctx1) {
  15151. var $1;
  15152. $1=self._nextPutAll_(_st($String())._cr());
  15153. return $1;
  15154. }, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.StringStream)})},
  15155. args: [],
  15156. source: "cr\x0a\x09^self nextPutAll: String cr",
  15157. messageSends: ["nextPutAll:", "cr"],
  15158. referencedClasses: ["String"]
  15159. }),
  15160. smalltalk.StringStream);
  15161. smalltalk.addMethod(
  15162. smalltalk.method({
  15163. selector: "crlf",
  15164. category: 'writing',
  15165. fn: function (){
  15166. var self=this;
  15167. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  15168. return smalltalk.withContext(function($ctx1) {
  15169. var $1;
  15170. $1=self._nextPutAll_(_st($String())._crlf());
  15171. return $1;
  15172. }, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.StringStream)})},
  15173. args: [],
  15174. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  15175. messageSends: ["nextPutAll:", "crlf"],
  15176. referencedClasses: ["String"]
  15177. }),
  15178. smalltalk.StringStream);
  15179. smalltalk.addMethod(
  15180. smalltalk.method({
  15181. selector: "lf",
  15182. category: 'writing',
  15183. fn: function (){
  15184. var self=this;
  15185. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  15186. return smalltalk.withContext(function($ctx1) {
  15187. var $1;
  15188. $1=self._nextPutAll_(_st($String())._lf());
  15189. return $1;
  15190. }, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.StringStream)})},
  15191. args: [],
  15192. source: "lf\x0a\x09^self nextPutAll: String lf",
  15193. messageSends: ["nextPutAll:", "lf"],
  15194. referencedClasses: ["String"]
  15195. }),
  15196. smalltalk.StringStream);
  15197. smalltalk.addMethod(
  15198. smalltalk.method({
  15199. selector: "next:",
  15200. category: 'reading',
  15201. fn: function (anInteger){
  15202. var self=this;
  15203. var tempCollection;
  15204. return smalltalk.withContext(function($ctx1) {
  15205. var $1,$2;
  15206. tempCollection=_st(_st(self._collection())._class())._new();
  15207. _st(anInteger)._timesRepeat_((function(){
  15208. return smalltalk.withContext(function($ctx2) {
  15209. $1=self._atEnd();
  15210. if(! smalltalk.assert($1)){
  15211. tempCollection=_st(tempCollection).__comma(self._next());
  15212. return tempCollection;
  15213. };
  15214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  15215. $2=tempCollection;
  15216. return $2;
  15217. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.StringStream)})},
  15218. args: ["anInteger"],
  15219. 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",
  15220. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
  15221. referencedClasses: []
  15222. }),
  15223. smalltalk.StringStream);
  15224. smalltalk.addMethod(
  15225. smalltalk.method({
  15226. selector: "nextPut:",
  15227. category: 'writing',
  15228. fn: function (aString){
  15229. var self=this;
  15230. return smalltalk.withContext(function($ctx1) {
  15231. self._nextPutAll_(aString);
  15232. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},smalltalk.StringStream)})},
  15233. args: ["aString"],
  15234. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  15235. messageSends: ["nextPutAll:"],
  15236. referencedClasses: []
  15237. }),
  15238. smalltalk.StringStream);
  15239. smalltalk.addMethod(
  15240. smalltalk.method({
  15241. selector: "nextPutAll:",
  15242. category: 'writing',
  15243. fn: function (aString){
  15244. var self=this;
  15245. var pre,post;
  15246. return smalltalk.withContext(function($ctx1) {
  15247. var $1;
  15248. $1=self._atEnd();
  15249. if(smalltalk.assert($1)){
  15250. self._setCollection_(_st(self._collection()).__comma(aString));
  15251. } else {
  15252. pre=_st(self._collection())._copyFrom_to_((1),self._position());
  15253. pre;
  15254. post=_st(self._collection())._copyFrom_to_(_st(_st(self._position()).__plus((1))).__plus(_st(aString)._size()),_st(self._collection())._size());
  15255. post;
  15256. self._setCollection_(_st(_st(pre).__comma(aString)).__comma(post));
  15257. };
  15258. self._position_(_st(self._position()).__plus(_st(aString)._size()));
  15259. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  15260. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},smalltalk.StringStream)})},
  15261. args: ["aString"],
  15262. 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)",
  15263. messageSends: ["ifTrue:ifFalse:", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "atEnd", "position:", "setStreamSize:", "max:", "streamSize"],
  15264. referencedClasses: []
  15265. }),
  15266. smalltalk.StringStream);
  15267. smalltalk.addMethod(
  15268. smalltalk.method({
  15269. selector: "nextPutString:",
  15270. category: 'writing',
  15271. fn: function (aString){
  15272. var self=this;
  15273. return smalltalk.withContext(function($ctx1) {
  15274. self._nextPutAll_(aString);
  15275. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.StringStream)})},
  15276. args: ["aString"],
  15277. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  15278. messageSends: ["nextPutAll:"],
  15279. referencedClasses: []
  15280. }),
  15281. smalltalk.StringStream);
  15282. smalltalk.addMethod(
  15283. smalltalk.method({
  15284. selector: "space",
  15285. category: 'writing',
  15286. fn: function (){
  15287. var self=this;
  15288. return smalltalk.withContext(function($ctx1) {
  15289. self._nextPut_(" ");
  15290. return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.StringStream)})},
  15291. args: [],
  15292. source: "space\x0a\x09self nextPut: ' '",
  15293. messageSends: ["nextPut:"],
  15294. referencedClasses: []
  15295. }),
  15296. smalltalk.StringStream);
  15297. smalltalk.addMethod(
  15298. smalltalk.method({
  15299. selector: "tab",
  15300. category: 'writing',
  15301. fn: function (){
  15302. var self=this;
  15303. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  15304. return smalltalk.withContext(function($ctx1) {
  15305. var $1;
  15306. $1=self._nextPutAll_(_st($String())._tab());
  15307. return $1;
  15308. }, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.StringStream)})},
  15309. args: [],
  15310. source: "tab\x0a\x09^self nextPutAll: String tab",
  15311. messageSends: ["nextPutAll:", "tab"],
  15312. referencedClasses: ["String"]
  15313. }),
  15314. smalltalk.StringStream);
  15315. smalltalk.addPackage('Kernel-Exceptions');
  15316. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  15317. 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.";
  15318. smalltalk.addMethod(
  15319. smalltalk.method({
  15320. selector: "context",
  15321. category: 'accessing',
  15322. fn: function (){
  15323. var self=this;
  15324. return smalltalk.withContext(function($ctx1) {
  15325. return self.context;
  15326. return self}, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.Error)})},
  15327. args: [],
  15328. source: "context\x0a\x09<return self.context>",
  15329. messageSends: [],
  15330. referencedClasses: []
  15331. }),
  15332. smalltalk.Error);
  15333. smalltalk.addMethod(
  15334. smalltalk.method({
  15335. selector: "initialize",
  15336. category: 'initialization',
  15337. fn: function (){
  15338. var self=this;
  15339. return smalltalk.withContext(function($ctx1) {
  15340. self._messageText_("Errorclass: ".__comma(_st(self._class())._name()));
  15341. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Error)})},
  15342. args: [],
  15343. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  15344. messageSends: ["messageText:", ",", "name", "class"],
  15345. referencedClasses: []
  15346. }),
  15347. smalltalk.Error);
  15348. smalltalk.addMethod(
  15349. smalltalk.method({
  15350. selector: "isSmalltalkError",
  15351. category: 'testing',
  15352. fn: function (){
  15353. var self=this;
  15354. return smalltalk.withContext(function($ctx1) {
  15355. return self.smalltalkError === true;
  15356. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},smalltalk.Error)})},
  15357. args: [],
  15358. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  15359. messageSends: [],
  15360. referencedClasses: []
  15361. }),
  15362. smalltalk.Error);
  15363. smalltalk.addMethod(
  15364. smalltalk.method({
  15365. selector: "jsStack",
  15366. category: 'accessing',
  15367. fn: function (){
  15368. var self=this;
  15369. return smalltalk.withContext(function($ctx1) {
  15370. return self.stack;
  15371. return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{},smalltalk.Error)})},
  15372. args: [],
  15373. source: "jsStack\x0a\x09<return self.stack>",
  15374. messageSends: [],
  15375. referencedClasses: []
  15376. }),
  15377. smalltalk.Error);
  15378. smalltalk.addMethod(
  15379. smalltalk.method({
  15380. selector: "messageText",
  15381. category: 'accessing',
  15382. fn: function (){
  15383. var self=this;
  15384. return smalltalk.withContext(function($ctx1) {
  15385. var $1;
  15386. $1=self["@messageText"];
  15387. return $1;
  15388. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.Error)})},
  15389. args: [],
  15390. source: "messageText\x0a\x09^messageText",
  15391. messageSends: [],
  15392. referencedClasses: []
  15393. }),
  15394. smalltalk.Error);
  15395. smalltalk.addMethod(
  15396. smalltalk.method({
  15397. selector: "messageText:",
  15398. category: 'accessing',
  15399. fn: function (aString){
  15400. var self=this;
  15401. return smalltalk.withContext(function($ctx1) {
  15402. self["@messageText"]=aString;
  15403. return self}, function($ctx1) {$ctx1.fill(self,"messageText:",{aString:aString},smalltalk.Error)})},
  15404. args: ["aString"],
  15405. source: "messageText: aString\x0a\x09messageText := aString",
  15406. messageSends: [],
  15407. referencedClasses: []
  15408. }),
  15409. smalltalk.Error);
  15410. smalltalk.addMethod(
  15411. smalltalk.method({
  15412. selector: "resignal",
  15413. category: 'signaling',
  15414. fn: function (){
  15415. var self=this;
  15416. return smalltalk.withContext(function($ctx1) {
  15417. throw(self);
  15418. return self}, function($ctx1) {$ctx1.fill(self,"resignal",{},smalltalk.Error)})},
  15419. args: [],
  15420. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<throw(self)>",
  15421. messageSends: [],
  15422. referencedClasses: []
  15423. }),
  15424. smalltalk.Error);
  15425. smalltalk.addMethod(
  15426. smalltalk.method({
  15427. selector: "signal",
  15428. category: 'signaling',
  15429. fn: function (){
  15430. var self=this;
  15431. return smalltalk.withContext(function($ctx1) {
  15432. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  15433. return self}, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error)})},
  15434. args: [],
  15435. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  15436. messageSends: [],
  15437. referencedClasses: []
  15438. }),
  15439. smalltalk.Error);
  15440. smalltalk.addMethod(
  15441. smalltalk.method({
  15442. selector: "signal:",
  15443. category: 'signaling',
  15444. fn: function (aString){
  15445. var self=this;
  15446. return smalltalk.withContext(function($ctx1) {
  15447. self._messageText_(aString);
  15448. self._signal();
  15449. return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error)})},
  15450. args: ["aString"],
  15451. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  15452. messageSends: ["messageText:", "signal"],
  15453. referencedClasses: []
  15454. }),
  15455. smalltalk.Error);
  15456. smalltalk.addMethod(
  15457. smalltalk.method({
  15458. selector: "heliosClass",
  15459. category: 'helios',
  15460. fn: function (){
  15461. var self=this;
  15462. return smalltalk.withContext(function($ctx1) {
  15463. return "exception";
  15464. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Error.klass)})},
  15465. args: [],
  15466. source: "heliosClass\x0a\x09^ 'exception'",
  15467. messageSends: [],
  15468. referencedClasses: []
  15469. }),
  15470. smalltalk.Error.klass);
  15471. smalltalk.addMethod(
  15472. smalltalk.method({
  15473. selector: "signal",
  15474. category: 'instance creation',
  15475. fn: function (){
  15476. var self=this;
  15477. return smalltalk.withContext(function($ctx1) {
  15478. var $1;
  15479. $1=_st(self._new())._signal();
  15480. return $1;
  15481. }, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error.klass)})},
  15482. args: [],
  15483. source: "signal\x0a\x09^self new signal",
  15484. messageSends: ["signal", "new"],
  15485. referencedClasses: []
  15486. }),
  15487. smalltalk.Error.klass);
  15488. smalltalk.addMethod(
  15489. smalltalk.method({
  15490. selector: "signal:",
  15491. category: 'instance creation',
  15492. fn: function (aString){
  15493. var self=this;
  15494. return smalltalk.withContext(function($ctx1) {
  15495. var $1;
  15496. $1=_st(self._new())._signal_(aString);
  15497. return $1;
  15498. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error.klass)})},
  15499. args: ["aString"],
  15500. source: "signal: aString\x0a\x09\x09^self new\x0a\x09\x09signal: aString",
  15501. messageSends: ["signal:", "new"],
  15502. referencedClasses: []
  15503. }),
  15504. smalltalk.Error.klass);
  15505. smalltalk.addClass('JavaScriptException', smalltalk.Error, ['exception'], 'Kernel-Exceptions');
  15506. 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:`";
  15507. smalltalk.addMethod(
  15508. smalltalk.method({
  15509. selector: "context:",
  15510. category: 'accessing',
  15511. fn: function (aMethodContext){
  15512. var self=this;
  15513. return smalltalk.withContext(function($ctx1) {
  15514. self.context = aMethodContext;
  15515. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},smalltalk.JavaScriptException)})},
  15516. args: ["aMethodContext"],
  15517. 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>",
  15518. messageSends: [],
  15519. referencedClasses: []
  15520. }),
  15521. smalltalk.JavaScriptException);
  15522. smalltalk.addMethod(
  15523. smalltalk.method({
  15524. selector: "exception",
  15525. category: 'accessing',
  15526. fn: function (){
  15527. var self=this;
  15528. return smalltalk.withContext(function($ctx1) {
  15529. var $1;
  15530. $1=self["@exception"];
  15531. return $1;
  15532. }, function($ctx1) {$ctx1.fill(self,"exception",{},smalltalk.JavaScriptException)})},
  15533. args: [],
  15534. source: "exception\x0a\x09^ exception",
  15535. messageSends: [],
  15536. referencedClasses: []
  15537. }),
  15538. smalltalk.JavaScriptException);
  15539. smalltalk.addMethod(
  15540. smalltalk.method({
  15541. selector: "exception:",
  15542. category: 'accessing',
  15543. fn: function (anException){
  15544. var self=this;
  15545. return smalltalk.withContext(function($ctx1) {
  15546. self["@exception"]=anException;
  15547. return self}, function($ctx1) {$ctx1.fill(self,"exception:",{anException:anException},smalltalk.JavaScriptException)})},
  15548. args: ["anException"],
  15549. source: "exception: anException\x0a\x09exception := anException",
  15550. messageSends: [],
  15551. referencedClasses: []
  15552. }),
  15553. smalltalk.JavaScriptException);
  15554. smalltalk.addMethod(
  15555. smalltalk.method({
  15556. selector: "messageText",
  15557. category: 'accessing',
  15558. fn: function (){
  15559. var self=this;
  15560. return smalltalk.withContext(function($ctx1) {
  15561. return 'JavaScript exception: ' + self["@exception"].toString();
  15562. return self}, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.JavaScriptException)})},
  15563. args: [],
  15564. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  15565. messageSends: [],
  15566. referencedClasses: []
  15567. }),
  15568. smalltalk.JavaScriptException);
  15569. smalltalk.addMethod(
  15570. smalltalk.method({
  15571. selector: "on:",
  15572. category: 'instance creation',
  15573. fn: function (anException){
  15574. var self=this;
  15575. return smalltalk.withContext(function($ctx1) {
  15576. var $2,$3,$1;
  15577. $2=self._new();
  15578. _st($2)._exception_(anException);
  15579. $3=_st($2)._yourself();
  15580. $1=$3;
  15581. return $1;
  15582. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},smalltalk.JavaScriptException.klass)})},
  15583. args: ["anException"],
  15584. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  15585. messageSends: ["exception:", "new", "yourself"],
  15586. referencedClasses: []
  15587. }),
  15588. smalltalk.JavaScriptException.klass);
  15589. smalltalk.addMethod(
  15590. smalltalk.method({
  15591. selector: "on:context:",
  15592. category: 'instance creation',
  15593. fn: function (anException,aMethodContext){
  15594. var self=this;
  15595. return smalltalk.withContext(function($ctx1) {
  15596. var $2,$3,$1;
  15597. $2=self._new();
  15598. _st($2)._exception_(anException);
  15599. _st($2)._context_(aMethodContext);
  15600. $3=_st($2)._yourself();
  15601. $1=$3;
  15602. return $1;
  15603. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},smalltalk.JavaScriptException.klass)})},
  15604. args: ["anException", "aMethodContext"],
  15605. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  15606. messageSends: ["exception:", "new", "context:", "yourself"],
  15607. referencedClasses: []
  15608. }),
  15609. smalltalk.JavaScriptException.klass);
  15610. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  15611. smalltalk.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  15612. smalltalk.addMethod(
  15613. smalltalk.method({
  15614. selector: "message",
  15615. category: 'accessing',
  15616. fn: function (){
  15617. var self=this;
  15618. return smalltalk.withContext(function($ctx1) {
  15619. var $1;
  15620. $1=self["@message"];
  15621. return $1;
  15622. }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.MessageNotUnderstood)})},
  15623. args: [],
  15624. source: "message\x0a\x09^message",
  15625. messageSends: [],
  15626. referencedClasses: []
  15627. }),
  15628. smalltalk.MessageNotUnderstood);
  15629. smalltalk.addMethod(
  15630. smalltalk.method({
  15631. selector: "message:",
  15632. category: 'accessing',
  15633. fn: function (aMessage){
  15634. var self=this;
  15635. return smalltalk.withContext(function($ctx1) {
  15636. self["@message"]=aMessage;
  15637. return self}, function($ctx1) {$ctx1.fill(self,"message:",{aMessage:aMessage},smalltalk.MessageNotUnderstood)})},
  15638. args: ["aMessage"],
  15639. source: "message: aMessage\x0a\x09message := aMessage",
  15640. messageSends: [],
  15641. referencedClasses: []
  15642. }),
  15643. smalltalk.MessageNotUnderstood);
  15644. smalltalk.addMethod(
  15645. smalltalk.method({
  15646. selector: "messageText",
  15647. category: 'accessing',
  15648. fn: function (){
  15649. var self=this;
  15650. return smalltalk.withContext(function($ctx1) {
  15651. var $1;
  15652. $1=_st(_st(_st(self._receiver())._asString()).__comma(" does not understand #")).__comma(_st(self._message())._selector());
  15653. return $1;
  15654. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.MessageNotUnderstood)})},
  15655. args: [],
  15656. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  15657. messageSends: [",", "selector", "message", "asString", "receiver"],
  15658. referencedClasses: []
  15659. }),
  15660. smalltalk.MessageNotUnderstood);
  15661. smalltalk.addMethod(
  15662. smalltalk.method({
  15663. selector: "receiver",
  15664. category: 'accessing',
  15665. fn: function (){
  15666. var self=this;
  15667. return smalltalk.withContext(function($ctx1) {
  15668. var $1;
  15669. $1=self["@receiver"];
  15670. return $1;
  15671. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageNotUnderstood)})},
  15672. args: [],
  15673. source: "receiver\x0a\x09^receiver",
  15674. messageSends: [],
  15675. referencedClasses: []
  15676. }),
  15677. smalltalk.MessageNotUnderstood);
  15678. smalltalk.addMethod(
  15679. smalltalk.method({
  15680. selector: "receiver:",
  15681. category: 'accessing',
  15682. fn: function (anObject){
  15683. var self=this;
  15684. return smalltalk.withContext(function($ctx1) {
  15685. self["@receiver"]=anObject;
  15686. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageNotUnderstood)})},
  15687. args: ["anObject"],
  15688. source: "receiver: anObject\x0a\x09receiver := anObject",
  15689. messageSends: [],
  15690. referencedClasses: []
  15691. }),
  15692. smalltalk.MessageNotUnderstood);
  15693. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  15694. smalltalk.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  15695. smalltalk.addMethod(
  15696. smalltalk.method({
  15697. selector: "object",
  15698. category: 'accessing',
  15699. fn: function (){
  15700. var self=this;
  15701. return smalltalk.withContext(function($ctx1) {
  15702. var $1;
  15703. $1=self["@object"];
  15704. return $1;
  15705. }, function($ctx1) {$ctx1.fill(self,"object",{},smalltalk.NonBooleanReceiver)})},
  15706. args: [],
  15707. source: "object\x0a\x09^ object",
  15708. messageSends: [],
  15709. referencedClasses: []
  15710. }),
  15711. smalltalk.NonBooleanReceiver);
  15712. smalltalk.addMethod(
  15713. smalltalk.method({
  15714. selector: "object:",
  15715. category: 'accessing',
  15716. fn: function (anObject){
  15717. var self=this;
  15718. return smalltalk.withContext(function($ctx1) {
  15719. self["@object"]=anObject;
  15720. return self}, function($ctx1) {$ctx1.fill(self,"object:",{anObject:anObject},smalltalk.NonBooleanReceiver)})},
  15721. args: ["anObject"],
  15722. source: "object: anObject\x0a\x09object := anObject",
  15723. messageSends: [],
  15724. referencedClasses: []
  15725. }),
  15726. smalltalk.NonBooleanReceiver);
  15727. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  15728. 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.";
  15729. smalltalk.addMethod(
  15730. smalltalk.method({
  15731. selector: "handleError:",
  15732. category: 'error handling',
  15733. fn: function (anError){
  15734. var self=this;
  15735. return smalltalk.withContext(function($ctx1) {
  15736. var $1;
  15737. $1=_st(anError)._context();
  15738. if(($receiver = $1) == nil || $receiver == undefined){
  15739. $1;
  15740. } else {
  15741. self._logErrorContext_(_st(anError)._context());
  15742. };
  15743. self._logError_(anError);
  15744. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.ErrorHandler)})},
  15745. args: ["anError"],
  15746. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  15747. messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
  15748. referencedClasses: []
  15749. }),
  15750. smalltalk.ErrorHandler);
  15751. smalltalk.addMethod(
  15752. smalltalk.method({
  15753. selector: "log:",
  15754. category: 'private',
  15755. fn: function (aString){
  15756. var self=this;
  15757. return smalltalk.withContext(function($ctx1) {
  15758. _st(console)._log_(aString);
  15759. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},smalltalk.ErrorHandler)})},
  15760. args: ["aString"],
  15761. source: "log: aString\x0a\x09console log: aString",
  15762. messageSends: ["log:"],
  15763. referencedClasses: []
  15764. }),
  15765. smalltalk.ErrorHandler);
  15766. smalltalk.addMethod(
  15767. smalltalk.method({
  15768. selector: "logContext:",
  15769. category: 'private',
  15770. fn: function (aContext){
  15771. var self=this;
  15772. return smalltalk.withContext(function($ctx1) {
  15773. var $1;
  15774. $1=_st(aContext)._home();
  15775. if(($receiver = $1) == nil || $receiver == undefined){
  15776. $1;
  15777. } else {
  15778. self._logContext_(_st(aContext)._home());
  15779. };
  15780. self._log_(_st(aContext)._asString());
  15781. return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  15782. args: ["aContext"],
  15783. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext asString",
  15784. messageSends: ["ifNotNil:", "logContext:", "home", "log:", "asString"],
  15785. referencedClasses: []
  15786. }),
  15787. smalltalk.ErrorHandler);
  15788. smalltalk.addMethod(
  15789. smalltalk.method({
  15790. selector: "logError:",
  15791. category: 'private',
  15792. fn: function (anError){
  15793. var self=this;
  15794. return smalltalk.withContext(function($ctx1) {
  15795. self._log_(_st(anError)._messageText());
  15796. return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},smalltalk.ErrorHandler)})},
  15797. args: ["anError"],
  15798. source: "logError: anError\x0a\x09self log: anError messageText",
  15799. messageSends: ["log:", "messageText"],
  15800. referencedClasses: []
  15801. }),
  15802. smalltalk.ErrorHandler);
  15803. smalltalk.addMethod(
  15804. smalltalk.method({
  15805. selector: "logErrorContext:",
  15806. category: 'private',
  15807. fn: function (aContext){
  15808. var self=this;
  15809. return smalltalk.withContext(function($ctx1) {
  15810. var $1,$2;
  15811. $1=aContext;
  15812. if(($receiver = $1) == nil || $receiver == undefined){
  15813. $1;
  15814. } else {
  15815. $2=_st(aContext)._home();
  15816. if(($receiver = $2) == nil || $receiver == undefined){
  15817. $2;
  15818. } else {
  15819. self._logContext_(_st(aContext)._home());
  15820. };
  15821. };
  15822. return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  15823. args: ["aContext"],
  15824. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  15825. messageSends: ["ifNotNil:", "logContext:", "home"],
  15826. referencedClasses: []
  15827. }),
  15828. smalltalk.ErrorHandler);
  15829. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  15830. smalltalk.addMethod(
  15831. smalltalk.method({
  15832. selector: "current",
  15833. category: 'accessing',
  15834. fn: function (){
  15835. var self=this;
  15836. return smalltalk.withContext(function($ctx1) {
  15837. var $2,$1;
  15838. $2=self["@current"];
  15839. if(($receiver = $2) == nil || $receiver == undefined){
  15840. self["@current"]=self._new();
  15841. $1=self["@current"];
  15842. } else {
  15843. $1=$2;
  15844. };
  15845. return $1;
  15846. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ErrorHandler.klass)})},
  15847. args: [],
  15848. source: "current\x0a\x09^current ifNil: [current := self new]",
  15849. messageSends: ["ifNil:", "new"],
  15850. referencedClasses: []
  15851. }),
  15852. smalltalk.ErrorHandler.klass);
  15853. smalltalk.addMethod(
  15854. smalltalk.method({
  15855. selector: "initialize",
  15856. category: 'initialization',
  15857. fn: function (){
  15858. var self=this;
  15859. return smalltalk.withContext(function($ctx1) {
  15860. self._register();
  15861. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ErrorHandler.klass)})},
  15862. args: [],
  15863. source: "initialize\x0a\x09self register",
  15864. messageSends: ["register"],
  15865. referencedClasses: []
  15866. }),
  15867. smalltalk.ErrorHandler.klass);
  15868. smalltalk.addMethod(
  15869. smalltalk.method({
  15870. selector: "register",
  15871. category: 'initialization',
  15872. fn: function (){
  15873. var self=this;
  15874. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  15875. return smalltalk.withContext(function($ctx1) {
  15876. _st($ErrorHandler())._setCurrent_(self._new());
  15877. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ErrorHandler.klass)})},
  15878. args: [],
  15879. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  15880. messageSends: ["setCurrent:", "new"],
  15881. referencedClasses: ["ErrorHandler"]
  15882. }),
  15883. smalltalk.ErrorHandler.klass);
  15884. smalltalk.addMethod(
  15885. smalltalk.method({
  15886. selector: "setCurrent:",
  15887. category: 'accessing',
  15888. fn: function (anHandler){
  15889. var self=this;
  15890. return smalltalk.withContext(function($ctx1) {
  15891. self["@current"]=anHandler;
  15892. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ErrorHandler.klass)})},
  15893. args: ["anHandler"],
  15894. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  15895. messageSends: [],
  15896. referencedClasses: []
  15897. }),
  15898. smalltalk.ErrorHandler.klass);
  15899. smalltalk.addPackage('Kernel-Transcript');
  15900. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  15901. smalltalk.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  15902. smalltalk.addMethod(
  15903. smalltalk.method({
  15904. selector: "clear",
  15905. category: 'printing',
  15906. fn: function (){
  15907. var self=this;
  15908. return smalltalk.withContext(function($ctx1) {
  15909. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.ConsoleTranscript)})},
  15910. args: [],
  15911. source: "clear\x0a\x09\x22no op\x22",
  15912. messageSends: [],
  15913. referencedClasses: []
  15914. }),
  15915. smalltalk.ConsoleTranscript);
  15916. smalltalk.addMethod(
  15917. smalltalk.method({
  15918. selector: "cr",
  15919. category: 'printing',
  15920. fn: function (){
  15921. var self=this;
  15922. return smalltalk.withContext(function($ctx1) {
  15923. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.ConsoleTranscript)})},
  15924. args: [],
  15925. source: "cr\x0a\x09\x22no op\x22",
  15926. messageSends: [],
  15927. referencedClasses: []
  15928. }),
  15929. smalltalk.ConsoleTranscript);
  15930. smalltalk.addMethod(
  15931. smalltalk.method({
  15932. selector: "open",
  15933. category: 'actions',
  15934. fn: function (){
  15935. var self=this;
  15936. return smalltalk.withContext(function($ctx1) {
  15937. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.ConsoleTranscript)})},
  15938. args: [],
  15939. source: "open",
  15940. messageSends: [],
  15941. referencedClasses: []
  15942. }),
  15943. smalltalk.ConsoleTranscript);
  15944. smalltalk.addMethod(
  15945. smalltalk.method({
  15946. selector: "show:",
  15947. category: 'printing',
  15948. fn: function (anObject){
  15949. var self=this;
  15950. return smalltalk.withContext(function($ctx1) {
  15951. console.log(String(_st(anObject)._asString()));
  15952. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.ConsoleTranscript)})},
  15953. args: ["anObject"],
  15954. 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()))>",
  15955. messageSends: [],
  15956. referencedClasses: []
  15957. }),
  15958. smalltalk.ConsoleTranscript);
  15959. smalltalk.addMethod(
  15960. smalltalk.method({
  15961. selector: "initialize",
  15962. category: 'initialization',
  15963. fn: function (){
  15964. var self=this;
  15965. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  15966. return smalltalk.withContext(function($ctx1) {
  15967. _st($Transcript())._register_(self._new());
  15968. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ConsoleTranscript.klass)})},
  15969. args: [],
  15970. source: "initialize\x0a\x09Transcript register: self new",
  15971. messageSends: ["register:", "new"],
  15972. referencedClasses: ["Transcript"]
  15973. }),
  15974. smalltalk.ConsoleTranscript.klass);
  15975. smalltalk.addClass('Transcript', smalltalk.Object, [], 'Kernel-Transcript');
  15976. 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.";
  15977. smalltalk.Transcript.klass.iVarNames = ['current'];
  15978. smalltalk.addMethod(
  15979. smalltalk.method({
  15980. selector: "clear",
  15981. category: 'printing',
  15982. fn: function (){
  15983. var self=this;
  15984. return smalltalk.withContext(function($ctx1) {
  15985. _st(self._current())._clear();
  15986. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.Transcript.klass)})},
  15987. args: [],
  15988. source: "clear\x0a\x09self current clear",
  15989. messageSends: ["clear", "current"],
  15990. referencedClasses: []
  15991. }),
  15992. smalltalk.Transcript.klass);
  15993. smalltalk.addMethod(
  15994. smalltalk.method({
  15995. selector: "cr",
  15996. category: 'printing',
  15997. fn: function (){
  15998. var self=this;
  15999. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  16000. return smalltalk.withContext(function($ctx1) {
  16001. _st(self._current())._show_(_st($String())._cr());
  16002. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.Transcript.klass)})},
  16003. args: [],
  16004. source: "cr\x0a\x09self current show: String cr",
  16005. messageSends: ["show:", "cr", "current"],
  16006. referencedClasses: ["String"]
  16007. }),
  16008. smalltalk.Transcript.klass);
  16009. smalltalk.addMethod(
  16010. smalltalk.method({
  16011. selector: "current",
  16012. category: 'instance creation',
  16013. fn: function (){
  16014. var self=this;
  16015. return smalltalk.withContext(function($ctx1) {
  16016. var $1;
  16017. $1=self["@current"];
  16018. return $1;
  16019. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Transcript.klass)})},
  16020. args: [],
  16021. source: "current\x0a\x09^current",
  16022. messageSends: [],
  16023. referencedClasses: []
  16024. }),
  16025. smalltalk.Transcript.klass);
  16026. smalltalk.addMethod(
  16027. smalltalk.method({
  16028. selector: "inspect:",
  16029. category: 'printing',
  16030. fn: function (anObject){
  16031. var self=this;
  16032. return smalltalk.withContext(function($ctx1) {
  16033. self._show_(anObject);
  16034. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Transcript.klass)})},
  16035. args: ["anObject"],
  16036. source: "inspect: anObject\x0a\x09self show: anObject",
  16037. messageSends: ["show:"],
  16038. referencedClasses: []
  16039. }),
  16040. smalltalk.Transcript.klass);
  16041. smalltalk.addMethod(
  16042. smalltalk.method({
  16043. selector: "new",
  16044. category: 'instance creation',
  16045. fn: function (){
  16046. var self=this;
  16047. return smalltalk.withContext(function($ctx1) {
  16048. self._shouldNotImplement();
  16049. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Transcript.klass)})},
  16050. args: [],
  16051. source: "new\x0a\x09self shouldNotImplement",
  16052. messageSends: ["shouldNotImplement"],
  16053. referencedClasses: []
  16054. }),
  16055. smalltalk.Transcript.klass);
  16056. smalltalk.addMethod(
  16057. smalltalk.method({
  16058. selector: "open",
  16059. category: 'instance creation',
  16060. fn: function (){
  16061. var self=this;
  16062. return smalltalk.withContext(function($ctx1) {
  16063. _st(self._current())._open();
  16064. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.Transcript.klass)})},
  16065. args: [],
  16066. source: "open\x0a\x09self current open",
  16067. messageSends: ["open", "current"],
  16068. referencedClasses: []
  16069. }),
  16070. smalltalk.Transcript.klass);
  16071. smalltalk.addMethod(
  16072. smalltalk.method({
  16073. selector: "register:",
  16074. category: 'instance creation',
  16075. fn: function (aTranscript){
  16076. var self=this;
  16077. return smalltalk.withContext(function($ctx1) {
  16078. self["@current"]=aTranscript;
  16079. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aTranscript:aTranscript},smalltalk.Transcript.klass)})},
  16080. args: ["aTranscript"],
  16081. source: "register: aTranscript\x0a\x09current := aTranscript",
  16082. messageSends: [],
  16083. referencedClasses: []
  16084. }),
  16085. smalltalk.Transcript.klass);
  16086. smalltalk.addMethod(
  16087. smalltalk.method({
  16088. selector: "show:",
  16089. category: 'printing',
  16090. fn: function (anObject){
  16091. var self=this;
  16092. return smalltalk.withContext(function($ctx1) {
  16093. _st(self._current())._show_(anObject);
  16094. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.Transcript.klass)})},
  16095. args: ["anObject"],
  16096. source: "show: anObject\x0a\x09self current show: anObject",
  16097. messageSends: ["show:", "current"],
  16098. referencedClasses: []
  16099. }),
  16100. smalltalk.Transcript.klass);
  16101. smalltalk.addPackage('Kernel-Announcements');
  16102. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  16103. smalltalk.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  16104. smalltalk.addMethod(
  16105. smalltalk.method({
  16106. selector: "announcementClass",
  16107. category: 'accessing',
  16108. fn: function (){
  16109. var self=this;
  16110. return smalltalk.withContext(function($ctx1) {
  16111. var $1;
  16112. $1=self["@announcementClass"];
  16113. return $1;
  16114. }, function($ctx1) {$ctx1.fill(self,"announcementClass",{},smalltalk.AnnouncementSubscription)})},
  16115. args: [],
  16116. source: "announcementClass\x0a\x09^ announcementClass",
  16117. messageSends: [],
  16118. referencedClasses: []
  16119. }),
  16120. smalltalk.AnnouncementSubscription);
  16121. smalltalk.addMethod(
  16122. smalltalk.method({
  16123. selector: "announcementClass:",
  16124. category: 'accessing',
  16125. fn: function (aClass){
  16126. var self=this;
  16127. return smalltalk.withContext(function($ctx1) {
  16128. self["@announcementClass"]=aClass;
  16129. return self}, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},smalltalk.AnnouncementSubscription)})},
  16130. args: ["aClass"],
  16131. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  16132. messageSends: [],
  16133. referencedClasses: []
  16134. }),
  16135. smalltalk.AnnouncementSubscription);
  16136. smalltalk.addMethod(
  16137. smalltalk.method({
  16138. selector: "block",
  16139. category: 'accessing',
  16140. fn: function (){
  16141. var self=this;
  16142. return smalltalk.withContext(function($ctx1) {
  16143. var $1;
  16144. self._deprecatedAPI();
  16145. $1=self._valuable();
  16146. return $1;
  16147. }, function($ctx1) {$ctx1.fill(self,"block",{},smalltalk.AnnouncementSubscription)})},
  16148. args: [],
  16149. source: "block\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09^ self valuable",
  16150. messageSends: ["deprecatedAPI", "valuable"],
  16151. referencedClasses: []
  16152. }),
  16153. smalltalk.AnnouncementSubscription);
  16154. smalltalk.addMethod(
  16155. smalltalk.method({
  16156. selector: "block:",
  16157. category: 'accessing',
  16158. fn: function (aValuable){
  16159. var self=this;
  16160. return smalltalk.withContext(function($ctx1) {
  16161. self._deprecatedAPI();
  16162. self._valuable_(aValuable);
  16163. return self}, function($ctx1) {$ctx1.fill(self,"block:",{aValuable:aValuable},smalltalk.AnnouncementSubscription)})},
  16164. args: ["aValuable"],
  16165. source: "block: aValuable\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09self valuable: aValuable",
  16166. messageSends: ["deprecatedAPI", "valuable:"],
  16167. referencedClasses: []
  16168. }),
  16169. smalltalk.AnnouncementSubscription);
  16170. smalltalk.addMethod(
  16171. smalltalk.method({
  16172. selector: "deliver:",
  16173. category: 'announcing',
  16174. fn: function (anAnnouncement){
  16175. var self=this;
  16176. return smalltalk.withContext(function($ctx1) {
  16177. var $1;
  16178. $1=self._handlesAnnouncement_(anAnnouncement);
  16179. if(smalltalk.assert($1)){
  16180. _st(self._valuable())._value_(anAnnouncement);
  16181. };
  16182. return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
  16183. args: ["anAnnouncement"],
  16184. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self valuable value: anAnnouncement]",
  16185. messageSends: ["ifTrue:", "value:", "valuable", "handlesAnnouncement:"],
  16186. referencedClasses: []
  16187. }),
  16188. smalltalk.AnnouncementSubscription);
  16189. smalltalk.addMethod(
  16190. smalltalk.method({
  16191. selector: "handlesAnnouncement:",
  16192. category: 'announcing',
  16193. fn: function (anAnnouncement){
  16194. var self=this;
  16195. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16196. return smalltalk.withContext(function($ctx1) {
  16197. var $2,$1;
  16198. $2=_st(_st($Smalltalk())._current())._at_(_st(self._announcementClass())._name());
  16199. if(($receiver = $2) == nil || $receiver == undefined){
  16200. return false;
  16201. } else {
  16202. var class_;
  16203. class_=$receiver;
  16204. $1=_st(class_)._includesBehavior_(_st(_st($Smalltalk())._current())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()));
  16205. };
  16206. return $1;
  16207. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
  16208. args: ["anAnnouncement"],
  16209. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk current at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09class includesBehavior: (Smalltalk current at: anAnnouncement class theNonMetaClass name) ]",
  16210. messageSends: ["ifNil:ifNotNil:", "includesBehavior:", "at:", "name", "theNonMetaClass", "class", "current", "announcementClass"],
  16211. referencedClasses: ["Smalltalk"]
  16212. }),
  16213. smalltalk.AnnouncementSubscription);
  16214. smalltalk.addMethod(
  16215. smalltalk.method({
  16216. selector: "receiver",
  16217. category: 'accessing',
  16218. fn: function (){
  16219. var self=this;
  16220. return smalltalk.withContext(function($ctx1) {
  16221. var $1;
  16222. $1=_st(self._valuable())._receiver();
  16223. return $1;
  16224. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AnnouncementSubscription)})},
  16225. args: [],
  16226. source: "receiver\x0a\x09^ self valuable receiver",
  16227. messageSends: ["receiver", "valuable"],
  16228. referencedClasses: []
  16229. }),
  16230. smalltalk.AnnouncementSubscription);
  16231. smalltalk.addMethod(
  16232. smalltalk.method({
  16233. selector: "valuable",
  16234. category: 'accessing',
  16235. fn: function (){
  16236. var self=this;
  16237. return smalltalk.withContext(function($ctx1) {
  16238. var $1;
  16239. $1=self["@valuable"];
  16240. return $1;
  16241. }, function($ctx1) {$ctx1.fill(self,"valuable",{},smalltalk.AnnouncementSubscription)})},
  16242. args: [],
  16243. source: "valuable\x0a\x09^ valuable",
  16244. messageSends: [],
  16245. referencedClasses: []
  16246. }),
  16247. smalltalk.AnnouncementSubscription);
  16248. smalltalk.addMethod(
  16249. smalltalk.method({
  16250. selector: "valuable:",
  16251. category: 'accessing',
  16252. fn: function (aValuable){
  16253. var self=this;
  16254. return smalltalk.withContext(function($ctx1) {
  16255. self["@valuable"]=aValuable;
  16256. return self}, function($ctx1) {$ctx1.fill(self,"valuable:",{aValuable:aValuable},smalltalk.AnnouncementSubscription)})},
  16257. args: ["aValuable"],
  16258. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  16259. messageSends: [],
  16260. referencedClasses: []
  16261. }),
  16262. smalltalk.AnnouncementSubscription);
  16263. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  16264. 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' ].";
  16265. smalltalk.addMethod(
  16266. smalltalk.method({
  16267. selector: "announce:",
  16268. category: 'announcing',
  16269. fn: function (anAnnouncement){
  16270. var self=this;
  16271. return smalltalk.withContext(function($ctx1) {
  16272. _st(self["@subscriptions"])._do_((function(each){
  16273. return smalltalk.withContext(function($ctx2) {
  16274. return _st(each)._deliver_(anAnnouncement);
  16275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  16276. return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.Announcer)})},
  16277. args: ["anAnnouncement"],
  16278. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  16279. messageSends: ["do:", "deliver:"],
  16280. referencedClasses: []
  16281. }),
  16282. smalltalk.Announcer);
  16283. smalltalk.addMethod(
  16284. smalltalk.method({
  16285. selector: "initialize",
  16286. category: 'initialization',
  16287. fn: function (){
  16288. var self=this;
  16289. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  16290. return smalltalk.withContext(function($ctx1) {
  16291. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  16292. self["@subscriptions"]=_st($OrderedCollection())._new();
  16293. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Announcer)})},
  16294. args: [],
  16295. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  16296. messageSends: ["initialize", "new"],
  16297. referencedClasses: ["OrderedCollection"]
  16298. }),
  16299. smalltalk.Announcer);
  16300. smalltalk.addMethod(
  16301. smalltalk.method({
  16302. selector: "on:do:",
  16303. category: 'subscribing',
  16304. fn: function (aClass,aBlock){
  16305. var self=this;
  16306. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  16307. return smalltalk.withContext(function($ctx1) {
  16308. var $1,$2;
  16309. $1=_st($AnnouncementSubscription())._new();
  16310. _st($1)._valuable_(aBlock);
  16311. _st($1)._announcementClass_(aClass);
  16312. $2=_st($1)._yourself();
  16313. _st(self["@subscriptions"])._add_($2);
  16314. return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},smalltalk.Announcer)})},
  16315. args: ["aClass", "aBlock"],
  16316. source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  16317. messageSends: ["add:", "valuable:", "new", "announcementClass:", "yourself"],
  16318. referencedClasses: ["AnnouncementSubscription"]
  16319. }),
  16320. smalltalk.Announcer);
  16321. smalltalk.addMethod(
  16322. smalltalk.method({
  16323. selector: "on:send:to:",
  16324. category: 'subscribing',
  16325. fn: function (aClass,aSelector,anObject){
  16326. var self=this;
  16327. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  16328. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  16329. return smalltalk.withContext(function($ctx1) {
  16330. var $1,$2,$3,$4;
  16331. $1=_st($AnnouncementSubscription())._new();
  16332. $2=_st($MessageSend())._new();
  16333. _st($2)._receiver_(anObject);
  16334. _st($2)._selector_(aSelector);
  16335. $3=_st($2)._yourself();
  16336. _st($1)._valuable_($3);
  16337. _st($1)._announcementClass_(aClass);
  16338. $4=_st($1)._yourself();
  16339. _st(self["@subscriptions"])._add_($4);
  16340. return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},smalltalk.Announcer)})},
  16341. args: ["aClass", "aSelector", "anObject"],
  16342. 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)",
  16343. messageSends: ["add:", "valuable:", "receiver:", "new", "selector:", "yourself", "announcementClass:"],
  16344. referencedClasses: ["MessageSend", "AnnouncementSubscription"]
  16345. }),
  16346. smalltalk.Announcer);
  16347. smalltalk.addMethod(
  16348. smalltalk.method({
  16349. selector: "unsubscribe:",
  16350. category: 'subscribing',
  16351. fn: function (anObject){
  16352. var self=this;
  16353. return smalltalk.withContext(function($ctx1) {
  16354. self["@subscriptions"]=_st(self["@subscriptions"])._reject_((function(each){
  16355. return smalltalk.withContext(function($ctx2) {
  16356. return _st(_st(each)._receiver()).__eq(anObject);
  16357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  16358. return self}, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},smalltalk.Announcer)})},
  16359. args: ["anObject"],
  16360. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  16361. messageSends: ["reject:", "=", "receiver"],
  16362. referencedClasses: []
  16363. }),
  16364. smalltalk.Announcer);
  16365. smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
  16366. 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`";
  16367. smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
  16368. smalltalk.addMethod(
  16369. smalltalk.method({
  16370. selector: "current",
  16371. category: 'accessing',
  16372. fn: function (){
  16373. var self=this;
  16374. return smalltalk.withContext(function($ctx1) {
  16375. var $2,$1;
  16376. $2=self["@current"];
  16377. if(($receiver = $2) == nil || $receiver == undefined){
  16378. self["@current"]=smalltalk.Announcer.klass.fn.prototype._new.apply(_st(self), []);
  16379. $1=self["@current"];
  16380. } else {
  16381. $1=$2;
  16382. };
  16383. return $1;
  16384. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.SystemAnnouncer.klass)})},
  16385. args: [],
  16386. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  16387. messageSends: ["ifNil:", "new"],
  16388. referencedClasses: []
  16389. }),
  16390. smalltalk.SystemAnnouncer.klass);
  16391. smalltalk.addMethod(
  16392. smalltalk.method({
  16393. selector: "new",
  16394. category: 'instance creation',
  16395. fn: function (){
  16396. var self=this;
  16397. return smalltalk.withContext(function($ctx1) {
  16398. self._shouldNotImplement();
  16399. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.SystemAnnouncer.klass)})},
  16400. args: [],
  16401. source: "new\x0a\x09self shouldNotImplement",
  16402. messageSends: ["shouldNotImplement"],
  16403. referencedClasses: []
  16404. }),
  16405. smalltalk.SystemAnnouncer.klass);
  16406. smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
  16407. smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements";
  16408. smalltalk.addMethod(
  16409. smalltalk.method({
  16410. selector: "theClass",
  16411. category: 'accessing',
  16412. fn: function (){
  16413. var self=this;
  16414. return smalltalk.withContext(function($ctx1) {
  16415. var $1;
  16416. $1=self["@theClass"];
  16417. return $1;
  16418. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SystemAnnouncement)})},
  16419. args: [],
  16420. source: "theClass\x0a\x09^ theClass",
  16421. messageSends: [],
  16422. referencedClasses: []
  16423. }),
  16424. smalltalk.SystemAnnouncement);
  16425. smalltalk.addMethod(
  16426. smalltalk.method({
  16427. selector: "theClass:",
  16428. category: 'accessing',
  16429. fn: function (aClass){
  16430. var self=this;
  16431. return smalltalk.withContext(function($ctx1) {
  16432. self["@theClass"]=aClass;
  16433. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SystemAnnouncement)})},
  16434. args: ["aClass"],
  16435. source: "theClass: aClass\x0a\x09theClass := aClass",
  16436. messageSends: [],
  16437. referencedClasses: []
  16438. }),
  16439. smalltalk.SystemAnnouncement);
  16440. smalltalk.addMethod(
  16441. smalltalk.method({
  16442. selector: "heliosClass",
  16443. category: 'helios',
  16444. fn: function (){
  16445. var self=this;
  16446. return smalltalk.withContext(function($ctx1) {
  16447. return "announcement";
  16448. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.SystemAnnouncement.klass)})},
  16449. args: [],
  16450. source: "heliosClass\x0a\x09^ 'announcement'",
  16451. messageSends: [],
  16452. referencedClasses: []
  16453. }),
  16454. smalltalk.SystemAnnouncement.klass);
  16455. smalltalk.addClass('ClassAnnouncement', smalltalk.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  16456. smalltalk.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  16457. smalltalk.addMethod(
  16458. smalltalk.method({
  16459. selector: "theClass",
  16460. category: 'accessing',
  16461. fn: function (){
  16462. var self=this;
  16463. return smalltalk.withContext(function($ctx1) {
  16464. var $1;
  16465. $1=self["@theClass"];
  16466. return $1;
  16467. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassAnnouncement)})},
  16468. args: [],
  16469. source: "theClass\x0a\x09^ theClass",
  16470. messageSends: [],
  16471. referencedClasses: []
  16472. }),
  16473. smalltalk.ClassAnnouncement);
  16474. smalltalk.addMethod(
  16475. smalltalk.method({
  16476. selector: "theClass:",
  16477. category: 'accessing',
  16478. fn: function (aClass){
  16479. var self=this;
  16480. return smalltalk.withContext(function($ctx1) {
  16481. self["@theClass"]=aClass;
  16482. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassAnnouncement)})},
  16483. args: ["aClass"],
  16484. source: "theClass: aClass\x0a\x09theClass := aClass",
  16485. messageSends: [],
  16486. referencedClasses: []
  16487. }),
  16488. smalltalk.ClassAnnouncement);
  16489. smalltalk.addClass('ClassAdded', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  16490. smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  16491. smalltalk.addClass('ClassCommentChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  16492. smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  16493. smalltalk.addClass('ClassDefinitionChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  16494. smalltalk.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  16495. smalltalk.addClass('ClassMigrated', smalltalk.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  16496. smalltalk.ClassMigrated.comment="I am emitted when a class is migrated.";
  16497. smalltalk.addMethod(
  16498. smalltalk.method({
  16499. selector: "oldClass",
  16500. category: 'accessing',
  16501. fn: function (){
  16502. var self=this;
  16503. return smalltalk.withContext(function($ctx1) {
  16504. var $1;
  16505. $1=self["@oldClass"];
  16506. return $1;
  16507. }, function($ctx1) {$ctx1.fill(self,"oldClass",{},smalltalk.ClassMigrated)})},
  16508. args: [],
  16509. source: "oldClass\x0a\x09^ oldClass",
  16510. messageSends: [],
  16511. referencedClasses: []
  16512. }),
  16513. smalltalk.ClassMigrated);
  16514. smalltalk.addMethod(
  16515. smalltalk.method({
  16516. selector: "oldClass:",
  16517. category: 'accessing',
  16518. fn: function (aClass){
  16519. var self=this;
  16520. return smalltalk.withContext(function($ctx1) {
  16521. self["@oldClass"]=aClass;
  16522. return self}, function($ctx1) {$ctx1.fill(self,"oldClass:",{aClass:aClass},smalltalk.ClassMigrated)})},
  16523. args: ["aClass"],
  16524. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  16525. messageSends: [],
  16526. referencedClasses: []
  16527. }),
  16528. smalltalk.ClassMigrated);
  16529. smalltalk.addClass('ClassMoved', smalltalk.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  16530. smalltalk.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  16531. smalltalk.addMethod(
  16532. smalltalk.method({
  16533. selector: "oldPackage",
  16534. category: 'accessing',
  16535. fn: function (){
  16536. var self=this;
  16537. return smalltalk.withContext(function($ctx1) {
  16538. var $1;
  16539. $1=self["@oldPackage"];
  16540. return $1;
  16541. }, function($ctx1) {$ctx1.fill(self,"oldPackage",{},smalltalk.ClassMoved)})},
  16542. args: [],
  16543. source: "oldPackage\x0a\x09^ oldPackage",
  16544. messageSends: [],
  16545. referencedClasses: []
  16546. }),
  16547. smalltalk.ClassMoved);
  16548. smalltalk.addMethod(
  16549. smalltalk.method({
  16550. selector: "oldPackage:",
  16551. category: 'accessing',
  16552. fn: function (aPackage){
  16553. var self=this;
  16554. return smalltalk.withContext(function($ctx1) {
  16555. self["@oldPackage"]=aPackage;
  16556. return self}, function($ctx1) {$ctx1.fill(self,"oldPackage:",{aPackage:aPackage},smalltalk.ClassMoved)})},
  16557. args: ["aPackage"],
  16558. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  16559. messageSends: [],
  16560. referencedClasses: []
  16561. }),
  16562. smalltalk.ClassMoved);
  16563. smalltalk.addClass('ClassRemoved', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  16564. smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  16565. smalltalk.addClass('ClassRenamed', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  16566. smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  16567. smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  16568. smalltalk.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  16569. smalltalk.addMethod(
  16570. smalltalk.method({
  16571. selector: "method",
  16572. category: 'accessing',
  16573. fn: function (){
  16574. var self=this;
  16575. return smalltalk.withContext(function($ctx1) {
  16576. var $1;
  16577. $1=self["@method"];
  16578. return $1;
  16579. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodAnnouncement)})},
  16580. args: [],
  16581. source: "method\x0a\x09^ method",
  16582. messageSends: [],
  16583. referencedClasses: []
  16584. }),
  16585. smalltalk.MethodAnnouncement);
  16586. smalltalk.addMethod(
  16587. smalltalk.method({
  16588. selector: "method:",
  16589. category: 'accessing',
  16590. fn: function (aCompiledMethod){
  16591. var self=this;
  16592. return smalltalk.withContext(function($ctx1) {
  16593. self["@method"]=aCompiledMethod;
  16594. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.MethodAnnouncement)})},
  16595. args: ["aCompiledMethod"],
  16596. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  16597. messageSends: [],
  16598. referencedClasses: []
  16599. }),
  16600. smalltalk.MethodAnnouncement);
  16601. smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  16602. smalltalk.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  16603. smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  16604. 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.";
  16605. smalltalk.addMethod(
  16606. smalltalk.method({
  16607. selector: "oldMethod",
  16608. category: 'accessing',
  16609. fn: function (){
  16610. var self=this;
  16611. return smalltalk.withContext(function($ctx1) {
  16612. var $1;
  16613. $1=self["@oldMethod"];
  16614. return $1;
  16615. }, function($ctx1) {$ctx1.fill(self,"oldMethod",{},smalltalk.MethodModified)})},
  16616. args: [],
  16617. source: "oldMethod\x0a\x09^ oldMethod",
  16618. messageSends: [],
  16619. referencedClasses: []
  16620. }),
  16621. smalltalk.MethodModified);
  16622. smalltalk.addMethod(
  16623. smalltalk.method({
  16624. selector: "oldMethod:",
  16625. category: 'accessing',
  16626. fn: function (aMethod){
  16627. var self=this;
  16628. return smalltalk.withContext(function($ctx1) {
  16629. self["@oldMethod"]=aMethod;
  16630. return self}, function($ctx1) {$ctx1.fill(self,"oldMethod:",{aMethod:aMethod},smalltalk.MethodModified)})},
  16631. args: ["aMethod"],
  16632. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  16633. messageSends: [],
  16634. referencedClasses: []
  16635. }),
  16636. smalltalk.MethodModified);
  16637. smalltalk.addClass('MethodMoved', smalltalk.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  16638. 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.";
  16639. smalltalk.addMethod(
  16640. smalltalk.method({
  16641. selector: "oldProtocol",
  16642. category: 'accessing',
  16643. fn: function (){
  16644. var self=this;
  16645. return smalltalk.withContext(function($ctx1) {
  16646. var $1;
  16647. $1=self["@oldProtocol"];
  16648. return $1;
  16649. }, function($ctx1) {$ctx1.fill(self,"oldProtocol",{},smalltalk.MethodMoved)})},
  16650. args: [],
  16651. source: "oldProtocol\x0a\x09^ oldProtocol",
  16652. messageSends: [],
  16653. referencedClasses: []
  16654. }),
  16655. smalltalk.MethodMoved);
  16656. smalltalk.addMethod(
  16657. smalltalk.method({
  16658. selector: "oldProtocol:",
  16659. category: 'accessing',
  16660. fn: function (aString){
  16661. var self=this;
  16662. return smalltalk.withContext(function($ctx1) {
  16663. self["@oldProtocol"]=aString;
  16664. return self}, function($ctx1) {$ctx1.fill(self,"oldProtocol:",{aString:aString},smalltalk.MethodMoved)})},
  16665. args: ["aString"],
  16666. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  16667. messageSends: [],
  16668. referencedClasses: []
  16669. }),
  16670. smalltalk.MethodMoved);
  16671. smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  16672. smalltalk.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  16673. smalltalk.addClass('PackageAnnouncement', smalltalk.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  16674. smalltalk.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  16675. smalltalk.addMethod(
  16676. smalltalk.method({
  16677. selector: "package",
  16678. category: 'accessing',
  16679. fn: function (){
  16680. var self=this;
  16681. return smalltalk.withContext(function($ctx1) {
  16682. var $1;
  16683. $1=self["@package"];
  16684. return $1;
  16685. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageAnnouncement)})},
  16686. args: [],
  16687. source: "package\x0a\x09^ package",
  16688. messageSends: [],
  16689. referencedClasses: []
  16690. }),
  16691. smalltalk.PackageAnnouncement);
  16692. smalltalk.addMethod(
  16693. smalltalk.method({
  16694. selector: "package:",
  16695. category: 'accessing',
  16696. fn: function (aPackage){
  16697. var self=this;
  16698. return smalltalk.withContext(function($ctx1) {
  16699. self["@package"]=aPackage;
  16700. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageAnnouncement)})},
  16701. args: ["aPackage"],
  16702. source: "package: aPackage\x0a\x09package := aPackage",
  16703. messageSends: [],
  16704. referencedClasses: []
  16705. }),
  16706. smalltalk.PackageAnnouncement);
  16707. smalltalk.addClass('PackageAdded', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
  16708. smalltalk.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  16709. smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
  16710. smalltalk.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  16711. smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  16712. smalltalk.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  16713. smalltalk.addMethod(
  16714. smalltalk.method({
  16715. selector: "protocol",
  16716. category: 'accessing',
  16717. fn: function (){
  16718. var self=this;
  16719. return smalltalk.withContext(function($ctx1) {
  16720. var $1;
  16721. $1=self["@protocol"];
  16722. return $1;
  16723. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.ProtocolAnnouncement)})},
  16724. args: [],
  16725. source: "protocol\x0a\x09^ protocol",
  16726. messageSends: [],
  16727. referencedClasses: []
  16728. }),
  16729. smalltalk.ProtocolAnnouncement);
  16730. smalltalk.addMethod(
  16731. smalltalk.method({
  16732. selector: "protocol:",
  16733. category: 'accessing',
  16734. fn: function (aString){
  16735. var self=this;
  16736. return smalltalk.withContext(function($ctx1) {
  16737. self["@protocol"]=aString;
  16738. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.ProtocolAnnouncement)})},
  16739. args: ["aString"],
  16740. source: "protocol: aString\x0a\x09protocol := aString",
  16741. messageSends: [],
  16742. referencedClasses: []
  16743. }),
  16744. smalltalk.ProtocolAnnouncement);
  16745. smalltalk.addMethod(
  16746. smalltalk.method({
  16747. selector: "theClass",
  16748. category: 'accessing',
  16749. fn: function (){
  16750. var self=this;
  16751. return smalltalk.withContext(function($ctx1) {
  16752. var $1;
  16753. $1=self["@theClass"];
  16754. return $1;
  16755. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ProtocolAnnouncement)})},
  16756. args: [],
  16757. source: "theClass\x0a\x09^ theClass",
  16758. messageSends: [],
  16759. referencedClasses: []
  16760. }),
  16761. smalltalk.ProtocolAnnouncement);
  16762. smalltalk.addMethod(
  16763. smalltalk.method({
  16764. selector: "theClass:",
  16765. category: 'accessing',
  16766. fn: function (aClass){
  16767. var self=this;
  16768. return smalltalk.withContext(function($ctx1) {
  16769. self["@theClass"]=aClass;
  16770. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ProtocolAnnouncement)})},
  16771. args: ["aClass"],
  16772. source: "theClass: aClass\x0a\x09theClass := aClass",
  16773. messageSends: [],
  16774. referencedClasses: []
  16775. }),
  16776. smalltalk.ProtocolAnnouncement);
  16777. smalltalk.addClass('ProtocolAdded', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
  16778. smalltalk.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  16779. smalltalk.addClass('ProtocolRemoved', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
  16780. smalltalk.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  16781. smalltalk.addPackage('Compiler-Exceptions');
  16782. smalltalk.addClass('CompilerError', smalltalk.Error, [], 'Compiler-Exceptions');
  16783. smalltalk.CompilerError.comment="I am the common superclass of all compiling errors.";
  16784. smalltalk.addClass('ParseError', smalltalk.CompilerError, [], 'Compiler-Exceptions');
  16785. smalltalk.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  16786. smalltalk.addClass('SemanticError', smalltalk.CompilerError, [], 'Compiler-Exceptions');
  16787. 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";
  16788. smalltalk.addClass('InliningError', smalltalk.SemanticError, [], 'Compiler-Exceptions');
  16789. smalltalk.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  16790. smalltalk.addClass('InvalidAssignmentError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  16791. smalltalk.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  16792. smalltalk.addMethod(
  16793. smalltalk.method({
  16794. selector: "messageText",
  16795. category: 'accessing',
  16796. fn: function (){
  16797. var self=this;
  16798. return smalltalk.withContext(function($ctx1) {
  16799. var $1;
  16800. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  16801. return $1;
  16802. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.InvalidAssignmentError)})},
  16803. args: [],
  16804. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  16805. messageSends: [",", "variableName"],
  16806. referencedClasses: []
  16807. }),
  16808. smalltalk.InvalidAssignmentError);
  16809. smalltalk.addMethod(
  16810. smalltalk.method({
  16811. selector: "variableName",
  16812. category: 'accessing',
  16813. fn: function (){
  16814. var self=this;
  16815. return smalltalk.withContext(function($ctx1) {
  16816. var $1;
  16817. $1=self["@variableName"];
  16818. return $1;
  16819. }, function($ctx1) {$ctx1.fill(self,"variableName",{},smalltalk.InvalidAssignmentError)})},
  16820. args: [],
  16821. source: "variableName\x0a\x09^ variableName",
  16822. messageSends: [],
  16823. referencedClasses: []
  16824. }),
  16825. smalltalk.InvalidAssignmentError);
  16826. smalltalk.addMethod(
  16827. smalltalk.method({
  16828. selector: "variableName:",
  16829. category: 'accessing',
  16830. fn: function (aString){
  16831. var self=this;
  16832. return smalltalk.withContext(function($ctx1) {
  16833. self["@variableName"]=aString;
  16834. return self}, function($ctx1) {$ctx1.fill(self,"variableName:",{aString:aString},smalltalk.InvalidAssignmentError)})},
  16835. args: ["aString"],
  16836. source: "variableName: aString\x0a\x09variableName := aString",
  16837. messageSends: [],
  16838. referencedClasses: []
  16839. }),
  16840. smalltalk.InvalidAssignmentError);
  16841. smalltalk.addClass('ShadowingVariableError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  16842. 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.";
  16843. smalltalk.addMethod(
  16844. smalltalk.method({
  16845. selector: "messageText",
  16846. category: 'accessing',
  16847. fn: function (){
  16848. var self=this;
  16849. return smalltalk.withContext(function($ctx1) {
  16850. var $1;
  16851. $1=_st("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  16852. return $1;
  16853. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.ShadowingVariableError)})},
  16854. args: [],
  16855. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  16856. messageSends: [",", "variableName"],
  16857. referencedClasses: []
  16858. }),
  16859. smalltalk.ShadowingVariableError);
  16860. smalltalk.addMethod(
  16861. smalltalk.method({
  16862. selector: "variableName",
  16863. category: 'accessing',
  16864. fn: function (){
  16865. var self=this;
  16866. return smalltalk.withContext(function($ctx1) {
  16867. var $1;
  16868. $1=self["@variableName"];
  16869. return $1;
  16870. }, function($ctx1) {$ctx1.fill(self,"variableName",{},smalltalk.ShadowingVariableError)})},
  16871. args: [],
  16872. source: "variableName\x0a\x09^ variableName",
  16873. messageSends: [],
  16874. referencedClasses: []
  16875. }),
  16876. smalltalk.ShadowingVariableError);
  16877. smalltalk.addMethod(
  16878. smalltalk.method({
  16879. selector: "variableName:",
  16880. category: 'accessing',
  16881. fn: function (aString){
  16882. var self=this;
  16883. return smalltalk.withContext(function($ctx1) {
  16884. self["@variableName"]=aString;
  16885. return self}, function($ctx1) {$ctx1.fill(self,"variableName:",{aString:aString},smalltalk.ShadowingVariableError)})},
  16886. args: ["aString"],
  16887. source: "variableName: aString\x0a\x09variableName := aString",
  16888. messageSends: [],
  16889. referencedClasses: []
  16890. }),
  16891. smalltalk.ShadowingVariableError);
  16892. smalltalk.addClass('UnknownVariableError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  16893. 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.";
  16894. smalltalk.addMethod(
  16895. smalltalk.method({
  16896. selector: "messageText",
  16897. category: 'accessing',
  16898. fn: function (){
  16899. var self=this;
  16900. return smalltalk.withContext(function($ctx1) {
  16901. var $1;
  16902. $1=_st("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  16903. return $1;
  16904. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.UnknownVariableError)})},
  16905. args: [],
  16906. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  16907. messageSends: [",", "variableName"],
  16908. referencedClasses: []
  16909. }),
  16910. smalltalk.UnknownVariableError);
  16911. smalltalk.addMethod(
  16912. smalltalk.method({
  16913. selector: "variableName",
  16914. category: 'accessing',
  16915. fn: function (){
  16916. var self=this;
  16917. return smalltalk.withContext(function($ctx1) {
  16918. var $1;
  16919. $1=self["@variableName"];
  16920. return $1;
  16921. }, function($ctx1) {$ctx1.fill(self,"variableName",{},smalltalk.UnknownVariableError)})},
  16922. args: [],
  16923. source: "variableName\x0a\x09^ variableName",
  16924. messageSends: [],
  16925. referencedClasses: []
  16926. }),
  16927. smalltalk.UnknownVariableError);
  16928. smalltalk.addMethod(
  16929. smalltalk.method({
  16930. selector: "variableName:",
  16931. category: 'accessing',
  16932. fn: function (aString){
  16933. var self=this;
  16934. return smalltalk.withContext(function($ctx1) {
  16935. self["@variableName"]=aString;
  16936. return self}, function($ctx1) {$ctx1.fill(self,"variableName:",{aString:aString},smalltalk.UnknownVariableError)})},
  16937. args: ["aString"],
  16938. source: "variableName: aString\x0a\x09variableName := aString",
  16939. messageSends: [],
  16940. referencedClasses: []
  16941. }),
  16942. smalltalk.UnknownVariableError);
  16943. smalltalk.addClass('RethrowErrorHandler', smalltalk.ErrorHandler, [], 'Compiler-Exceptions');
  16944. 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.";
  16945. smalltalk.addMethod(
  16946. smalltalk.method({
  16947. selector: "basicSignal:",
  16948. category: 'error handling',
  16949. fn: function (anError){
  16950. var self=this;
  16951. return smalltalk.withContext(function($ctx1) {
  16952. throw anError;
  16953. return self}, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},smalltalk.RethrowErrorHandler)})},
  16954. args: ["anError"],
  16955. source: "basicSignal: anError\x0a\x09<throw anError>",
  16956. messageSends: [],
  16957. referencedClasses: []
  16958. }),
  16959. smalltalk.RethrowErrorHandler);
  16960. smalltalk.addMethod(
  16961. smalltalk.method({
  16962. selector: "handleError:",
  16963. category: 'error handling',
  16964. fn: function (anError){
  16965. var self=this;
  16966. return smalltalk.withContext(function($ctx1) {
  16967. smalltalk.ErrorHandler.fn.prototype._handleError_.apply(_st(self), [anError]);
  16968. self._basicSignal_(anError);
  16969. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.RethrowErrorHandler)})},
  16970. args: ["anError"],
  16971. source: "handleError: anError\x0a\x09super handleError: anError.\x0a\x09self basicSignal: anError",
  16972. messageSends: ["handleError:", "basicSignal:"],
  16973. referencedClasses: []
  16974. }),
  16975. smalltalk.RethrowErrorHandler);
  16976. smalltalk.addPackage('Compiler-Core');
  16977. smalltalk.addClass('AbstractCodeGenerator', smalltalk.Object, ['currentClass', 'source'], 'Compiler-Core');
  16978. smalltalk.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  16979. smalltalk.addMethod(
  16980. smalltalk.method({
  16981. selector: "classNameFor:",
  16982. category: 'accessing',
  16983. fn: function (aClass){
  16984. var self=this;
  16985. return smalltalk.withContext(function($ctx1) {
  16986. var $2,$3,$1;
  16987. $2=_st(aClass)._isMetaclass();
  16988. if(smalltalk.assert($2)){
  16989. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  16990. } else {
  16991. $3=_st(aClass)._isNil();
  16992. if(smalltalk.assert($3)){
  16993. $1="nil";
  16994. } else {
  16995. $1=_st(aClass)._name();
  16996. };
  16997. };
  16998. return $1;
  16999. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.AbstractCodeGenerator)})},
  17000. args: ["aClass"],
  17001. 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]]",
  17002. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
  17003. referencedClasses: []
  17004. }),
  17005. smalltalk.AbstractCodeGenerator);
  17006. smalltalk.addMethod(
  17007. smalltalk.method({
  17008. selector: "compileNode:",
  17009. category: 'compiling',
  17010. fn: function (aNode){
  17011. var self=this;
  17012. return smalltalk.withContext(function($ctx1) {
  17013. self._subclassResponsibility();
  17014. return self}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},smalltalk.AbstractCodeGenerator)})},
  17015. args: ["aNode"],
  17016. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  17017. messageSends: ["subclassResponsibility"],
  17018. referencedClasses: []
  17019. }),
  17020. smalltalk.AbstractCodeGenerator);
  17021. smalltalk.addMethod(
  17022. smalltalk.method({
  17023. selector: "currentClass",
  17024. category: 'accessing',
  17025. fn: function (){
  17026. var self=this;
  17027. return smalltalk.withContext(function($ctx1) {
  17028. var $1;
  17029. $1=self["@currentClass"];
  17030. return $1;
  17031. }, function($ctx1) {$ctx1.fill(self,"currentClass",{},smalltalk.AbstractCodeGenerator)})},
  17032. args: [],
  17033. source: "currentClass\x0a\x09^currentClass",
  17034. messageSends: [],
  17035. referencedClasses: []
  17036. }),
  17037. smalltalk.AbstractCodeGenerator);
  17038. smalltalk.addMethod(
  17039. smalltalk.method({
  17040. selector: "currentClass:",
  17041. category: 'accessing',
  17042. fn: function (aClass){
  17043. var self=this;
  17044. return smalltalk.withContext(function($ctx1) {
  17045. self["@currentClass"]=aClass;
  17046. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass},smalltalk.AbstractCodeGenerator)})},
  17047. args: ["aClass"],
  17048. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  17049. messageSends: [],
  17050. referencedClasses: []
  17051. }),
  17052. smalltalk.AbstractCodeGenerator);
  17053. smalltalk.addMethod(
  17054. smalltalk.method({
  17055. selector: "pseudoVariables",
  17056. category: 'accessing',
  17057. fn: function (){
  17058. var self=this;
  17059. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17060. return smalltalk.withContext(function($ctx1) {
  17061. var $1;
  17062. $1=_st(_st($Smalltalk())._current())._pseudoVariableNames();
  17063. return $1;
  17064. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},smalltalk.AbstractCodeGenerator)})},
  17065. args: [],
  17066. source: "pseudoVariables\x0a\x09^ Smalltalk current pseudoVariableNames",
  17067. messageSends: ["pseudoVariableNames", "current"],
  17068. referencedClasses: ["Smalltalk"]
  17069. }),
  17070. smalltalk.AbstractCodeGenerator);
  17071. smalltalk.addMethod(
  17072. smalltalk.method({
  17073. selector: "safeVariableNameFor:",
  17074. category: 'accessing',
  17075. fn: function (aString){
  17076. var self=this;
  17077. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17078. return smalltalk.withContext(function($ctx1) {
  17079. var $2,$1;
  17080. $2=_st(_st(_st($Smalltalk())._current())._reservedWords())._includes_(aString);
  17081. if(smalltalk.assert($2)){
  17082. $1=_st(aString).__comma("_");
  17083. } else {
  17084. $1=aString;
  17085. };
  17086. return $1;
  17087. }, function($ctx1) {$ctx1.fill(self,"safeVariableNameFor:",{aString:aString},smalltalk.AbstractCodeGenerator)})},
  17088. args: ["aString"],
  17089. source: "safeVariableNameFor: aString\x0a\x09^(Smalltalk current reservedWords includes: aString)\x0a\x09\x09ifTrue: [aString, '_']\x0a\x09\x09ifFalse: [aString]",
  17090. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
  17091. referencedClasses: ["Smalltalk"]
  17092. }),
  17093. smalltalk.AbstractCodeGenerator);
  17094. smalltalk.addMethod(
  17095. smalltalk.method({
  17096. selector: "source",
  17097. category: 'accessing',
  17098. fn: function (){
  17099. var self=this;
  17100. return smalltalk.withContext(function($ctx1) {
  17101. var $2,$1;
  17102. $2=self["@source"];
  17103. if(($receiver = $2) == nil || $receiver == undefined){
  17104. $1="";
  17105. } else {
  17106. $1=$2;
  17107. };
  17108. return $1;
  17109. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.AbstractCodeGenerator)})},
  17110. args: [],
  17111. source: "source\x0a\x09^source ifNil: ['']",
  17112. messageSends: ["ifNil:"],
  17113. referencedClasses: []
  17114. }),
  17115. smalltalk.AbstractCodeGenerator);
  17116. smalltalk.addMethod(
  17117. smalltalk.method({
  17118. selector: "source:",
  17119. category: 'accessing',
  17120. fn: function (aString){
  17121. var self=this;
  17122. return smalltalk.withContext(function($ctx1) {
  17123. self["@source"]=aString;
  17124. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.AbstractCodeGenerator)})},
  17125. args: ["aString"],
  17126. source: "source: aString\x0a\x09source := aString",
  17127. messageSends: [],
  17128. referencedClasses: []
  17129. }),
  17130. smalltalk.AbstractCodeGenerator);
  17131. smalltalk.addClass('CodeGenerator', smalltalk.AbstractCodeGenerator, [], 'Compiler-Core');
  17132. 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.";
  17133. smalltalk.addMethod(
  17134. smalltalk.method({
  17135. selector: "compileNode:",
  17136. category: 'compiling',
  17137. fn: function (aNode){
  17138. var self=this;
  17139. var ir,stream;
  17140. return smalltalk.withContext(function($ctx1) {
  17141. var $2,$3,$1;
  17142. _st(self._semanticAnalyzer())._visit_(aNode);
  17143. ir=_st(self._translator())._visit_(aNode);
  17144. $2=self._irTranslator();
  17145. _st($2)._visit_(ir);
  17146. $3=_st($2)._contents();
  17147. $1=$3;
  17148. return $1;
  17149. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},smalltalk.CodeGenerator)})},
  17150. args: ["aNode"],
  17151. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  17152. messageSends: ["visit:", "semanticAnalyzer", "translator", "irTranslator", "contents"],
  17153. referencedClasses: []
  17154. }),
  17155. smalltalk.CodeGenerator);
  17156. smalltalk.addMethod(
  17157. smalltalk.method({
  17158. selector: "irTranslator",
  17159. category: 'compiling',
  17160. fn: function (){
  17161. var self=this;
  17162. function $IRJSTranslator(){return smalltalk.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  17163. return smalltalk.withContext(function($ctx1) {
  17164. var $1;
  17165. $1=_st($IRJSTranslator())._new();
  17166. return $1;
  17167. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},smalltalk.CodeGenerator)})},
  17168. args: [],
  17169. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  17170. messageSends: ["new"],
  17171. referencedClasses: ["IRJSTranslator"]
  17172. }),
  17173. smalltalk.CodeGenerator);
  17174. smalltalk.addMethod(
  17175. smalltalk.method({
  17176. selector: "semanticAnalyzer",
  17177. category: 'compiling',
  17178. fn: function (){
  17179. var self=this;
  17180. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  17181. return smalltalk.withContext(function($ctx1) {
  17182. var $1;
  17183. $1=_st($SemanticAnalyzer())._on_(self._currentClass());
  17184. return $1;
  17185. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},smalltalk.CodeGenerator)})},
  17186. args: [],
  17187. source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
  17188. messageSends: ["on:", "currentClass"],
  17189. referencedClasses: ["SemanticAnalyzer"]
  17190. }),
  17191. smalltalk.CodeGenerator);
  17192. smalltalk.addMethod(
  17193. smalltalk.method({
  17194. selector: "translator",
  17195. category: 'compiling',
  17196. fn: function (){
  17197. var self=this;
  17198. function $IRASTTranslator(){return smalltalk.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  17199. return smalltalk.withContext(function($ctx1) {
  17200. var $2,$3,$1;
  17201. $2=_st($IRASTTranslator())._new();
  17202. _st($2)._source_(self._source());
  17203. _st($2)._theClass_(self._currentClass());
  17204. $3=_st($2)._yourself();
  17205. $1=$3;
  17206. return $1;
  17207. }, function($ctx1) {$ctx1.fill(self,"translator",{},smalltalk.CodeGenerator)})},
  17208. args: [],
  17209. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  17210. messageSends: ["source:", "source", "new", "theClass:", "currentClass", "yourself"],
  17211. referencedClasses: ["IRASTTranslator"]
  17212. }),
  17213. smalltalk.CodeGenerator);
  17214. smalltalk.addClass('Compiler', smalltalk.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  17215. 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`";
  17216. smalltalk.addMethod(
  17217. smalltalk.method({
  17218. selector: "codeGeneratorClass",
  17219. category: 'accessing',
  17220. fn: function (){
  17221. var self=this;
  17222. function $InliningCodeGenerator(){return smalltalk.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  17223. return smalltalk.withContext(function($ctx1) {
  17224. var $2,$1;
  17225. $2=self["@codeGeneratorClass"];
  17226. if(($receiver = $2) == nil || $receiver == undefined){
  17227. $1=$InliningCodeGenerator();
  17228. } else {
  17229. $1=$2;
  17230. };
  17231. return $1;
  17232. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.Compiler)})},
  17233. args: [],
  17234. source: "codeGeneratorClass\x0a\x09^codeGeneratorClass ifNil: [InliningCodeGenerator]",
  17235. messageSends: ["ifNil:"],
  17236. referencedClasses: ["InliningCodeGenerator"]
  17237. }),
  17238. smalltalk.Compiler);
  17239. smalltalk.addMethod(
  17240. smalltalk.method({
  17241. selector: "codeGeneratorClass:",
  17242. category: 'accessing',
  17243. fn: function (aClass){
  17244. var self=this;
  17245. return smalltalk.withContext(function($ctx1) {
  17246. self["@codeGeneratorClass"]=aClass;
  17247. return self}, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass:",{aClass:aClass},smalltalk.Compiler)})},
  17248. args: ["aClass"],
  17249. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  17250. messageSends: [],
  17251. referencedClasses: []
  17252. }),
  17253. smalltalk.Compiler);
  17254. smalltalk.addMethod(
  17255. smalltalk.method({
  17256. selector: "compile:",
  17257. category: 'compiling',
  17258. fn: function (aString){
  17259. var self=this;
  17260. return smalltalk.withContext(function($ctx1) {
  17261. var $1;
  17262. $1=self._compileNode_(self._parse_(aString));
  17263. return $1;
  17264. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Compiler)})},
  17265. args: ["aString"],
  17266. source: "compile: aString\x0a\x09^self compileNode: (self parse: aString)",
  17267. messageSends: ["compileNode:", "parse:"],
  17268. referencedClasses: []
  17269. }),
  17270. smalltalk.Compiler);
  17271. smalltalk.addMethod(
  17272. smalltalk.method({
  17273. selector: "compile:forClass:",
  17274. category: 'compiling',
  17275. fn: function (aString,aClass){
  17276. var self=this;
  17277. return smalltalk.withContext(function($ctx1) {
  17278. var $1;
  17279. self._currentClass_(aClass);
  17280. self._source_(aString);
  17281. $1=self._compile_(aString);
  17282. return $1;
  17283. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass},smalltalk.Compiler)})},
  17284. args: ["aString", "aClass"],
  17285. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^self compile: aString",
  17286. messageSends: ["currentClass:", "source:", "compile:"],
  17287. referencedClasses: []
  17288. }),
  17289. smalltalk.Compiler);
  17290. smalltalk.addMethod(
  17291. smalltalk.method({
  17292. selector: "compileExpression:",
  17293. category: 'compiling',
  17294. fn: function (aString){
  17295. var self=this;
  17296. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  17297. return smalltalk.withContext(function($ctx1) {
  17298. var $1;
  17299. self._currentClass_($DoIt());
  17300. self._source_(_st("doIt ^[".__comma(aString)).__comma("] value"));
  17301. $1=self._compileNode_(self._parse_(self._source()));
  17302. return $1;
  17303. }, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString},smalltalk.Compiler)})},
  17304. args: ["aString"],
  17305. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
  17306. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
  17307. referencedClasses: ["DoIt"]
  17308. }),
  17309. smalltalk.Compiler);
  17310. smalltalk.addMethod(
  17311. smalltalk.method({
  17312. selector: "compileExpression:on:",
  17313. category: 'compiling',
  17314. fn: function (aString,anObject){
  17315. var self=this;
  17316. return smalltalk.withContext(function($ctx1) {
  17317. var $1;
  17318. self._currentClass_(_st(anObject)._class());
  17319. self._source_(_st("xxxDoIt ^[".__comma(aString)).__comma("] value"));
  17320. $1=self._compileNode_(self._parse_(self._source()));
  17321. return $1;
  17322. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},smalltalk.Compiler)})},
  17323. args: ["aString", "anObject"],
  17324. source: "compileExpression: aString on: anObject\x0a\x09self currentClass: anObject class.\x0a\x09self source: 'xxxDoIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
  17325. messageSends: ["currentClass:", "class", "source:", ",", "compileNode:", "parse:", "source"],
  17326. referencedClasses: []
  17327. }),
  17328. smalltalk.Compiler);
  17329. smalltalk.addMethod(
  17330. smalltalk.method({
  17331. selector: "compileNode:",
  17332. category: 'compiling',
  17333. fn: function (aNode){
  17334. var self=this;
  17335. var generator,result;
  17336. return smalltalk.withContext(function($ctx1) {
  17337. var $1,$2,$3;
  17338. generator=_st(self._codeGeneratorClass())._new();
  17339. $1=generator;
  17340. _st($1)._source_(self._source());
  17341. $2=_st($1)._currentClass_(self._currentClass());
  17342. result=_st(generator)._compileNode_(aNode);
  17343. self._unknownVariables_([]);
  17344. $3=result;
  17345. return $3;
  17346. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},smalltalk.Compiler)})},
  17347. args: ["aNode"],
  17348. 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",
  17349. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
  17350. referencedClasses: []
  17351. }),
  17352. smalltalk.Compiler);
  17353. smalltalk.addMethod(
  17354. smalltalk.method({
  17355. selector: "currentClass",
  17356. category: 'accessing',
  17357. fn: function (){
  17358. var self=this;
  17359. return smalltalk.withContext(function($ctx1) {
  17360. var $1;
  17361. $1=self["@currentClass"];
  17362. return $1;
  17363. }, function($ctx1) {$ctx1.fill(self,"currentClass",{},smalltalk.Compiler)})},
  17364. args: [],
  17365. source: "currentClass\x0a\x09^currentClass",
  17366. messageSends: [],
  17367. referencedClasses: []
  17368. }),
  17369. smalltalk.Compiler);
  17370. smalltalk.addMethod(
  17371. smalltalk.method({
  17372. selector: "currentClass:",
  17373. category: 'accessing',
  17374. fn: function (aClass){
  17375. var self=this;
  17376. return smalltalk.withContext(function($ctx1) {
  17377. self["@currentClass"]=aClass;
  17378. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass},smalltalk.Compiler)})},
  17379. args: ["aClass"],
  17380. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  17381. messageSends: [],
  17382. referencedClasses: []
  17383. }),
  17384. smalltalk.Compiler);
  17385. smalltalk.addMethod(
  17386. smalltalk.method({
  17387. selector: "eval:",
  17388. category: 'compiling',
  17389. fn: function (aString){
  17390. var self=this;
  17391. return smalltalk.withContext(function($ctx1) {
  17392. return eval(aString);
  17393. return self}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},smalltalk.Compiler)})},
  17394. args: ["aString"],
  17395. source: "eval: aString\x0a\x09<return eval(aString)>",
  17396. messageSends: [],
  17397. referencedClasses: []
  17398. }),
  17399. smalltalk.Compiler);
  17400. smalltalk.addMethod(
  17401. smalltalk.method({
  17402. selector: "evaluateExpression:",
  17403. category: 'compiling',
  17404. fn: function (aString){
  17405. var self=this;
  17406. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  17407. return smalltalk.withContext(function($ctx1) {
  17408. var $1;
  17409. $1=self._evaluateExpression_on_(aString,_st($DoIt())._new());
  17410. return $1;
  17411. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},smalltalk.Compiler)})},
  17412. args: ["aString"],
  17413. 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",
  17414. messageSends: ["evaluateExpression:on:", "new"],
  17415. referencedClasses: ["DoIt"]
  17416. }),
  17417. smalltalk.Compiler);
  17418. smalltalk.addMethod(
  17419. smalltalk.method({
  17420. selector: "evaluateExpression:on:",
  17421. category: 'compiling',
  17422. fn: function (aString,anObject){
  17423. var self=this;
  17424. var result,method;
  17425. return smalltalk.withContext(function($ctx1) {
  17426. var $1;
  17427. method=self._eval_(self._compileExpression_on_(aString,anObject));
  17428. _st(method)._category_("xxxDoIt");
  17429. _st(_st(anObject)._class())._addCompiledMethod_(method);
  17430. result=_st(anObject)._xxxDoIt();
  17431. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  17432. $1=result;
  17433. return $1;
  17434. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},smalltalk.Compiler)})},
  17435. args: ["aString", "anObject"],
  17436. 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",
  17437. messageSends: ["eval:", "compileExpression:on:", "category:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"],
  17438. referencedClasses: []
  17439. }),
  17440. smalltalk.Compiler);
  17441. smalltalk.addMethod(
  17442. smalltalk.method({
  17443. selector: "install:forClass:category:",
  17444. category: 'compiling',
  17445. fn: function (aString,aBehavior,anotherString){
  17446. var self=this;
  17447. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  17448. return smalltalk.withContext(function($ctx1) {
  17449. var $1;
  17450. $1=_st(_st($ClassBuilder())._new())._installMethod_forClass_category_(self._eval_(self._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
  17451. return $1;
  17452. }, function($ctx1) {$ctx1.fill(self,"install:forClass:category:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString},smalltalk.Compiler)})},
  17453. args: ["aString", "aBehavior", "anotherString"],
  17454. 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",
  17455. messageSends: ["installMethod:forClass:category:", "eval:", "compile:forClass:", "new"],
  17456. referencedClasses: ["ClassBuilder"]
  17457. }),
  17458. smalltalk.Compiler);
  17459. smalltalk.addMethod(
  17460. smalltalk.method({
  17461. selector: "parse:",
  17462. category: 'compiling',
  17463. fn: function (aString){
  17464. var self=this;
  17465. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17466. return smalltalk.withContext(function($ctx1) {
  17467. var $1;
  17468. $1=_st(_st($Smalltalk())._current())._parse_(aString);
  17469. return $1;
  17470. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Compiler)})},
  17471. args: ["aString"],
  17472. source: "parse: aString\x0a\x09^Smalltalk current parse: aString",
  17473. messageSends: ["parse:", "current"],
  17474. referencedClasses: ["Smalltalk"]
  17475. }),
  17476. smalltalk.Compiler);
  17477. smalltalk.addMethod(
  17478. smalltalk.method({
  17479. selector: "parseExpression:",
  17480. category: 'compiling',
  17481. fn: function (aString){
  17482. var self=this;
  17483. return smalltalk.withContext(function($ctx1) {
  17484. var $1;
  17485. $1=self._parse_(_st("doIt ^[".__comma(aString)).__comma("] value"));
  17486. return $1;
  17487. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},smalltalk.Compiler)})},
  17488. args: ["aString"],
  17489. source: "parseExpression: aString\x0a\x09^self parse: 'doIt ^[', aString, '] value'",
  17490. messageSends: ["parse:", ","],
  17491. referencedClasses: []
  17492. }),
  17493. smalltalk.Compiler);
  17494. smalltalk.addMethod(
  17495. smalltalk.method({
  17496. selector: "recompile:",
  17497. category: 'compiling',
  17498. fn: function (aClass){
  17499. var self=this;
  17500. return smalltalk.withContext(function($ctx1) {
  17501. var $1;
  17502. _st(_st(_st(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  17503. return smalltalk.withContext(function($ctx2) {
  17504. return self._install_forClass_category_(_st(each)._source(),aClass,_st(each)._category());
  17505. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),"Recompiling ".__comma(_st(aClass)._name()));
  17506. $1=_st(aClass)._isMetaclass();
  17507. if(! smalltalk.assert($1)){
  17508. self._recompile_(_st(aClass)._class());
  17509. };
  17510. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},smalltalk.Compiler)})},
  17511. args: ["aClass"],
  17512. 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 ]",
  17513. messageSends: ["do:displayingProgress:", "install:forClass:category:", "source", "category", ",", "name", "values", "methodDictionary", "ifFalse:", "recompile:", "class", "isMetaclass"],
  17514. referencedClasses: []
  17515. }),
  17516. smalltalk.Compiler);
  17517. smalltalk.addMethod(
  17518. smalltalk.method({
  17519. selector: "recompileAll",
  17520. category: 'compiling',
  17521. fn: function (){
  17522. var self=this;
  17523. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17524. return smalltalk.withContext(function($ctx1) {
  17525. _st(_st(_st($Smalltalk())._current())._classes())._do_displayingProgress_((function(each){
  17526. return smalltalk.withContext(function($ctx2) {
  17527. return self._recompile_(each);
  17528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),"Compiling all classes...");
  17529. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},smalltalk.Compiler)})},
  17530. args: [],
  17531. source: "recompileAll\x0a\x09Smalltalk current classes \x0a\x09\x09do: [:each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  17532. messageSends: ["do:displayingProgress:", "recompile:", "classes", "current"],
  17533. referencedClasses: ["Smalltalk"]
  17534. }),
  17535. smalltalk.Compiler);
  17536. smalltalk.addMethod(
  17537. smalltalk.method({
  17538. selector: "source",
  17539. category: 'accessing',
  17540. fn: function (){
  17541. var self=this;
  17542. return smalltalk.withContext(function($ctx1) {
  17543. var $2,$1;
  17544. $2=self["@source"];
  17545. if(($receiver = $2) == nil || $receiver == undefined){
  17546. $1="";
  17547. } else {
  17548. $1=$2;
  17549. };
  17550. return $1;
  17551. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.Compiler)})},
  17552. args: [],
  17553. source: "source\x0a\x09^source ifNil: ['']",
  17554. messageSends: ["ifNil:"],
  17555. referencedClasses: []
  17556. }),
  17557. smalltalk.Compiler);
  17558. smalltalk.addMethod(
  17559. smalltalk.method({
  17560. selector: "source:",
  17561. category: 'accessing',
  17562. fn: function (aString){
  17563. var self=this;
  17564. return smalltalk.withContext(function($ctx1) {
  17565. self["@source"]=aString;
  17566. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.Compiler)})},
  17567. args: ["aString"],
  17568. source: "source: aString\x0a\x09source := aString",
  17569. messageSends: [],
  17570. referencedClasses: []
  17571. }),
  17572. smalltalk.Compiler);
  17573. smalltalk.addMethod(
  17574. smalltalk.method({
  17575. selector: "unknownVariables",
  17576. category: 'accessing',
  17577. fn: function (){
  17578. var self=this;
  17579. return smalltalk.withContext(function($ctx1) {
  17580. var $1;
  17581. $1=self["@unknownVariables"];
  17582. return $1;
  17583. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},smalltalk.Compiler)})},
  17584. args: [],
  17585. source: "unknownVariables\x0a\x09^unknownVariables",
  17586. messageSends: [],
  17587. referencedClasses: []
  17588. }),
  17589. smalltalk.Compiler);
  17590. smalltalk.addMethod(
  17591. smalltalk.method({
  17592. selector: "unknownVariables:",
  17593. category: 'accessing',
  17594. fn: function (aCollection){
  17595. var self=this;
  17596. return smalltalk.withContext(function($ctx1) {
  17597. self["@unknownVariables"]=aCollection;
  17598. return self}, function($ctx1) {$ctx1.fill(self,"unknownVariables:",{aCollection:aCollection},smalltalk.Compiler)})},
  17599. args: ["aCollection"],
  17600. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  17601. messageSends: [],
  17602. referencedClasses: []
  17603. }),
  17604. smalltalk.Compiler);
  17605. smalltalk.addMethod(
  17606. smalltalk.method({
  17607. selector: "recompile:",
  17608. category: 'compiling',
  17609. fn: function (aClass){
  17610. var self=this;
  17611. return smalltalk.withContext(function($ctx1) {
  17612. _st(self._new())._recompile_(aClass);
  17613. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},smalltalk.Compiler.klass)})},
  17614. args: ["aClass"],
  17615. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  17616. messageSends: ["recompile:", "new"],
  17617. referencedClasses: []
  17618. }),
  17619. smalltalk.Compiler.klass);
  17620. smalltalk.addMethod(
  17621. smalltalk.method({
  17622. selector: "recompileAll",
  17623. category: 'compiling',
  17624. fn: function (){
  17625. var self=this;
  17626. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17627. return smalltalk.withContext(function($ctx1) {
  17628. _st(_st(_st($Smalltalk())._current())._classes())._do_((function(each){
  17629. return smalltalk.withContext(function($ctx2) {
  17630. return self._recompile_(each);
  17631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  17632. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},smalltalk.Compiler.klass)})},
  17633. args: [],
  17634. source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09self recompile: each]",
  17635. messageSends: ["do:", "recompile:", "classes", "current"],
  17636. referencedClasses: ["Smalltalk"]
  17637. }),
  17638. smalltalk.Compiler.klass);
  17639. smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler-Core');
  17640. smalltalk.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  17641. smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler-Core');
  17642. smalltalk.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  17643. smalltalk.addMethod(
  17644. smalltalk.method({
  17645. selector: "visit:",
  17646. category: 'visiting',
  17647. fn: function (aNode){
  17648. var self=this;
  17649. return smalltalk.withContext(function($ctx1) {
  17650. var $1;
  17651. $1=_st(aNode)._accept_(self);
  17652. return $1;
  17653. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17654. args: ["aNode"],
  17655. source: "visit: aNode\x0a\x09^ aNode accept: self",
  17656. messageSends: ["accept:"],
  17657. referencedClasses: []
  17658. }),
  17659. smalltalk.NodeVisitor);
  17660. smalltalk.addMethod(
  17661. smalltalk.method({
  17662. selector: "visitAll:",
  17663. category: 'visiting',
  17664. fn: function (aCollection){
  17665. var self=this;
  17666. return smalltalk.withContext(function($ctx1) {
  17667. var $1;
  17668. $1=_st(aCollection)._collect_((function(each){
  17669. return smalltalk.withContext(function($ctx2) {
  17670. return self._visit_(each);
  17671. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  17672. return $1;
  17673. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},smalltalk.NodeVisitor)})},
  17674. args: ["aCollection"],
  17675. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  17676. messageSends: ["collect:", "visit:"],
  17677. referencedClasses: []
  17678. }),
  17679. smalltalk.NodeVisitor);
  17680. smalltalk.addMethod(
  17681. smalltalk.method({
  17682. selector: "visitAssignmentNode:",
  17683. category: 'visiting',
  17684. fn: function (aNode){
  17685. var self=this;
  17686. return smalltalk.withContext(function($ctx1) {
  17687. var $1;
  17688. $1=self._visitNode_(aNode);
  17689. return $1;
  17690. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17691. args: ["aNode"],
  17692. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  17693. messageSends: ["visitNode:"],
  17694. referencedClasses: []
  17695. }),
  17696. smalltalk.NodeVisitor);
  17697. smalltalk.addMethod(
  17698. smalltalk.method({
  17699. selector: "visitBlockNode:",
  17700. category: 'visiting',
  17701. fn: function (aNode){
  17702. var self=this;
  17703. return smalltalk.withContext(function($ctx1) {
  17704. var $1;
  17705. $1=self._visitNode_(aNode);
  17706. return $1;
  17707. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17708. args: ["aNode"],
  17709. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  17710. messageSends: ["visitNode:"],
  17711. referencedClasses: []
  17712. }),
  17713. smalltalk.NodeVisitor);
  17714. smalltalk.addMethod(
  17715. smalltalk.method({
  17716. selector: "visitBlockSequenceNode:",
  17717. category: 'visiting',
  17718. fn: function (aNode){
  17719. var self=this;
  17720. return smalltalk.withContext(function($ctx1) {
  17721. var $1;
  17722. $1=self._visitSequenceNode_(aNode);
  17723. return $1;
  17724. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17725. args: ["aNode"],
  17726. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  17727. messageSends: ["visitSequenceNode:"],
  17728. referencedClasses: []
  17729. }),
  17730. smalltalk.NodeVisitor);
  17731. smalltalk.addMethod(
  17732. smalltalk.method({
  17733. selector: "visitCascadeNode:",
  17734. category: 'visiting',
  17735. fn: function (aNode){
  17736. var self=this;
  17737. return smalltalk.withContext(function($ctx1) {
  17738. var $1;
  17739. $1=self._visitNode_(aNode);
  17740. return $1;
  17741. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17742. args: ["aNode"],
  17743. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  17744. messageSends: ["visitNode:"],
  17745. referencedClasses: []
  17746. }),
  17747. smalltalk.NodeVisitor);
  17748. smalltalk.addMethod(
  17749. smalltalk.method({
  17750. selector: "visitClassReferenceNode:",
  17751. category: 'visiting',
  17752. fn: function (aNode){
  17753. var self=this;
  17754. return smalltalk.withContext(function($ctx1) {
  17755. var $1;
  17756. $1=self._visitVariableNode_(aNode);
  17757. return $1;
  17758. }, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17759. args: ["aNode"],
  17760. source: "visitClassReferenceNode: aNode\x0a\x09^ self visitVariableNode: aNode",
  17761. messageSends: ["visitVariableNode:"],
  17762. referencedClasses: []
  17763. }),
  17764. smalltalk.NodeVisitor);
  17765. smalltalk.addMethod(
  17766. smalltalk.method({
  17767. selector: "visitDynamicArrayNode:",
  17768. category: 'visiting',
  17769. fn: function (aNode){
  17770. var self=this;
  17771. return smalltalk.withContext(function($ctx1) {
  17772. var $1;
  17773. $1=self._visitNode_(aNode);
  17774. return $1;
  17775. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17776. args: ["aNode"],
  17777. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  17778. messageSends: ["visitNode:"],
  17779. referencedClasses: []
  17780. }),
  17781. smalltalk.NodeVisitor);
  17782. smalltalk.addMethod(
  17783. smalltalk.method({
  17784. selector: "visitDynamicDictionaryNode:",
  17785. category: 'visiting',
  17786. fn: function (aNode){
  17787. var self=this;
  17788. return smalltalk.withContext(function($ctx1) {
  17789. var $1;
  17790. $1=self._visitNode_(aNode);
  17791. return $1;
  17792. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17793. args: ["aNode"],
  17794. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  17795. messageSends: ["visitNode:"],
  17796. referencedClasses: []
  17797. }),
  17798. smalltalk.NodeVisitor);
  17799. smalltalk.addMethod(
  17800. smalltalk.method({
  17801. selector: "visitJSStatementNode:",
  17802. category: 'visiting',
  17803. fn: function (aNode){
  17804. var self=this;
  17805. return smalltalk.withContext(function($ctx1) {
  17806. var $1;
  17807. $1=self._visitNode_(aNode);
  17808. return $1;
  17809. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17810. args: ["aNode"],
  17811. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  17812. messageSends: ["visitNode:"],
  17813. referencedClasses: []
  17814. }),
  17815. smalltalk.NodeVisitor);
  17816. smalltalk.addMethod(
  17817. smalltalk.method({
  17818. selector: "visitMethodNode:",
  17819. category: 'visiting',
  17820. fn: function (aNode){
  17821. var self=this;
  17822. return smalltalk.withContext(function($ctx1) {
  17823. var $1;
  17824. $1=self._visitNode_(aNode);
  17825. return $1;
  17826. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17827. args: ["aNode"],
  17828. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  17829. messageSends: ["visitNode:"],
  17830. referencedClasses: []
  17831. }),
  17832. smalltalk.NodeVisitor);
  17833. smalltalk.addMethod(
  17834. smalltalk.method({
  17835. selector: "visitNode:",
  17836. category: 'visiting',
  17837. fn: function (aNode){
  17838. var self=this;
  17839. return smalltalk.withContext(function($ctx1) {
  17840. var $1;
  17841. $1=self._visitAll_(_st(aNode)._nodes());
  17842. return $1;
  17843. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17844. args: ["aNode"],
  17845. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  17846. messageSends: ["visitAll:", "nodes"],
  17847. referencedClasses: []
  17848. }),
  17849. smalltalk.NodeVisitor);
  17850. smalltalk.addMethod(
  17851. smalltalk.method({
  17852. selector: "visitReturnNode:",
  17853. category: 'visiting',
  17854. fn: function (aNode){
  17855. var self=this;
  17856. return smalltalk.withContext(function($ctx1) {
  17857. var $1;
  17858. $1=self._visitNode_(aNode);
  17859. return $1;
  17860. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17861. args: ["aNode"],
  17862. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  17863. messageSends: ["visitNode:"],
  17864. referencedClasses: []
  17865. }),
  17866. smalltalk.NodeVisitor);
  17867. smalltalk.addMethod(
  17868. smalltalk.method({
  17869. selector: "visitSendNode:",
  17870. category: 'visiting',
  17871. fn: function (aNode){
  17872. var self=this;
  17873. return smalltalk.withContext(function($ctx1) {
  17874. var $1;
  17875. $1=self._visitNode_(aNode);
  17876. return $1;
  17877. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17878. args: ["aNode"],
  17879. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  17880. messageSends: ["visitNode:"],
  17881. referencedClasses: []
  17882. }),
  17883. smalltalk.NodeVisitor);
  17884. smalltalk.addMethod(
  17885. smalltalk.method({
  17886. selector: "visitSequenceNode:",
  17887. category: 'visiting',
  17888. fn: function (aNode){
  17889. var self=this;
  17890. return smalltalk.withContext(function($ctx1) {
  17891. var $1;
  17892. $1=self._visitNode_(aNode);
  17893. return $1;
  17894. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17895. args: ["aNode"],
  17896. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  17897. messageSends: ["visitNode:"],
  17898. referencedClasses: []
  17899. }),
  17900. smalltalk.NodeVisitor);
  17901. smalltalk.addMethod(
  17902. smalltalk.method({
  17903. selector: "visitValueNode:",
  17904. category: 'visiting',
  17905. fn: function (aNode){
  17906. var self=this;
  17907. return smalltalk.withContext(function($ctx1) {
  17908. var $1;
  17909. $1=self._visitNode_(aNode);
  17910. return $1;
  17911. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17912. args: ["aNode"],
  17913. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  17914. messageSends: ["visitNode:"],
  17915. referencedClasses: []
  17916. }),
  17917. smalltalk.NodeVisitor);
  17918. smalltalk.addMethod(
  17919. smalltalk.method({
  17920. selector: "visitVariableNode:",
  17921. category: 'visiting',
  17922. fn: function (aNode){
  17923. var self=this;
  17924. return smalltalk.withContext(function($ctx1) {
  17925. var $1;
  17926. $1=self._visitNode_(aNode);
  17927. return $1;
  17928. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17929. args: ["aNode"],
  17930. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  17931. messageSends: ["visitNode:"],
  17932. referencedClasses: []
  17933. }),
  17934. smalltalk.NodeVisitor);
  17935. smalltalk.addPackage('Compiler-AST');
  17936. smalltalk.addClass('Node', smalltalk.Object, ['parent', 'position', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  17937. 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.";
  17938. smalltalk.addMethod(
  17939. smalltalk.method({
  17940. selector: "accept:",
  17941. category: 'visiting',
  17942. fn: function (aVisitor){
  17943. var self=this;
  17944. return smalltalk.withContext(function($ctx1) {
  17945. var $1;
  17946. $1=_st(aVisitor)._visitNode_(self);
  17947. return $1;
  17948. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.Node)})},
  17949. args: ["aVisitor"],
  17950. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  17951. messageSends: ["visitNode:"],
  17952. referencedClasses: []
  17953. }),
  17954. smalltalk.Node);
  17955. smalltalk.addMethod(
  17956. smalltalk.method({
  17957. selector: "addNode:",
  17958. category: 'accessing',
  17959. fn: function (aNode){
  17960. var self=this;
  17961. return smalltalk.withContext(function($ctx1) {
  17962. _st(self._nodes())._add_(aNode);
  17963. _st(aNode)._parent_(self);
  17964. return self}, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},smalltalk.Node)})},
  17965. args: ["aNode"],
  17966. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  17967. messageSends: ["add:", "nodes", "parent:"],
  17968. referencedClasses: []
  17969. }),
  17970. smalltalk.Node);
  17971. smalltalk.addMethod(
  17972. smalltalk.method({
  17973. selector: "extent",
  17974. category: 'accessing',
  17975. fn: function (){
  17976. var self=this;
  17977. return smalltalk.withContext(function($ctx1) {
  17978. var $2,$3,$1;
  17979. $2=self._nextNode();
  17980. if(($receiver = $2) == nil || $receiver == undefined){
  17981. $3=self._parent();
  17982. if(($receiver = $3) == nil || $receiver == undefined){
  17983. $1=$3;
  17984. } else {
  17985. var node;
  17986. node=$receiver;
  17987. $1=_st(node)._extent();
  17988. };
  17989. } else {
  17990. var node;
  17991. node=$receiver;
  17992. $1=_st(node)._position();
  17993. };
  17994. return $1;
  17995. }, function($ctx1) {$ctx1.fill(self,"extent",{},smalltalk.Node)})},
  17996. args: [],
  17997. source: "extent\x0a\x09\x22Answer the line and column of the end position of the receiver in the source code\x22\x0a\x09\x0a\x09^ self nextNode \x0a\x09\x09ifNil: [ self parent ifNotNil: [ :node | node extent ] ]\x0a\x09\x09ifNotNil: [ :node | node position ]",
  17998. messageSends: ["ifNil:ifNotNil:", "ifNotNil:", "extent", "parent", "position", "nextNode"],
  17999. referencedClasses: []
  18000. }),
  18001. smalltalk.Node);
  18002. smalltalk.addMethod(
  18003. smalltalk.method({
  18004. selector: "isAssignmentNode",
  18005. category: 'testing',
  18006. fn: function (){
  18007. var self=this;
  18008. return smalltalk.withContext(function($ctx1) {
  18009. return false;
  18010. }, function($ctx1) {$ctx1.fill(self,"isAssignmentNode",{},smalltalk.Node)})},
  18011. args: [],
  18012. source: "isAssignmentNode\x0a\x09^ false",
  18013. messageSends: [],
  18014. referencedClasses: []
  18015. }),
  18016. smalltalk.Node);
  18017. smalltalk.addMethod(
  18018. smalltalk.method({
  18019. selector: "isBlockNode",
  18020. category: 'testing',
  18021. fn: function (){
  18022. var self=this;
  18023. return smalltalk.withContext(function($ctx1) {
  18024. return false;
  18025. }, function($ctx1) {$ctx1.fill(self,"isBlockNode",{},smalltalk.Node)})},
  18026. args: [],
  18027. source: "isBlockNode\x0a\x09^false",
  18028. messageSends: [],
  18029. referencedClasses: []
  18030. }),
  18031. smalltalk.Node);
  18032. smalltalk.addMethod(
  18033. smalltalk.method({
  18034. selector: "isBlockSequenceNode",
  18035. category: 'testing',
  18036. fn: function (){
  18037. var self=this;
  18038. return smalltalk.withContext(function($ctx1) {
  18039. return false;
  18040. }, function($ctx1) {$ctx1.fill(self,"isBlockSequenceNode",{},smalltalk.Node)})},
  18041. args: [],
  18042. source: "isBlockSequenceNode\x0a\x09^false",
  18043. messageSends: [],
  18044. referencedClasses: []
  18045. }),
  18046. smalltalk.Node);
  18047. smalltalk.addMethod(
  18048. smalltalk.method({
  18049. selector: "isImmutable",
  18050. category: 'testing',
  18051. fn: function (){
  18052. var self=this;
  18053. return smalltalk.withContext(function($ctx1) {
  18054. return false;
  18055. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Node)})},
  18056. args: [],
  18057. source: "isImmutable\x0a\x09^false",
  18058. messageSends: [],
  18059. referencedClasses: []
  18060. }),
  18061. smalltalk.Node);
  18062. smalltalk.addMethod(
  18063. smalltalk.method({
  18064. selector: "isJSStatementNode",
  18065. category: 'testing',
  18066. fn: function (){
  18067. var self=this;
  18068. return smalltalk.withContext(function($ctx1) {
  18069. return false;
  18070. }, function($ctx1) {$ctx1.fill(self,"isJSStatementNode",{},smalltalk.Node)})},
  18071. args: [],
  18072. source: "isJSStatementNode\x0a\x09^ false",
  18073. messageSends: [],
  18074. referencedClasses: []
  18075. }),
  18076. smalltalk.Node);
  18077. smalltalk.addMethod(
  18078. smalltalk.method({
  18079. selector: "isNode",
  18080. category: 'testing',
  18081. fn: function (){
  18082. var self=this;
  18083. return smalltalk.withContext(function($ctx1) {
  18084. return true;
  18085. }, function($ctx1) {$ctx1.fill(self,"isNode",{},smalltalk.Node)})},
  18086. args: [],
  18087. source: "isNode\x0a\x09^ true",
  18088. messageSends: [],
  18089. referencedClasses: []
  18090. }),
  18091. smalltalk.Node);
  18092. smalltalk.addMethod(
  18093. smalltalk.method({
  18094. selector: "isReturnNode",
  18095. category: 'testing',
  18096. fn: function (){
  18097. var self=this;
  18098. return smalltalk.withContext(function($ctx1) {
  18099. return false;
  18100. }, function($ctx1) {$ctx1.fill(self,"isReturnNode",{},smalltalk.Node)})},
  18101. args: [],
  18102. source: "isReturnNode\x0a\x09^false",
  18103. messageSends: [],
  18104. referencedClasses: []
  18105. }),
  18106. smalltalk.Node);
  18107. smalltalk.addMethod(
  18108. smalltalk.method({
  18109. selector: "isSendNode",
  18110. category: 'testing',
  18111. fn: function (){
  18112. var self=this;
  18113. return smalltalk.withContext(function($ctx1) {
  18114. return false;
  18115. }, function($ctx1) {$ctx1.fill(self,"isSendNode",{},smalltalk.Node)})},
  18116. args: [],
  18117. source: "isSendNode\x0a\x09^false",
  18118. messageSends: [],
  18119. referencedClasses: []
  18120. }),
  18121. smalltalk.Node);
  18122. smalltalk.addMethod(
  18123. smalltalk.method({
  18124. selector: "isValueNode",
  18125. category: 'testing',
  18126. fn: function (){
  18127. var self=this;
  18128. return smalltalk.withContext(function($ctx1) {
  18129. return false;
  18130. }, function($ctx1) {$ctx1.fill(self,"isValueNode",{},smalltalk.Node)})},
  18131. args: [],
  18132. source: "isValueNode\x0a\x09^false",
  18133. messageSends: [],
  18134. referencedClasses: []
  18135. }),
  18136. smalltalk.Node);
  18137. smalltalk.addMethod(
  18138. smalltalk.method({
  18139. selector: "nextNode",
  18140. category: 'accessing',
  18141. fn: function (){
  18142. var self=this;
  18143. return smalltalk.withContext(function($ctx1) {
  18144. var $2,$1;
  18145. $2=self._parent();
  18146. if(($receiver = $2) == nil || $receiver == undefined){
  18147. $1=$2;
  18148. } else {
  18149. var node;
  18150. node=$receiver;
  18151. $1=_st(node)._nextNode_(self);
  18152. };
  18153. return $1;
  18154. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.Node)})},
  18155. args: [],
  18156. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  18157. messageSends: ["ifNotNil:", "nextNode:", "parent"],
  18158. referencedClasses: []
  18159. }),
  18160. smalltalk.Node);
  18161. smalltalk.addMethod(
  18162. smalltalk.method({
  18163. selector: "nextNode:",
  18164. category: 'accessing',
  18165. fn: function (aNode){
  18166. var self=this;
  18167. return smalltalk.withContext(function($ctx1) {
  18168. var $1;
  18169. $1=_st(self._nodes())._at_ifAbsent_(_st(_st(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  18170. return smalltalk.withContext(function($ctx2) {
  18171. return nil;
  18172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  18173. return $1;
  18174. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode},smalltalk.Node)})},
  18175. args: ["aNode"],
  18176. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode\x22\x0a\x09\x0a\x09^ self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ nil ]",
  18177. messageSends: ["at:ifAbsent:", "+", "indexOf:", "nodes"],
  18178. referencedClasses: []
  18179. }),
  18180. smalltalk.Node);
  18181. smalltalk.addMethod(
  18182. smalltalk.method({
  18183. selector: "nodes",
  18184. category: 'accessing',
  18185. fn: function (){
  18186. var self=this;
  18187. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  18188. return smalltalk.withContext(function($ctx1) {
  18189. var $2,$1;
  18190. $2=self["@nodes"];
  18191. if(($receiver = $2) == nil || $receiver == undefined){
  18192. self["@nodes"]=_st($Array())._new();
  18193. $1=self["@nodes"];
  18194. } else {
  18195. $1=$2;
  18196. };
  18197. return $1;
  18198. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.Node)})},
  18199. args: [],
  18200. source: "nodes\x0a\x09^nodes ifNil: [nodes := Array new]",
  18201. messageSends: ["ifNil:", "new"],
  18202. referencedClasses: ["Array"]
  18203. }),
  18204. smalltalk.Node);
  18205. smalltalk.addMethod(
  18206. smalltalk.method({
  18207. selector: "nodes:",
  18208. category: 'building',
  18209. fn: function (aCollection){
  18210. var self=this;
  18211. return smalltalk.withContext(function($ctx1) {
  18212. self["@nodes"]=aCollection;
  18213. _st(aCollection)._do_((function(each){
  18214. return smalltalk.withContext(function($ctx2) {
  18215. return _st(each)._parent_(self);
  18216. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  18217. return self}, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},smalltalk.Node)})},
  18218. args: ["aCollection"],
  18219. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  18220. messageSends: ["do:", "parent:"],
  18221. referencedClasses: []
  18222. }),
  18223. smalltalk.Node);
  18224. smalltalk.addMethod(
  18225. smalltalk.method({
  18226. selector: "parent",
  18227. category: 'accessing',
  18228. fn: function (){
  18229. var self=this;
  18230. return smalltalk.withContext(function($ctx1) {
  18231. var $1;
  18232. $1=self["@parent"];
  18233. return $1;
  18234. }, function($ctx1) {$ctx1.fill(self,"parent",{},smalltalk.Node)})},
  18235. args: [],
  18236. source: "parent\x0a\x09^ parent",
  18237. messageSends: [],
  18238. referencedClasses: []
  18239. }),
  18240. smalltalk.Node);
  18241. smalltalk.addMethod(
  18242. smalltalk.method({
  18243. selector: "parent:",
  18244. category: 'accessing',
  18245. fn: function (aNode){
  18246. var self=this;
  18247. return smalltalk.withContext(function($ctx1) {
  18248. self["@parent"]=aNode;
  18249. return self}, function($ctx1) {$ctx1.fill(self,"parent:",{aNode:aNode},smalltalk.Node)})},
  18250. args: ["aNode"],
  18251. source: "parent: aNode\x0a\x09parent := aNode",
  18252. messageSends: [],
  18253. referencedClasses: []
  18254. }),
  18255. smalltalk.Node);
  18256. smalltalk.addMethod(
  18257. smalltalk.method({
  18258. selector: "position",
  18259. category: 'accessing',
  18260. fn: function (){
  18261. var self=this;
  18262. return smalltalk.withContext(function($ctx1) {
  18263. var $2,$3,$1;
  18264. $2=self["@position"];
  18265. if(($receiver = $2) == nil || $receiver == undefined){
  18266. $3=self._parent();
  18267. if(($receiver = $3) == nil || $receiver == undefined){
  18268. $1=$3;
  18269. } else {
  18270. var node;
  18271. node=$receiver;
  18272. $1=_st(node)._position();
  18273. };
  18274. } else {
  18275. $1=$2;
  18276. };
  18277. return $1;
  18278. }, function($ctx1) {$ctx1.fill(self,"position",{},smalltalk.Node)})},
  18279. args: [],
  18280. 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 ] ]",
  18281. messageSends: ["ifNil:", "ifNotNil:", "position", "parent"],
  18282. referencedClasses: []
  18283. }),
  18284. smalltalk.Node);
  18285. smalltalk.addMethod(
  18286. smalltalk.method({
  18287. selector: "position:",
  18288. category: 'building',
  18289. fn: function (aPosition){
  18290. var self=this;
  18291. return smalltalk.withContext(function($ctx1) {
  18292. self["@position"]=aPosition;
  18293. return self}, function($ctx1) {$ctx1.fill(self,"position:",{aPosition:aPosition},smalltalk.Node)})},
  18294. args: ["aPosition"],
  18295. source: "position: aPosition\x0a\x09position := aPosition",
  18296. messageSends: [],
  18297. referencedClasses: []
  18298. }),
  18299. smalltalk.Node);
  18300. smalltalk.addMethod(
  18301. smalltalk.method({
  18302. selector: "shouldBeAliased",
  18303. category: 'accessing',
  18304. fn: function (){
  18305. var self=this;
  18306. return smalltalk.withContext(function($ctx1) {
  18307. var $2,$1;
  18308. $2=self["@shouldBeAliased"];
  18309. if(($receiver = $2) == nil || $receiver == undefined){
  18310. $1=false;
  18311. } else {
  18312. $1=$2;
  18313. };
  18314. return $1;
  18315. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},smalltalk.Node)})},
  18316. args: [],
  18317. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  18318. messageSends: ["ifNil:"],
  18319. referencedClasses: []
  18320. }),
  18321. smalltalk.Node);
  18322. smalltalk.addMethod(
  18323. smalltalk.method({
  18324. selector: "shouldBeAliased:",
  18325. category: 'accessing',
  18326. fn: function (aBoolean){
  18327. var self=this;
  18328. return smalltalk.withContext(function($ctx1) {
  18329. self["@shouldBeAliased"]=aBoolean;
  18330. return self}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased:",{aBoolean:aBoolean},smalltalk.Node)})},
  18331. args: ["aBoolean"],
  18332. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  18333. messageSends: [],
  18334. referencedClasses: []
  18335. }),
  18336. smalltalk.Node);
  18337. smalltalk.addMethod(
  18338. smalltalk.method({
  18339. selector: "shouldBeInlined",
  18340. category: 'accessing',
  18341. fn: function (){
  18342. var self=this;
  18343. return smalltalk.withContext(function($ctx1) {
  18344. var $2,$1;
  18345. $2=self["@shouldBeInlined"];
  18346. if(($receiver = $2) == nil || $receiver == undefined){
  18347. $1=false;
  18348. } else {
  18349. $1=$2;
  18350. };
  18351. return $1;
  18352. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},smalltalk.Node)})},
  18353. args: [],
  18354. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  18355. messageSends: ["ifNil:"],
  18356. referencedClasses: []
  18357. }),
  18358. smalltalk.Node);
  18359. smalltalk.addMethod(
  18360. smalltalk.method({
  18361. selector: "shouldBeInlined:",
  18362. category: 'accessing',
  18363. fn: function (aBoolean){
  18364. var self=this;
  18365. return smalltalk.withContext(function($ctx1) {
  18366. self["@shouldBeInlined"]=aBoolean;
  18367. return self}, function($ctx1) {$ctx1.fill(self,"shouldBeInlined:",{aBoolean:aBoolean},smalltalk.Node)})},
  18368. args: ["aBoolean"],
  18369. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  18370. messageSends: [],
  18371. referencedClasses: []
  18372. }),
  18373. smalltalk.Node);
  18374. smalltalk.addMethod(
  18375. smalltalk.method({
  18376. selector: "stopOnStepping",
  18377. category: 'testing',
  18378. fn: function (){
  18379. var self=this;
  18380. return smalltalk.withContext(function($ctx1) {
  18381. return false;
  18382. }, function($ctx1) {$ctx1.fill(self,"stopOnStepping",{},smalltalk.Node)})},
  18383. args: [],
  18384. source: "stopOnStepping\x0a\x09^ false",
  18385. messageSends: [],
  18386. referencedClasses: []
  18387. }),
  18388. smalltalk.Node);
  18389. smalltalk.addMethod(
  18390. smalltalk.method({
  18391. selector: "subtreeNeedsAliasing",
  18392. category: 'testing',
  18393. fn: function (){
  18394. var self=this;
  18395. return smalltalk.withContext(function($ctx1) {
  18396. var $1;
  18397. $1=_st(_st(self._shouldBeAliased())._or_((function(){
  18398. return smalltalk.withContext(function($ctx2) {
  18399. return self._shouldBeInlined();
  18400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._or_((function(){
  18401. return smalltalk.withContext(function($ctx2) {
  18402. return _st(_st(self._nodes())._detect_ifNone_((function(each){
  18403. return smalltalk.withContext(function($ctx3) {
  18404. return _st(each)._subtreeNeedsAliasing();
  18405. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}),(function(){
  18406. return smalltalk.withContext(function($ctx3) {
  18407. return false;
  18408. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))).__tild_eq(false);
  18409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  18410. return $1;
  18411. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},smalltalk.Node)})},
  18412. args: [],
  18413. source: "subtreeNeedsAliasing\x0a\x09^(self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09(self nodes detect: [ :each | each subtreeNeedsAliasing ] ifNone: [ false ]) ~= false ]",
  18414. messageSends: ["or:", "~=", "detect:ifNone:", "subtreeNeedsAliasing", "nodes", "shouldBeInlined", "shouldBeAliased"],
  18415. referencedClasses: []
  18416. }),
  18417. smalltalk.Node);
  18418. smalltalk.addClass('AssignmentNode', smalltalk.Node, ['left', 'right'], 'Compiler-AST');
  18419. smalltalk.AssignmentNode.comment="I represent an assignment node.";
  18420. smalltalk.addMethod(
  18421. smalltalk.method({
  18422. selector: "accept:",
  18423. category: 'visiting',
  18424. fn: function (aVisitor){
  18425. var self=this;
  18426. return smalltalk.withContext(function($ctx1) {
  18427. var $1;
  18428. $1=_st(aVisitor)._visitAssignmentNode_(self);
  18429. return $1;
  18430. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.AssignmentNode)})},
  18431. args: ["aVisitor"],
  18432. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  18433. messageSends: ["visitAssignmentNode:"],
  18434. referencedClasses: []
  18435. }),
  18436. smalltalk.AssignmentNode);
  18437. smalltalk.addMethod(
  18438. smalltalk.method({
  18439. selector: "isAssignmentNode",
  18440. category: 'testing',
  18441. fn: function (){
  18442. var self=this;
  18443. return smalltalk.withContext(function($ctx1) {
  18444. return true;
  18445. }, function($ctx1) {$ctx1.fill(self,"isAssignmentNode",{},smalltalk.AssignmentNode)})},
  18446. args: [],
  18447. source: "isAssignmentNode\x0a\x09^ true",
  18448. messageSends: [],
  18449. referencedClasses: []
  18450. }),
  18451. smalltalk.AssignmentNode);
  18452. smalltalk.addMethod(
  18453. smalltalk.method({
  18454. selector: "left",
  18455. category: 'accessing',
  18456. fn: function (){
  18457. var self=this;
  18458. return smalltalk.withContext(function($ctx1) {
  18459. var $1;
  18460. $1=self["@left"];
  18461. return $1;
  18462. }, function($ctx1) {$ctx1.fill(self,"left",{},smalltalk.AssignmentNode)})},
  18463. args: [],
  18464. source: "left\x0a\x09^left",
  18465. messageSends: [],
  18466. referencedClasses: []
  18467. }),
  18468. smalltalk.AssignmentNode);
  18469. smalltalk.addMethod(
  18470. smalltalk.method({
  18471. selector: "left:",
  18472. category: 'accessing',
  18473. fn: function (aNode){
  18474. var self=this;
  18475. return smalltalk.withContext(function($ctx1) {
  18476. self["@left"]=aNode;
  18477. return self}, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},smalltalk.AssignmentNode)})},
  18478. args: ["aNode"],
  18479. source: "left: aNode\x0a\x09left := aNode",
  18480. messageSends: [],
  18481. referencedClasses: []
  18482. }),
  18483. smalltalk.AssignmentNode);
  18484. smalltalk.addMethod(
  18485. smalltalk.method({
  18486. selector: "nodes",
  18487. category: 'accessing',
  18488. fn: function (){
  18489. var self=this;
  18490. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  18491. return smalltalk.withContext(function($ctx1) {
  18492. var $1;
  18493. $1=_st($Array())._with_with_(self._left(),self._right());
  18494. return $1;
  18495. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.AssignmentNode)})},
  18496. args: [],
  18497. source: "nodes\x0a\x09^ Array with: self left with: self right",
  18498. messageSends: ["with:with:", "left", "right"],
  18499. referencedClasses: ["Array"]
  18500. }),
  18501. smalltalk.AssignmentNode);
  18502. smalltalk.addMethod(
  18503. smalltalk.method({
  18504. selector: "right",
  18505. category: 'accessing',
  18506. fn: function (){
  18507. var self=this;
  18508. return smalltalk.withContext(function($ctx1) {
  18509. var $1;
  18510. $1=self["@right"];
  18511. return $1;
  18512. }, function($ctx1) {$ctx1.fill(self,"right",{},smalltalk.AssignmentNode)})},
  18513. args: [],
  18514. source: "right\x0a\x09^right",
  18515. messageSends: [],
  18516. referencedClasses: []
  18517. }),
  18518. smalltalk.AssignmentNode);
  18519. smalltalk.addMethod(
  18520. smalltalk.method({
  18521. selector: "right:",
  18522. category: 'accessing',
  18523. fn: function (aNode){
  18524. var self=this;
  18525. return smalltalk.withContext(function($ctx1) {
  18526. self["@right"]=aNode;
  18527. return self}, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},smalltalk.AssignmentNode)})},
  18528. args: ["aNode"],
  18529. source: "right: aNode\x0a\x09right := aNode",
  18530. messageSends: [],
  18531. referencedClasses: []
  18532. }),
  18533. smalltalk.AssignmentNode);
  18534. smalltalk.addClass('BlockNode', smalltalk.Node, ['parameters', 'scope'], 'Compiler-AST');
  18535. smalltalk.BlockNode.comment="I represent an block closure node.";
  18536. smalltalk.addMethod(
  18537. smalltalk.method({
  18538. selector: "accept:",
  18539. category: 'visiting',
  18540. fn: function (aVisitor){
  18541. var self=this;
  18542. return smalltalk.withContext(function($ctx1) {
  18543. var $1;
  18544. $1=_st(aVisitor)._visitBlockNode_(self);
  18545. return $1;
  18546. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.BlockNode)})},
  18547. args: ["aVisitor"],
  18548. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  18549. messageSends: ["visitBlockNode:"],
  18550. referencedClasses: []
  18551. }),
  18552. smalltalk.BlockNode);
  18553. smalltalk.addMethod(
  18554. smalltalk.method({
  18555. selector: "isBlockNode",
  18556. category: 'testing',
  18557. fn: function (){
  18558. var self=this;
  18559. return smalltalk.withContext(function($ctx1) {
  18560. return true;
  18561. }, function($ctx1) {$ctx1.fill(self,"isBlockNode",{},smalltalk.BlockNode)})},
  18562. args: [],
  18563. source: "isBlockNode\x0a\x09^true",
  18564. messageSends: [],
  18565. referencedClasses: []
  18566. }),
  18567. smalltalk.BlockNode);
  18568. smalltalk.addMethod(
  18569. smalltalk.method({
  18570. selector: "parameters",
  18571. category: 'accessing',
  18572. fn: function (){
  18573. var self=this;
  18574. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  18575. return smalltalk.withContext(function($ctx1) {
  18576. var $2,$1;
  18577. $2=self["@parameters"];
  18578. if(($receiver = $2) == nil || $receiver == undefined){
  18579. self["@parameters"]=_st($Array())._new();
  18580. $1=self["@parameters"];
  18581. } else {
  18582. $1=$2;
  18583. };
  18584. return $1;
  18585. }, function($ctx1) {$ctx1.fill(self,"parameters",{},smalltalk.BlockNode)})},
  18586. args: [],
  18587. source: "parameters\x0a\x09^parameters ifNil: [parameters := Array new]",
  18588. messageSends: ["ifNil:", "new"],
  18589. referencedClasses: ["Array"]
  18590. }),
  18591. smalltalk.BlockNode);
  18592. smalltalk.addMethod(
  18593. smalltalk.method({
  18594. selector: "parameters:",
  18595. category: 'accessing',
  18596. fn: function (aCollection){
  18597. var self=this;
  18598. return smalltalk.withContext(function($ctx1) {
  18599. self["@parameters"]=aCollection;
  18600. return self}, function($ctx1) {$ctx1.fill(self,"parameters:",{aCollection:aCollection},smalltalk.BlockNode)})},
  18601. args: ["aCollection"],
  18602. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  18603. messageSends: [],
  18604. referencedClasses: []
  18605. }),
  18606. smalltalk.BlockNode);
  18607. smalltalk.addMethod(
  18608. smalltalk.method({
  18609. selector: "scope",
  18610. category: 'accessing',
  18611. fn: function (){
  18612. var self=this;
  18613. return smalltalk.withContext(function($ctx1) {
  18614. var $1;
  18615. $1=self["@scope"];
  18616. return $1;
  18617. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.BlockNode)})},
  18618. args: [],
  18619. source: "scope\x0a\x09^ scope",
  18620. messageSends: [],
  18621. referencedClasses: []
  18622. }),
  18623. smalltalk.BlockNode);
  18624. smalltalk.addMethod(
  18625. smalltalk.method({
  18626. selector: "scope:",
  18627. category: 'accessing',
  18628. fn: function (aLexicalScope){
  18629. var self=this;
  18630. return smalltalk.withContext(function($ctx1) {
  18631. self["@scope"]=aLexicalScope;
  18632. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aLexicalScope:aLexicalScope},smalltalk.BlockNode)})},
  18633. args: ["aLexicalScope"],
  18634. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  18635. messageSends: [],
  18636. referencedClasses: []
  18637. }),
  18638. smalltalk.BlockNode);
  18639. smalltalk.addMethod(
  18640. smalltalk.method({
  18641. selector: "subtreeNeedsAliasing",
  18642. category: 'testing',
  18643. fn: function (){
  18644. var self=this;
  18645. return smalltalk.withContext(function($ctx1) {
  18646. var $1;
  18647. $1=_st(self._shouldBeAliased())._or_((function(){
  18648. return smalltalk.withContext(function($ctx2) {
  18649. return self._shouldBeInlined();
  18650. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  18651. return $1;
  18652. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},smalltalk.BlockNode)})},
  18653. args: [],
  18654. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  18655. messageSends: ["or:", "shouldBeInlined", "shouldBeAliased"],
  18656. referencedClasses: []
  18657. }),
  18658. smalltalk.BlockNode);
  18659. smalltalk.addClass('CascadeNode', smalltalk.Node, ['receiver'], 'Compiler-AST');
  18660. smalltalk.CascadeNode.comment="I represent an cascade node.";
  18661. smalltalk.addMethod(
  18662. smalltalk.method({
  18663. selector: "accept:",
  18664. category: 'visiting',
  18665. fn: function (aVisitor){
  18666. var self=this;
  18667. return smalltalk.withContext(function($ctx1) {
  18668. var $1;
  18669. $1=_st(aVisitor)._visitCascadeNode_(self);
  18670. return $1;
  18671. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.CascadeNode)})},
  18672. args: ["aVisitor"],
  18673. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  18674. messageSends: ["visitCascadeNode:"],
  18675. referencedClasses: []
  18676. }),
  18677. smalltalk.CascadeNode);
  18678. smalltalk.addMethod(
  18679. smalltalk.method({
  18680. selector: "receiver",
  18681. category: 'accessing',
  18682. fn: function (){
  18683. var self=this;
  18684. return smalltalk.withContext(function($ctx1) {
  18685. var $1;
  18686. $1=self["@receiver"];
  18687. return $1;
  18688. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.CascadeNode)})},
  18689. args: [],
  18690. source: "receiver\x0a\x09^receiver",
  18691. messageSends: [],
  18692. referencedClasses: []
  18693. }),
  18694. smalltalk.CascadeNode);
  18695. smalltalk.addMethod(
  18696. smalltalk.method({
  18697. selector: "receiver:",
  18698. category: 'accessing',
  18699. fn: function (aNode){
  18700. var self=this;
  18701. return smalltalk.withContext(function($ctx1) {
  18702. self["@receiver"]=aNode;
  18703. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},smalltalk.CascadeNode)})},
  18704. args: ["aNode"],
  18705. source: "receiver: aNode\x0a\x09receiver := aNode",
  18706. messageSends: [],
  18707. referencedClasses: []
  18708. }),
  18709. smalltalk.CascadeNode);
  18710. smalltalk.addClass('DynamicArrayNode', smalltalk.Node, [], 'Compiler-AST');
  18711. smalltalk.DynamicArrayNode.comment="I represent an dynamic array node.";
  18712. smalltalk.addMethod(
  18713. smalltalk.method({
  18714. selector: "accept:",
  18715. category: 'visiting',
  18716. fn: function (aVisitor){
  18717. var self=this;
  18718. return smalltalk.withContext(function($ctx1) {
  18719. var $1;
  18720. $1=_st(aVisitor)._visitDynamicArrayNode_(self);
  18721. return $1;
  18722. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.DynamicArrayNode)})},
  18723. args: ["aVisitor"],
  18724. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  18725. messageSends: ["visitDynamicArrayNode:"],
  18726. referencedClasses: []
  18727. }),
  18728. smalltalk.DynamicArrayNode);
  18729. smalltalk.addClass('DynamicDictionaryNode', smalltalk.Node, [], 'Compiler-AST');
  18730. smalltalk.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  18731. smalltalk.addMethod(
  18732. smalltalk.method({
  18733. selector: "accept:",
  18734. category: 'visiting',
  18735. fn: function (aVisitor){
  18736. var self=this;
  18737. return smalltalk.withContext(function($ctx1) {
  18738. var $1;
  18739. $1=_st(aVisitor)._visitDynamicDictionaryNode_(self);
  18740. return $1;
  18741. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.DynamicDictionaryNode)})},
  18742. args: ["aVisitor"],
  18743. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  18744. messageSends: ["visitDynamicDictionaryNode:"],
  18745. referencedClasses: []
  18746. }),
  18747. smalltalk.DynamicDictionaryNode);
  18748. smalltalk.addClass('JSStatementNode', smalltalk.Node, ['source'], 'Compiler-AST');
  18749. smalltalk.JSStatementNode.comment="I represent an JavaScript statement node.";
  18750. smalltalk.addMethod(
  18751. smalltalk.method({
  18752. selector: "accept:",
  18753. category: 'visiting',
  18754. fn: function (aVisitor){
  18755. var self=this;
  18756. return smalltalk.withContext(function($ctx1) {
  18757. var $1;
  18758. $1=_st(aVisitor)._visitJSStatementNode_(self);
  18759. return $1;
  18760. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.JSStatementNode)})},
  18761. args: ["aVisitor"],
  18762. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  18763. messageSends: ["visitJSStatementNode:"],
  18764. referencedClasses: []
  18765. }),
  18766. smalltalk.JSStatementNode);
  18767. smalltalk.addMethod(
  18768. smalltalk.method({
  18769. selector: "isJSStatementNode",
  18770. category: 'testing',
  18771. fn: function (){
  18772. var self=this;
  18773. return smalltalk.withContext(function($ctx1) {
  18774. return true;
  18775. }, function($ctx1) {$ctx1.fill(self,"isJSStatementNode",{},smalltalk.JSStatementNode)})},
  18776. args: [],
  18777. source: "isJSStatementNode\x0a\x09^ true",
  18778. messageSends: [],
  18779. referencedClasses: []
  18780. }),
  18781. smalltalk.JSStatementNode);
  18782. smalltalk.addMethod(
  18783. smalltalk.method({
  18784. selector: "source",
  18785. category: 'accessing',
  18786. fn: function (){
  18787. var self=this;
  18788. return smalltalk.withContext(function($ctx1) {
  18789. var $2,$1;
  18790. $2=self["@source"];
  18791. if(($receiver = $2) == nil || $receiver == undefined){
  18792. $1="";
  18793. } else {
  18794. $1=$2;
  18795. };
  18796. return $1;
  18797. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.JSStatementNode)})},
  18798. args: [],
  18799. source: "source\x0a\x09^source ifNil: ['']",
  18800. messageSends: ["ifNil:"],
  18801. referencedClasses: []
  18802. }),
  18803. smalltalk.JSStatementNode);
  18804. smalltalk.addMethod(
  18805. smalltalk.method({
  18806. selector: "source:",
  18807. category: 'accessing',
  18808. fn: function (aString){
  18809. var self=this;
  18810. return smalltalk.withContext(function($ctx1) {
  18811. self["@source"]=aString;
  18812. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.JSStatementNode)})},
  18813. args: ["aString"],
  18814. source: "source: aString\x0a\x09source := aString",
  18815. messageSends: [],
  18816. referencedClasses: []
  18817. }),
  18818. smalltalk.JSStatementNode);
  18819. smalltalk.addClass('MethodNode', smalltalk.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'messageSends', 'superSends'], 'Compiler-AST');
  18820. smalltalk.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  18821. smalltalk.addMethod(
  18822. smalltalk.method({
  18823. selector: "accept:",
  18824. category: 'visiting',
  18825. fn: function (aVisitor){
  18826. var self=this;
  18827. return smalltalk.withContext(function($ctx1) {
  18828. var $1;
  18829. $1=_st(aVisitor)._visitMethodNode_(self);
  18830. return $1;
  18831. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.MethodNode)})},
  18832. args: ["aVisitor"],
  18833. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  18834. messageSends: ["visitMethodNode:"],
  18835. referencedClasses: []
  18836. }),
  18837. smalltalk.MethodNode);
  18838. smalltalk.addMethod(
  18839. smalltalk.method({
  18840. selector: "arguments",
  18841. category: 'accessing',
  18842. fn: function (){
  18843. var self=this;
  18844. return smalltalk.withContext(function($ctx1) {
  18845. var $2,$1;
  18846. $2=self["@arguments"];
  18847. if(($receiver = $2) == nil || $receiver == undefined){
  18848. $1=[];
  18849. } else {
  18850. $1=$2;
  18851. };
  18852. return $1;
  18853. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.MethodNode)})},
  18854. args: [],
  18855. source: "arguments\x0a\x09^arguments ifNil: [#()]",
  18856. messageSends: ["ifNil:"],
  18857. referencedClasses: []
  18858. }),
  18859. smalltalk.MethodNode);
  18860. smalltalk.addMethod(
  18861. smalltalk.method({
  18862. selector: "arguments:",
  18863. category: 'accessing',
  18864. fn: function (aCollection){
  18865. var self=this;
  18866. return smalltalk.withContext(function($ctx1) {
  18867. self["@arguments"]=aCollection;
  18868. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.MethodNode)})},
  18869. args: ["aCollection"],
  18870. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  18871. messageSends: [],
  18872. referencedClasses: []
  18873. }),
  18874. smalltalk.MethodNode);
  18875. smalltalk.addMethod(
  18876. smalltalk.method({
  18877. selector: "classReferences",
  18878. category: 'accessing',
  18879. fn: function (){
  18880. var self=this;
  18881. return smalltalk.withContext(function($ctx1) {
  18882. var $1;
  18883. $1=self["@classReferences"];
  18884. return $1;
  18885. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},smalltalk.MethodNode)})},
  18886. args: [],
  18887. source: "classReferences\x0a\x09^ classReferences",
  18888. messageSends: [],
  18889. referencedClasses: []
  18890. }),
  18891. smalltalk.MethodNode);
  18892. smalltalk.addMethod(
  18893. smalltalk.method({
  18894. selector: "classReferences:",
  18895. category: 'accessing',
  18896. fn: function (aCollection){
  18897. var self=this;
  18898. return smalltalk.withContext(function($ctx1) {
  18899. self["@classReferences"]=aCollection;
  18900. return self}, function($ctx1) {$ctx1.fill(self,"classReferences:",{aCollection:aCollection},smalltalk.MethodNode)})},
  18901. args: ["aCollection"],
  18902. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  18903. messageSends: [],
  18904. referencedClasses: []
  18905. }),
  18906. smalltalk.MethodNode);
  18907. smalltalk.addMethod(
  18908. smalltalk.method({
  18909. selector: "extent",
  18910. category: 'accessing',
  18911. fn: function (){
  18912. var self=this;
  18913. return smalltalk.withContext(function($ctx1) {
  18914. var $1;
  18915. $1=_st(_st(_st(self._source())._lines())._size()).__at(_st(_st(_st(_st(self._source())._lines())._last())._size()).__plus((1)));
  18916. return $1;
  18917. }, function($ctx1) {$ctx1.fill(self,"extent",{},smalltalk.MethodNode)})},
  18918. args: [],
  18919. source: "extent\x0a\x09^ self source lines size @ (self source lines last size + 1)",
  18920. messageSends: ["@", "+", "size", "last", "lines", "source"],
  18921. referencedClasses: []
  18922. }),
  18923. smalltalk.MethodNode);
  18924. smalltalk.addMethod(
  18925. smalltalk.method({
  18926. selector: "messageSends",
  18927. category: 'accessing',
  18928. fn: function (){
  18929. var self=this;
  18930. return smalltalk.withContext(function($ctx1) {
  18931. var $1;
  18932. $1=self["@messageSends"];
  18933. return $1;
  18934. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.MethodNode)})},
  18935. args: [],
  18936. source: "messageSends\x0a\x09^ messageSends",
  18937. messageSends: [],
  18938. referencedClasses: []
  18939. }),
  18940. smalltalk.MethodNode);
  18941. smalltalk.addMethod(
  18942. smalltalk.method({
  18943. selector: "messageSends:",
  18944. category: 'accessing',
  18945. fn: function (aCollection){
  18946. var self=this;
  18947. return smalltalk.withContext(function($ctx1) {
  18948. self["@messageSends"]=aCollection;
  18949. return self}, function($ctx1) {$ctx1.fill(self,"messageSends:",{aCollection:aCollection},smalltalk.MethodNode)})},
  18950. args: ["aCollection"],
  18951. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  18952. messageSends: [],
  18953. referencedClasses: []
  18954. }),
  18955. smalltalk.MethodNode);
  18956. smalltalk.addMethod(
  18957. smalltalk.method({
  18958. selector: "scope",
  18959. category: 'accessing',
  18960. fn: function (){
  18961. var self=this;
  18962. return smalltalk.withContext(function($ctx1) {
  18963. var $1;
  18964. $1=self["@scope"];
  18965. return $1;
  18966. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.MethodNode)})},
  18967. args: [],
  18968. source: "scope\x0a\x09^ scope",
  18969. messageSends: [],
  18970. referencedClasses: []
  18971. }),
  18972. smalltalk.MethodNode);
  18973. smalltalk.addMethod(
  18974. smalltalk.method({
  18975. selector: "scope:",
  18976. category: 'accessing',
  18977. fn: function (aMethodScope){
  18978. var self=this;
  18979. return smalltalk.withContext(function($ctx1) {
  18980. self["@scope"]=aMethodScope;
  18981. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aMethodScope:aMethodScope},smalltalk.MethodNode)})},
  18982. args: ["aMethodScope"],
  18983. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  18984. messageSends: [],
  18985. referencedClasses: []
  18986. }),
  18987. smalltalk.MethodNode);
  18988. smalltalk.addMethod(
  18989. smalltalk.method({
  18990. selector: "selector",
  18991. category: 'accessing',
  18992. fn: function (){
  18993. var self=this;
  18994. return smalltalk.withContext(function($ctx1) {
  18995. var $1;
  18996. $1=self["@selector"];
  18997. return $1;
  18998. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodNode)})},
  18999. args: [],
  19000. source: "selector\x0a\x09^selector",
  19001. messageSends: [],
  19002. referencedClasses: []
  19003. }),
  19004. smalltalk.MethodNode);
  19005. smalltalk.addMethod(
  19006. smalltalk.method({
  19007. selector: "selector:",
  19008. category: 'accessing',
  19009. fn: function (aString){
  19010. var self=this;
  19011. return smalltalk.withContext(function($ctx1) {
  19012. self["@selector"]=aString;
  19013. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.MethodNode)})},
  19014. args: ["aString"],
  19015. source: "selector: aString\x0a\x09selector := aString",
  19016. messageSends: [],
  19017. referencedClasses: []
  19018. }),
  19019. smalltalk.MethodNode);
  19020. smalltalk.addMethod(
  19021. smalltalk.method({
  19022. selector: "source",
  19023. category: 'accessing',
  19024. fn: function (){
  19025. var self=this;
  19026. return smalltalk.withContext(function($ctx1) {
  19027. var $1;
  19028. $1=self["@source"];
  19029. return $1;
  19030. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.MethodNode)})},
  19031. args: [],
  19032. source: "source\x0a\x09^source",
  19033. messageSends: [],
  19034. referencedClasses: []
  19035. }),
  19036. smalltalk.MethodNode);
  19037. smalltalk.addMethod(
  19038. smalltalk.method({
  19039. selector: "source:",
  19040. category: 'accessing',
  19041. fn: function (aString){
  19042. var self=this;
  19043. return smalltalk.withContext(function($ctx1) {
  19044. self["@source"]=aString;
  19045. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.MethodNode)})},
  19046. args: ["aString"],
  19047. source: "source: aString\x0a\x09source := aString",
  19048. messageSends: [],
  19049. referencedClasses: []
  19050. }),
  19051. smalltalk.MethodNode);
  19052. smalltalk.addMethod(
  19053. smalltalk.method({
  19054. selector: "superSends",
  19055. category: 'accessing',
  19056. fn: function (){
  19057. var self=this;
  19058. return smalltalk.withContext(function($ctx1) {
  19059. var $1;
  19060. $1=self["@superSends"];
  19061. return $1;
  19062. }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.MethodNode)})},
  19063. args: [],
  19064. source: "superSends\x0a\x09^ superSends",
  19065. messageSends: [],
  19066. referencedClasses: []
  19067. }),
  19068. smalltalk.MethodNode);
  19069. smalltalk.addMethod(
  19070. smalltalk.method({
  19071. selector: "superSends:",
  19072. category: 'accessing',
  19073. fn: function (aCollection){
  19074. var self=this;
  19075. return smalltalk.withContext(function($ctx1) {
  19076. self["@superSends"]=aCollection;
  19077. return self}, function($ctx1) {$ctx1.fill(self,"superSends:",{aCollection:aCollection},smalltalk.MethodNode)})},
  19078. args: ["aCollection"],
  19079. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  19080. messageSends: [],
  19081. referencedClasses: []
  19082. }),
  19083. smalltalk.MethodNode);
  19084. smalltalk.addClass('ReturnNode', smalltalk.Node, ['scope'], 'Compiler-AST');
  19085. smalltalk.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  19086. smalltalk.addMethod(
  19087. smalltalk.method({
  19088. selector: "accept:",
  19089. category: 'visiting',
  19090. fn: function (aVisitor){
  19091. var self=this;
  19092. return smalltalk.withContext(function($ctx1) {
  19093. var $1;
  19094. $1=_st(aVisitor)._visitReturnNode_(self);
  19095. return $1;
  19096. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.ReturnNode)})},
  19097. args: ["aVisitor"],
  19098. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  19099. messageSends: ["visitReturnNode:"],
  19100. referencedClasses: []
  19101. }),
  19102. smalltalk.ReturnNode);
  19103. smalltalk.addMethod(
  19104. smalltalk.method({
  19105. selector: "isReturnNode",
  19106. category: 'testing',
  19107. fn: function (){
  19108. var self=this;
  19109. return smalltalk.withContext(function($ctx1) {
  19110. return true;
  19111. }, function($ctx1) {$ctx1.fill(self,"isReturnNode",{},smalltalk.ReturnNode)})},
  19112. args: [],
  19113. source: "isReturnNode\x0a\x09^ true",
  19114. messageSends: [],
  19115. referencedClasses: []
  19116. }),
  19117. smalltalk.ReturnNode);
  19118. smalltalk.addMethod(
  19119. smalltalk.method({
  19120. selector: "nonLocalReturn",
  19121. category: 'testing',
  19122. fn: function (){
  19123. var self=this;
  19124. return smalltalk.withContext(function($ctx1) {
  19125. var $1;
  19126. $1=_st(_st(self._scope())._isMethodScope())._not();
  19127. return $1;
  19128. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},smalltalk.ReturnNode)})},
  19129. args: [],
  19130. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  19131. messageSends: ["not", "isMethodScope", "scope"],
  19132. referencedClasses: []
  19133. }),
  19134. smalltalk.ReturnNode);
  19135. smalltalk.addMethod(
  19136. smalltalk.method({
  19137. selector: "scope",
  19138. category: 'accessing',
  19139. fn: function (){
  19140. var self=this;
  19141. return smalltalk.withContext(function($ctx1) {
  19142. var $1;
  19143. $1=self["@scope"];
  19144. return $1;
  19145. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.ReturnNode)})},
  19146. args: [],
  19147. source: "scope\x0a\x09^ scope",
  19148. messageSends: [],
  19149. referencedClasses: []
  19150. }),
  19151. smalltalk.ReturnNode);
  19152. smalltalk.addMethod(
  19153. smalltalk.method({
  19154. selector: "scope:",
  19155. category: 'accessing',
  19156. fn: function (aLexicalScope){
  19157. var self=this;
  19158. return smalltalk.withContext(function($ctx1) {
  19159. self["@scope"]=aLexicalScope;
  19160. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aLexicalScope:aLexicalScope},smalltalk.ReturnNode)})},
  19161. args: ["aLexicalScope"],
  19162. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  19163. messageSends: [],
  19164. referencedClasses: []
  19165. }),
  19166. smalltalk.ReturnNode);
  19167. smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  19168. smalltalk.SendNode.comment="I represent an message send node.";
  19169. smalltalk.addMethod(
  19170. smalltalk.method({
  19171. selector: "accept:",
  19172. category: 'visiting',
  19173. fn: function (aVisitor){
  19174. var self=this;
  19175. return smalltalk.withContext(function($ctx1) {
  19176. var $1;
  19177. $1=_st(aVisitor)._visitSendNode_(self);
  19178. return $1;
  19179. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.SendNode)})},
  19180. args: ["aVisitor"],
  19181. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  19182. messageSends: ["visitSendNode:"],
  19183. referencedClasses: []
  19184. }),
  19185. smalltalk.SendNode);
  19186. smalltalk.addMethod(
  19187. smalltalk.method({
  19188. selector: "arguments",
  19189. category: 'accessing',
  19190. fn: function (){
  19191. var self=this;
  19192. return smalltalk.withContext(function($ctx1) {
  19193. var $2,$1;
  19194. $2=self["@arguments"];
  19195. if(($receiver = $2) == nil || $receiver == undefined){
  19196. self["@arguments"]=[];
  19197. $1=self["@arguments"];
  19198. } else {
  19199. $1=$2;
  19200. };
  19201. return $1;
  19202. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.SendNode)})},
  19203. args: [],
  19204. source: "arguments\x0a\x09^arguments ifNil: [arguments := #()]",
  19205. messageSends: ["ifNil:"],
  19206. referencedClasses: []
  19207. }),
  19208. smalltalk.SendNode);
  19209. smalltalk.addMethod(
  19210. smalltalk.method({
  19211. selector: "arguments:",
  19212. category: 'accessing',
  19213. fn: function (aCollection){
  19214. var self=this;
  19215. return smalltalk.withContext(function($ctx1) {
  19216. self["@arguments"]=aCollection;
  19217. _st(aCollection)._do_((function(each){
  19218. return smalltalk.withContext(function($ctx2) {
  19219. return _st(each)._parent_(self);
  19220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  19221. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.SendNode)})},
  19222. args: ["aCollection"],
  19223. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  19224. messageSends: ["do:", "parent:"],
  19225. referencedClasses: []
  19226. }),
  19227. smalltalk.SendNode);
  19228. smalltalk.addMethod(
  19229. smalltalk.method({
  19230. selector: "cascadeNodeWithMessages:",
  19231. category: 'accessing',
  19232. fn: function (aCollection){
  19233. var self=this;
  19234. var first;
  19235. function $SendNode(){return smalltalk.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  19236. function $CascadeNode(){return smalltalk.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  19237. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  19238. return smalltalk.withContext(function($ctx1) {
  19239. var $1,$2,$4,$5,$3;
  19240. $1=_st($SendNode())._new();
  19241. _st($1)._selector_(self._selector());
  19242. _st($1)._arguments_(self._arguments());
  19243. $2=_st($1)._yourself();
  19244. first=$2;
  19245. $4=_st($CascadeNode())._new();
  19246. _st($4)._receiver_(self._receiver());
  19247. _st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
  19248. $5=_st($4)._yourself();
  19249. $3=$5;
  19250. return $3;
  19251. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},smalltalk.SendNode)})},
  19252. args: ["aCollection"],
  19253. 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",
  19254. messageSends: ["selector:", "selector", "new", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
  19255. referencedClasses: ["SendNode", "CascadeNode", "Array"]
  19256. }),
  19257. smalltalk.SendNode);
  19258. smalltalk.addMethod(
  19259. smalltalk.method({
  19260. selector: "index",
  19261. category: 'accessing',
  19262. fn: function (){
  19263. var self=this;
  19264. return smalltalk.withContext(function($ctx1) {
  19265. var $1;
  19266. $1=self["@index"];
  19267. return $1;
  19268. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.SendNode)})},
  19269. args: [],
  19270. source: "index\x0a\x09^ index",
  19271. messageSends: [],
  19272. referencedClasses: []
  19273. }),
  19274. smalltalk.SendNode);
  19275. smalltalk.addMethod(
  19276. smalltalk.method({
  19277. selector: "index:",
  19278. category: 'accessing',
  19279. fn: function (anInteger){
  19280. var self=this;
  19281. return smalltalk.withContext(function($ctx1) {
  19282. self["@index"]=anInteger;
  19283. return self}, function($ctx1) {$ctx1.fill(self,"index:",{anInteger:anInteger},smalltalk.SendNode)})},
  19284. args: ["anInteger"],
  19285. source: "index: anInteger\x0a\x09index := anInteger",
  19286. messageSends: [],
  19287. referencedClasses: []
  19288. }),
  19289. smalltalk.SendNode);
  19290. smalltalk.addMethod(
  19291. smalltalk.method({
  19292. selector: "isSendNode",
  19293. category: 'testing',
  19294. fn: function (){
  19295. var self=this;
  19296. return smalltalk.withContext(function($ctx1) {
  19297. return true;
  19298. }, function($ctx1) {$ctx1.fill(self,"isSendNode",{},smalltalk.SendNode)})},
  19299. args: [],
  19300. source: "isSendNode\x0a\x09^ true",
  19301. messageSends: [],
  19302. referencedClasses: []
  19303. }),
  19304. smalltalk.SendNode);
  19305. smalltalk.addMethod(
  19306. smalltalk.method({
  19307. selector: "nodes",
  19308. category: 'accessing',
  19309. fn: function (){
  19310. var self=this;
  19311. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  19312. return smalltalk.withContext(function($ctx1) {
  19313. var $2,$3,$1;
  19314. $2=_st($Array())._withAll_(self._arguments());
  19315. _st($2)._add_(self._receiver());
  19316. $3=_st($2)._yourself();
  19317. $1=$3;
  19318. return $1;
  19319. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.SendNode)})},
  19320. args: [],
  19321. source: "nodes\x0a\x09^ (Array withAll: self arguments)\x0a\x09\x09add: self receiver;\x0a\x09\x09yourself",
  19322. messageSends: ["add:", "receiver", "withAll:", "arguments", "yourself"],
  19323. referencedClasses: ["Array"]
  19324. }),
  19325. smalltalk.SendNode);
  19326. smalltalk.addMethod(
  19327. smalltalk.method({
  19328. selector: "receiver",
  19329. category: 'accessing',
  19330. fn: function (){
  19331. var self=this;
  19332. return smalltalk.withContext(function($ctx1) {
  19333. var $1;
  19334. $1=self["@receiver"];
  19335. return $1;
  19336. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.SendNode)})},
  19337. args: [],
  19338. source: "receiver\x0a\x09^receiver",
  19339. messageSends: [],
  19340. referencedClasses: []
  19341. }),
  19342. smalltalk.SendNode);
  19343. smalltalk.addMethod(
  19344. smalltalk.method({
  19345. selector: "receiver:",
  19346. category: 'accessing',
  19347. fn: function (aNode){
  19348. var self=this;
  19349. return smalltalk.withContext(function($ctx1) {
  19350. var $1;
  19351. self["@receiver"]=aNode;
  19352. $1=_st(aNode)._isNode();
  19353. if(smalltalk.assert($1)){
  19354. _st(aNode)._parent_(self);
  19355. };
  19356. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},smalltalk.SendNode)})},
  19357. args: ["aNode"],
  19358. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  19359. messageSends: ["ifTrue:", "parent:", "isNode"],
  19360. referencedClasses: []
  19361. }),
  19362. smalltalk.SendNode);
  19363. smalltalk.addMethod(
  19364. smalltalk.method({
  19365. selector: "selector",
  19366. category: 'accessing',
  19367. fn: function (){
  19368. var self=this;
  19369. return smalltalk.withContext(function($ctx1) {
  19370. var $1;
  19371. $1=self["@selector"];
  19372. return $1;
  19373. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.SendNode)})},
  19374. args: [],
  19375. source: "selector\x0a\x09^selector",
  19376. messageSends: [],
  19377. referencedClasses: []
  19378. }),
  19379. smalltalk.SendNode);
  19380. smalltalk.addMethod(
  19381. smalltalk.method({
  19382. selector: "selector:",
  19383. category: 'accessing',
  19384. fn: function (aString){
  19385. var self=this;
  19386. return smalltalk.withContext(function($ctx1) {
  19387. self["@selector"]=aString;
  19388. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.SendNode)})},
  19389. args: ["aString"],
  19390. source: "selector: aString\x0a\x09selector := aString",
  19391. messageSends: [],
  19392. referencedClasses: []
  19393. }),
  19394. smalltalk.SendNode);
  19395. smalltalk.addMethod(
  19396. smalltalk.method({
  19397. selector: "stopOnStepping",
  19398. category: 'testing',
  19399. fn: function (){
  19400. var self=this;
  19401. return smalltalk.withContext(function($ctx1) {
  19402. return true;
  19403. }, function($ctx1) {$ctx1.fill(self,"stopOnStepping",{},smalltalk.SendNode)})},
  19404. args: [],
  19405. source: "stopOnStepping\x0a\x09^ true",
  19406. messageSends: [],
  19407. referencedClasses: []
  19408. }),
  19409. smalltalk.SendNode);
  19410. smalltalk.addMethod(
  19411. smalltalk.method({
  19412. selector: "superSend",
  19413. category: 'accessing',
  19414. fn: function (){
  19415. var self=this;
  19416. return smalltalk.withContext(function($ctx1) {
  19417. var $2,$1;
  19418. $2=self["@superSend"];
  19419. if(($receiver = $2) == nil || $receiver == undefined){
  19420. $1=false;
  19421. } else {
  19422. $1=$2;
  19423. };
  19424. return $1;
  19425. }, function($ctx1) {$ctx1.fill(self,"superSend",{},smalltalk.SendNode)})},
  19426. args: [],
  19427. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  19428. messageSends: ["ifNil:"],
  19429. referencedClasses: []
  19430. }),
  19431. smalltalk.SendNode);
  19432. smalltalk.addMethod(
  19433. smalltalk.method({
  19434. selector: "superSend:",
  19435. category: 'accessing',
  19436. fn: function (aBoolean){
  19437. var self=this;
  19438. return smalltalk.withContext(function($ctx1) {
  19439. self["@superSend"]=aBoolean;
  19440. return self}, function($ctx1) {$ctx1.fill(self,"superSend:",{aBoolean:aBoolean},smalltalk.SendNode)})},
  19441. args: ["aBoolean"],
  19442. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  19443. messageSends: [],
  19444. referencedClasses: []
  19445. }),
  19446. smalltalk.SendNode);
  19447. smalltalk.addMethod(
  19448. smalltalk.method({
  19449. selector: "valueForReceiver:",
  19450. category: 'accessing',
  19451. fn: function (anObject){
  19452. var self=this;
  19453. function $SendNode(){return smalltalk.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  19454. return smalltalk.withContext(function($ctx1) {
  19455. var $2,$3,$5,$4,$6,$1;
  19456. $2=_st($SendNode())._new();
  19457. _st($2)._position_(self._position());
  19458. $3=$2;
  19459. $5=self._receiver();
  19460. if(($receiver = $5) == nil || $receiver == undefined){
  19461. $4=anObject;
  19462. } else {
  19463. $4=_st(self._receiver())._valueForReceiver_(anObject);
  19464. };
  19465. _st($3)._receiver_($4);
  19466. _st($2)._selector_(self._selector());
  19467. _st($2)._arguments_(self._arguments());
  19468. $6=_st($2)._yourself();
  19469. $1=$6;
  19470. return $1;
  19471. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},smalltalk.SendNode)})},
  19472. args: ["anObject"],
  19473. 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",
  19474. messageSends: ["position:", "position", "new", "receiver:", "ifNil:ifNotNil:", "valueForReceiver:", "receiver", "selector:", "selector", "arguments:", "arguments", "yourself"],
  19475. referencedClasses: ["SendNode"]
  19476. }),
  19477. smalltalk.SendNode);
  19478. smalltalk.addClass('SequenceNode', smalltalk.Node, ['temps', 'scope'], 'Compiler-AST');
  19479. 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).";
  19480. smalltalk.addMethod(
  19481. smalltalk.method({
  19482. selector: "accept:",
  19483. category: 'visiting',
  19484. fn: function (aVisitor){
  19485. var self=this;
  19486. return smalltalk.withContext(function($ctx1) {
  19487. var $1;
  19488. $1=_st(aVisitor)._visitSequenceNode_(self);
  19489. return $1;
  19490. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.SequenceNode)})},
  19491. args: ["aVisitor"],
  19492. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  19493. messageSends: ["visitSequenceNode:"],
  19494. referencedClasses: []
  19495. }),
  19496. smalltalk.SequenceNode);
  19497. smalltalk.addMethod(
  19498. smalltalk.method({
  19499. selector: "asBlockSequenceNode",
  19500. category: 'testing',
  19501. fn: function (){
  19502. var self=this;
  19503. function $BlockSequenceNode(){return smalltalk.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  19504. return smalltalk.withContext(function($ctx1) {
  19505. var $2,$3,$1;
  19506. $2=_st($BlockSequenceNode())._new();
  19507. _st($2)._position_(self._position());
  19508. _st($2)._nodes_(self._nodes());
  19509. _st($2)._temps_(self._temps());
  19510. $3=_st($2)._yourself();
  19511. $1=$3;
  19512. return $1;
  19513. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},smalltalk.SequenceNode)})},
  19514. args: [],
  19515. source: "asBlockSequenceNode\x0a\x09^BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  19516. messageSends: ["position:", "position", "new", "nodes:", "nodes", "temps:", "temps", "yourself"],
  19517. referencedClasses: ["BlockSequenceNode"]
  19518. }),
  19519. smalltalk.SequenceNode);
  19520. smalltalk.addMethod(
  19521. smalltalk.method({
  19522. selector: "scope",
  19523. category: 'accessing',
  19524. fn: function (){
  19525. var self=this;
  19526. return smalltalk.withContext(function($ctx1) {
  19527. var $1;
  19528. $1=self["@scope"];
  19529. return $1;
  19530. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.SequenceNode)})},
  19531. args: [],
  19532. source: "scope\x0a\x09^ scope",
  19533. messageSends: [],
  19534. referencedClasses: []
  19535. }),
  19536. smalltalk.SequenceNode);
  19537. smalltalk.addMethod(
  19538. smalltalk.method({
  19539. selector: "scope:",
  19540. category: 'accessing',
  19541. fn: function (aLexicalScope){
  19542. var self=this;
  19543. return smalltalk.withContext(function($ctx1) {
  19544. self["@scope"]=aLexicalScope;
  19545. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aLexicalScope:aLexicalScope},smalltalk.SequenceNode)})},
  19546. args: ["aLexicalScope"],
  19547. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  19548. messageSends: [],
  19549. referencedClasses: []
  19550. }),
  19551. smalltalk.SequenceNode);
  19552. smalltalk.addMethod(
  19553. smalltalk.method({
  19554. selector: "temps",
  19555. category: 'accessing',
  19556. fn: function (){
  19557. var self=this;
  19558. return smalltalk.withContext(function($ctx1) {
  19559. var $2,$1;
  19560. $2=self["@temps"];
  19561. if(($receiver = $2) == nil || $receiver == undefined){
  19562. $1=[];
  19563. } else {
  19564. $1=$2;
  19565. };
  19566. return $1;
  19567. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.SequenceNode)})},
  19568. args: [],
  19569. source: "temps\x0a\x09^temps ifNil: [#()]",
  19570. messageSends: ["ifNil:"],
  19571. referencedClasses: []
  19572. }),
  19573. smalltalk.SequenceNode);
  19574. smalltalk.addMethod(
  19575. smalltalk.method({
  19576. selector: "temps:",
  19577. category: 'accessing',
  19578. fn: function (aCollection){
  19579. var self=this;
  19580. return smalltalk.withContext(function($ctx1) {
  19581. self["@temps"]=aCollection;
  19582. return self}, function($ctx1) {$ctx1.fill(self,"temps:",{aCollection:aCollection},smalltalk.SequenceNode)})},
  19583. args: ["aCollection"],
  19584. source: "temps: aCollection\x0a\x09temps := aCollection",
  19585. messageSends: [],
  19586. referencedClasses: []
  19587. }),
  19588. smalltalk.SequenceNode);
  19589. smalltalk.addClass('BlockSequenceNode', smalltalk.SequenceNode, [], 'Compiler-AST');
  19590. smalltalk.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  19591. smalltalk.addMethod(
  19592. smalltalk.method({
  19593. selector: "accept:",
  19594. category: 'visiting',
  19595. fn: function (aVisitor){
  19596. var self=this;
  19597. return smalltalk.withContext(function($ctx1) {
  19598. var $1;
  19599. $1=_st(aVisitor)._visitBlockSequenceNode_(self);
  19600. return $1;
  19601. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.BlockSequenceNode)})},
  19602. args: ["aVisitor"],
  19603. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  19604. messageSends: ["visitBlockSequenceNode:"],
  19605. referencedClasses: []
  19606. }),
  19607. smalltalk.BlockSequenceNode);
  19608. smalltalk.addMethod(
  19609. smalltalk.method({
  19610. selector: "isBlockSequenceNode",
  19611. category: 'testing',
  19612. fn: function (){
  19613. var self=this;
  19614. return smalltalk.withContext(function($ctx1) {
  19615. return true;
  19616. }, function($ctx1) {$ctx1.fill(self,"isBlockSequenceNode",{},smalltalk.BlockSequenceNode)})},
  19617. args: [],
  19618. source: "isBlockSequenceNode\x0a\x09^true",
  19619. messageSends: [],
  19620. referencedClasses: []
  19621. }),
  19622. smalltalk.BlockSequenceNode);
  19623. smalltalk.addClass('ValueNode', smalltalk.Node, ['value'], 'Compiler-AST');
  19624. smalltalk.ValueNode.comment="I represent a value node.";
  19625. smalltalk.addMethod(
  19626. smalltalk.method({
  19627. selector: "accept:",
  19628. category: 'visiting',
  19629. fn: function (aVisitor){
  19630. var self=this;
  19631. return smalltalk.withContext(function($ctx1) {
  19632. var $1;
  19633. $1=_st(aVisitor)._visitValueNode_(self);
  19634. return $1;
  19635. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.ValueNode)})},
  19636. args: ["aVisitor"],
  19637. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  19638. messageSends: ["visitValueNode:"],
  19639. referencedClasses: []
  19640. }),
  19641. smalltalk.ValueNode);
  19642. smalltalk.addMethod(
  19643. smalltalk.method({
  19644. selector: "isImmutable",
  19645. category: 'testing',
  19646. fn: function (){
  19647. var self=this;
  19648. return smalltalk.withContext(function($ctx1) {
  19649. var $1;
  19650. $1=_st(self._value())._isImmutable();
  19651. return $1;
  19652. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.ValueNode)})},
  19653. args: [],
  19654. source: "isImmutable\x0a\x09^ self value isImmutable",
  19655. messageSends: ["isImmutable", "value"],
  19656. referencedClasses: []
  19657. }),
  19658. smalltalk.ValueNode);
  19659. smalltalk.addMethod(
  19660. smalltalk.method({
  19661. selector: "isValueNode",
  19662. category: 'testing',
  19663. fn: function (){
  19664. var self=this;
  19665. return smalltalk.withContext(function($ctx1) {
  19666. return true;
  19667. }, function($ctx1) {$ctx1.fill(self,"isValueNode",{},smalltalk.ValueNode)})},
  19668. args: [],
  19669. source: "isValueNode\x0a\x09^true",
  19670. messageSends: [],
  19671. referencedClasses: []
  19672. }),
  19673. smalltalk.ValueNode);
  19674. smalltalk.addMethod(
  19675. smalltalk.method({
  19676. selector: "value",
  19677. category: 'accessing',
  19678. fn: function (){
  19679. var self=this;
  19680. return smalltalk.withContext(function($ctx1) {
  19681. var $1;
  19682. $1=self["@value"];
  19683. return $1;
  19684. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.ValueNode)})},
  19685. args: [],
  19686. source: "value\x0a\x09^value",
  19687. messageSends: [],
  19688. referencedClasses: []
  19689. }),
  19690. smalltalk.ValueNode);
  19691. smalltalk.addMethod(
  19692. smalltalk.method({
  19693. selector: "value:",
  19694. category: 'accessing',
  19695. fn: function (anObject){
  19696. var self=this;
  19697. return smalltalk.withContext(function($ctx1) {
  19698. self["@value"]=anObject;
  19699. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.ValueNode)})},
  19700. args: ["anObject"],
  19701. source: "value: anObject\x0a\x09value := anObject",
  19702. messageSends: [],
  19703. referencedClasses: []
  19704. }),
  19705. smalltalk.ValueNode);
  19706. smalltalk.addClass('VariableNode', smalltalk.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  19707. smalltalk.VariableNode.comment="I represent an variable node.";
  19708. smalltalk.addMethod(
  19709. smalltalk.method({
  19710. selector: "accept:",
  19711. category: 'visiting',
  19712. fn: function (aVisitor){
  19713. var self=this;
  19714. return smalltalk.withContext(function($ctx1) {
  19715. var $1;
  19716. $1=_st(aVisitor)._visitVariableNode_(self);
  19717. return $1;
  19718. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.VariableNode)})},
  19719. args: ["aVisitor"],
  19720. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  19721. messageSends: ["visitVariableNode:"],
  19722. referencedClasses: []
  19723. }),
  19724. smalltalk.VariableNode);
  19725. smalltalk.addMethod(
  19726. smalltalk.method({
  19727. selector: "alias",
  19728. category: 'accessing',
  19729. fn: function (){
  19730. var self=this;
  19731. return smalltalk.withContext(function($ctx1) {
  19732. var $1;
  19733. $1=_st(self._binding())._alias();
  19734. return $1;
  19735. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.VariableNode)})},
  19736. args: [],
  19737. source: "alias\x0a\x09^ self binding alias",
  19738. messageSends: ["alias", "binding"],
  19739. referencedClasses: []
  19740. }),
  19741. smalltalk.VariableNode);
  19742. smalltalk.addMethod(
  19743. smalltalk.method({
  19744. selector: "assigned",
  19745. category: 'accessing',
  19746. fn: function (){
  19747. var self=this;
  19748. return smalltalk.withContext(function($ctx1) {
  19749. var $2,$1;
  19750. $2=self["@assigned"];
  19751. if(($receiver = $2) == nil || $receiver == undefined){
  19752. $1=false;
  19753. } else {
  19754. $1=$2;
  19755. };
  19756. return $1;
  19757. }, function($ctx1) {$ctx1.fill(self,"assigned",{},smalltalk.VariableNode)})},
  19758. args: [],
  19759. source: "assigned\x0a\x09^assigned ifNil: [false]",
  19760. messageSends: ["ifNil:"],
  19761. referencedClasses: []
  19762. }),
  19763. smalltalk.VariableNode);
  19764. smalltalk.addMethod(
  19765. smalltalk.method({
  19766. selector: "assigned:",
  19767. category: 'accessing',
  19768. fn: function (aBoolean){
  19769. var self=this;
  19770. return smalltalk.withContext(function($ctx1) {
  19771. self["@assigned"]=aBoolean;
  19772. return self}, function($ctx1) {$ctx1.fill(self,"assigned:",{aBoolean:aBoolean},smalltalk.VariableNode)})},
  19773. args: ["aBoolean"],
  19774. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  19775. messageSends: [],
  19776. referencedClasses: []
  19777. }),
  19778. smalltalk.VariableNode);
  19779. smalltalk.addMethod(
  19780. smalltalk.method({
  19781. selector: "beAssigned",
  19782. category: 'accessing',
  19783. fn: function (){
  19784. var self=this;
  19785. return smalltalk.withContext(function($ctx1) {
  19786. _st(self._binding())._validateAssignment();
  19787. self["@assigned"]=true;
  19788. return self}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},smalltalk.VariableNode)})},
  19789. args: [],
  19790. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  19791. messageSends: ["validateAssignment", "binding"],
  19792. referencedClasses: []
  19793. }),
  19794. smalltalk.VariableNode);
  19795. smalltalk.addMethod(
  19796. smalltalk.method({
  19797. selector: "binding",
  19798. category: 'accessing',
  19799. fn: function (){
  19800. var self=this;
  19801. return smalltalk.withContext(function($ctx1) {
  19802. var $1;
  19803. $1=self["@binding"];
  19804. return $1;
  19805. }, function($ctx1) {$ctx1.fill(self,"binding",{},smalltalk.VariableNode)})},
  19806. args: [],
  19807. source: "binding\x0a\x09^ binding",
  19808. messageSends: [],
  19809. referencedClasses: []
  19810. }),
  19811. smalltalk.VariableNode);
  19812. smalltalk.addMethod(
  19813. smalltalk.method({
  19814. selector: "binding:",
  19815. category: 'accessing',
  19816. fn: function (aScopeVar){
  19817. var self=this;
  19818. return smalltalk.withContext(function($ctx1) {
  19819. self["@binding"]=aScopeVar;
  19820. return self}, function($ctx1) {$ctx1.fill(self,"binding:",{aScopeVar:aScopeVar},smalltalk.VariableNode)})},
  19821. args: ["aScopeVar"],
  19822. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  19823. messageSends: [],
  19824. referencedClasses: []
  19825. }),
  19826. smalltalk.VariableNode);
  19827. smalltalk.addMethod(
  19828. smalltalk.method({
  19829. selector: "isImmutable",
  19830. category: 'testing',
  19831. fn: function (){
  19832. var self=this;
  19833. return smalltalk.withContext(function($ctx1) {
  19834. return false;
  19835. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.VariableNode)})},
  19836. args: [],
  19837. source: "isImmutable\x0a\x09^false",
  19838. messageSends: [],
  19839. referencedClasses: []
  19840. }),
  19841. smalltalk.VariableNode);
  19842. smalltalk.addClass('ClassReferenceNode', smalltalk.VariableNode, [], 'Compiler-AST');
  19843. smalltalk.ClassReferenceNode.comment="I represent an class reference node.";
  19844. smalltalk.addMethod(
  19845. smalltalk.method({
  19846. selector: "accept:",
  19847. category: 'visiting',
  19848. fn: function (aVisitor){
  19849. var self=this;
  19850. return smalltalk.withContext(function($ctx1) {
  19851. var $1;
  19852. $1=_st(aVisitor)._visitClassReferenceNode_(self);
  19853. return $1;
  19854. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.ClassReferenceNode)})},
  19855. args: ["aVisitor"],
  19856. source: "accept: aVisitor\x0a\x09^ aVisitor visitClassReferenceNode: self",
  19857. messageSends: ["visitClassReferenceNode:"],
  19858. referencedClasses: []
  19859. }),
  19860. smalltalk.ClassReferenceNode);
  19861. smalltalk.addMethod(
  19862. smalltalk.method({
  19863. selector: "isNode",
  19864. category: '*Compiler-AST',
  19865. fn: function (){
  19866. var self=this;
  19867. return smalltalk.withContext(function($ctx1) {
  19868. return false;
  19869. }, function($ctx1) {$ctx1.fill(self,"isNode",{},smalltalk.Object)})},
  19870. args: [],
  19871. source: "isNode\x0a\x09^ false",
  19872. messageSends: [],
  19873. referencedClasses: []
  19874. }),
  19875. smalltalk.Object);
  19876. smalltalk.addMethod(
  19877. smalltalk.method({
  19878. selector: "ast",
  19879. category: '*Compiler-AST',
  19880. fn: function (){
  19881. var self=this;
  19882. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19883. return smalltalk.withContext(function($ctx1) {
  19884. var $1;
  19885. _st(self._source())._ifEmpty_((function(){
  19886. return smalltalk.withContext(function($ctx2) {
  19887. return self._error_("Method source is empty");
  19888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  19889. $1=_st(_st($Smalltalk())._current())._parse_(self._source());
  19890. return $1;
  19891. }, function($ctx1) {$ctx1.fill(self,"ast",{},smalltalk.CompiledMethod)})},
  19892. args: [],
  19893. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk current parse: self source",
  19894. messageSends: ["ifEmpty:", "error:", "source", "parse:", "current"],
  19895. referencedClasses: ["Smalltalk"]
  19896. }),
  19897. smalltalk.CompiledMethod);
  19898. smalltalk.addPackage('Compiler-IR');
  19899. smalltalk.addClass('IRASTTranslator', smalltalk.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  19900. smalltalk.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  19901. smalltalk.addMethod(
  19902. smalltalk.method({
  19903. selector: "alias:",
  19904. category: 'visiting',
  19905. fn: function (aNode){
  19906. var self=this;
  19907. var variable;
  19908. function $AliasVar(){return smalltalk.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  19909. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  19910. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  19911. return smalltalk.withContext(function($ctx1) {
  19912. var $1,$2,$3,$4,$5,$6,$7;
  19913. $1=_st(aNode)._isImmutable();
  19914. if(smalltalk.assert($1)){
  19915. $2=self._visit_(aNode);
  19916. return $2;
  19917. };
  19918. $3=_st($IRVariable())._new();
  19919. _st($3)._variable_(_st(_st($AliasVar())._new())._name_("$".__comma(self._nextAlias())));
  19920. $4=_st($3)._yourself();
  19921. variable=$4;
  19922. $5=_st($IRAssignment())._new();
  19923. _st($5)._add_(variable);
  19924. _st($5)._add_(self._visit_(aNode));
  19925. $6=_st($5)._yourself();
  19926. _st(self._sequence())._add_($6);
  19927. _st(_st(self._method())._internalVariables())._add_(variable);
  19928. $7=variable;
  19929. return $7;
  19930. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},smalltalk.IRASTTranslator)})},
  19931. args: ["aNode"],
  19932. 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",
  19933. messageSends: ["ifTrue:", "visit:", "isImmutable", "variable:", "name:", ",", "nextAlias", "new", "yourself", "add:", "sequence", "internalVariables", "method"],
  19934. referencedClasses: ["AliasVar", "IRVariable", "IRAssignment"]
  19935. }),
  19936. smalltalk.IRASTTranslator);
  19937. smalltalk.addMethod(
  19938. smalltalk.method({
  19939. selector: "aliasTemporally:",
  19940. category: 'visiting',
  19941. fn: function (aCollection){
  19942. var self=this;
  19943. var threshold,result;
  19944. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  19945. return smalltalk.withContext(function($ctx1) {
  19946. var $1,$2,$4,$3,$5;
  19947. threshold=(0);
  19948. _st(aCollection)._withIndexDo_((function(each,i){
  19949. return smalltalk.withContext(function($ctx2) {
  19950. $1=_st(each)._subtreeNeedsAliasing();
  19951. if(smalltalk.assert($1)){
  19952. threshold=i;
  19953. return threshold;
  19954. };
  19955. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  19956. result=_st($OrderedCollection())._new();
  19957. _st(aCollection)._withIndexDo_((function(each,i){
  19958. return smalltalk.withContext(function($ctx2) {
  19959. $2=result;
  19960. $4=_st(i).__lt_eq(threshold);
  19961. if(smalltalk.assert($4)){
  19962. $3=self._alias_(each);
  19963. } else {
  19964. $3=self._visit_(each);
  19965. };
  19966. return _st($2)._add_($3);
  19967. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  19968. $5=result;
  19969. return $5;
  19970. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},smalltalk.IRASTTranslator)})},
  19971. args: ["aCollection"],
  19972. 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",
  19973. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "alias:", "visit:", "<="],
  19974. referencedClasses: ["OrderedCollection"]
  19975. }),
  19976. smalltalk.IRASTTranslator);
  19977. smalltalk.addMethod(
  19978. smalltalk.method({
  19979. selector: "method",
  19980. category: 'accessing',
  19981. fn: function (){
  19982. var self=this;
  19983. return smalltalk.withContext(function($ctx1) {
  19984. var $1;
  19985. $1=self["@method"];
  19986. return $1;
  19987. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.IRASTTranslator)})},
  19988. args: [],
  19989. source: "method\x0a\x09^ method",
  19990. messageSends: [],
  19991. referencedClasses: []
  19992. }),
  19993. smalltalk.IRASTTranslator);
  19994. smalltalk.addMethod(
  19995. smalltalk.method({
  19996. selector: "method:",
  19997. category: 'accessing',
  19998. fn: function (anIRMethod){
  19999. var self=this;
  20000. return smalltalk.withContext(function($ctx1) {
  20001. self["@method"]=anIRMethod;
  20002. return self}, function($ctx1) {$ctx1.fill(self,"method:",{anIRMethod:anIRMethod},smalltalk.IRASTTranslator)})},
  20003. args: ["anIRMethod"],
  20004. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  20005. messageSends: [],
  20006. referencedClasses: []
  20007. }),
  20008. smalltalk.IRASTTranslator);
  20009. smalltalk.addMethod(
  20010. smalltalk.method({
  20011. selector: "nextAlias",
  20012. category: 'accessing',
  20013. fn: function (){
  20014. var self=this;
  20015. return smalltalk.withContext(function($ctx1) {
  20016. var $1,$2;
  20017. $1=self["@nextAlias"];
  20018. if(($receiver = $1) == nil || $receiver == undefined){
  20019. self["@nextAlias"]=(0);
  20020. self["@nextAlias"];
  20021. } else {
  20022. $1;
  20023. };
  20024. self["@nextAlias"]=_st(self["@nextAlias"]).__plus((1));
  20025. $2=_st(self["@nextAlias"])._asString();
  20026. return $2;
  20027. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},smalltalk.IRASTTranslator)})},
  20028. args: [],
  20029. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  20030. messageSends: ["ifNil:", "+", "asString"],
  20031. referencedClasses: []
  20032. }),
  20033. smalltalk.IRASTTranslator);
  20034. smalltalk.addMethod(
  20035. smalltalk.method({
  20036. selector: "sequence",
  20037. category: 'accessing',
  20038. fn: function (){
  20039. var self=this;
  20040. return smalltalk.withContext(function($ctx1) {
  20041. var $1;
  20042. $1=self["@sequence"];
  20043. return $1;
  20044. }, function($ctx1) {$ctx1.fill(self,"sequence",{},smalltalk.IRASTTranslator)})},
  20045. args: [],
  20046. source: "sequence\x0a\x09^ sequence",
  20047. messageSends: [],
  20048. referencedClasses: []
  20049. }),
  20050. smalltalk.IRASTTranslator);
  20051. smalltalk.addMethod(
  20052. smalltalk.method({
  20053. selector: "sequence:",
  20054. category: 'accessing',
  20055. fn: function (anIRSequence){
  20056. var self=this;
  20057. return smalltalk.withContext(function($ctx1) {
  20058. self["@sequence"]=anIRSequence;
  20059. return self}, function($ctx1) {$ctx1.fill(self,"sequence:",{anIRSequence:anIRSequence},smalltalk.IRASTTranslator)})},
  20060. args: ["anIRSequence"],
  20061. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  20062. messageSends: [],
  20063. referencedClasses: []
  20064. }),
  20065. smalltalk.IRASTTranslator);
  20066. smalltalk.addMethod(
  20067. smalltalk.method({
  20068. selector: "source",
  20069. category: 'accessing',
  20070. fn: function (){
  20071. var self=this;
  20072. return smalltalk.withContext(function($ctx1) {
  20073. var $1;
  20074. $1=self["@source"];
  20075. return $1;
  20076. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.IRASTTranslator)})},
  20077. args: [],
  20078. source: "source\x0a\x09^ source",
  20079. messageSends: [],
  20080. referencedClasses: []
  20081. }),
  20082. smalltalk.IRASTTranslator);
  20083. smalltalk.addMethod(
  20084. smalltalk.method({
  20085. selector: "source:",
  20086. category: 'accessing',
  20087. fn: function (aString){
  20088. var self=this;
  20089. return smalltalk.withContext(function($ctx1) {
  20090. self["@source"]=aString;
  20091. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.IRASTTranslator)})},
  20092. args: ["aString"],
  20093. source: "source: aString\x0a\x09source := aString",
  20094. messageSends: [],
  20095. referencedClasses: []
  20096. }),
  20097. smalltalk.IRASTTranslator);
  20098. smalltalk.addMethod(
  20099. smalltalk.method({
  20100. selector: "theClass",
  20101. category: 'accessing',
  20102. fn: function (){
  20103. var self=this;
  20104. return smalltalk.withContext(function($ctx1) {
  20105. var $1;
  20106. $1=self["@theClass"];
  20107. return $1;
  20108. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.IRASTTranslator)})},
  20109. args: [],
  20110. source: "theClass\x0a\x09^ theClass",
  20111. messageSends: [],
  20112. referencedClasses: []
  20113. }),
  20114. smalltalk.IRASTTranslator);
  20115. smalltalk.addMethod(
  20116. smalltalk.method({
  20117. selector: "theClass:",
  20118. category: 'accessing',
  20119. fn: function (aClass){
  20120. var self=this;
  20121. return smalltalk.withContext(function($ctx1) {
  20122. self["@theClass"]=aClass;
  20123. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.IRASTTranslator)})},
  20124. args: ["aClass"],
  20125. source: "theClass: aClass\x0a\x09theClass := aClass",
  20126. messageSends: [],
  20127. referencedClasses: []
  20128. }),
  20129. smalltalk.IRASTTranslator);
  20130. smalltalk.addMethod(
  20131. smalltalk.method({
  20132. selector: "visitAssignmentNode:",
  20133. category: 'visiting',
  20134. fn: function (aNode){
  20135. var self=this;
  20136. var left,right,assignment;
  20137. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  20138. return smalltalk.withContext(function($ctx1) {
  20139. var $1,$2,$3;
  20140. right=self._visit_(_st(aNode)._right());
  20141. left=self._visit_(_st(aNode)._left());
  20142. $1=_st($IRAssignment())._new();
  20143. _st($1)._add_(left);
  20144. _st($1)._add_(right);
  20145. $2=_st($1)._yourself();
  20146. _st(self._sequence())._add_($2);
  20147. $3=left;
  20148. return $3;
  20149. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},smalltalk.IRASTTranslator)})},
  20150. args: ["aNode"],
  20151. 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",
  20152. messageSends: ["visit:", "right", "left", "add:", "new", "yourself", "sequence"],
  20153. referencedClasses: ["IRAssignment"]
  20154. }),
  20155. smalltalk.IRASTTranslator);
  20156. smalltalk.addMethod(
  20157. smalltalk.method({
  20158. selector: "visitBlockNode:",
  20159. category: 'visiting',
  20160. fn: function (aNode){
  20161. var self=this;
  20162. var closure;
  20163. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  20164. function $IRTempDeclaration(){return smalltalk.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  20165. return smalltalk.withContext(function($ctx1) {
  20166. var $1,$2,$3,$4,$5;
  20167. $1=_st($IRClosure())._new();
  20168. _st($1)._arguments_(_st(aNode)._parameters());
  20169. _st($1)._scope_(_st(aNode)._scope());
  20170. $2=_st($1)._yourself();
  20171. closure=$2;
  20172. _st(_st(_st(aNode)._scope())._temps())._do_((function(each){
  20173. return smalltalk.withContext(function($ctx2) {
  20174. $3=_st($IRTempDeclaration())._new();
  20175. _st($3)._name_(_st(each)._name());
  20176. _st($3)._scope_(_st(aNode)._scope());
  20177. $4=_st($3)._yourself();
  20178. return _st(closure)._add_($4);
  20179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20180. _st(_st(aNode)._nodes())._do_((function(each){
  20181. return smalltalk.withContext(function($ctx2) {
  20182. return _st(closure)._add_(self._visit_(each));
  20183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20184. $5=closure;
  20185. return $5;
  20186. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},smalltalk.IRASTTranslator)})},
  20187. args: ["aNode"],
  20188. 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",
  20189. messageSends: ["arguments:", "parameters", "new", "scope:", "scope", "yourself", "do:", "add:", "name:", "name", "temps", "visit:", "nodes"],
  20190. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  20191. }),
  20192. smalltalk.IRASTTranslator);
  20193. smalltalk.addMethod(
  20194. smalltalk.method({
  20195. selector: "visitBlockSequenceNode:",
  20196. category: 'visiting',
  20197. fn: function (aNode){
  20198. var self=this;
  20199. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  20200. function $IRBlockReturn(){return smalltalk.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  20201. return smalltalk.withContext(function($ctx1) {
  20202. var $2,$3,$4,$1;
  20203. $1=self._withSequence_do_(_st($IRBlockSequence())._new(),(function(){
  20204. return smalltalk.withContext(function($ctx2) {
  20205. return _st(_st(aNode)._nodes())._ifNotEmpty_((function(){
  20206. return smalltalk.withContext(function($ctx3) {
  20207. _st(_st(_st(aNode)._nodes())._allButLast())._do_((function(each){
  20208. return smalltalk.withContext(function($ctx4) {
  20209. return _st(self._sequence())._add_(self._visit_(each));
  20210. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3)})}));
  20211. $2=_st(_st(_st(aNode)._nodes())._last())._isReturnNode();
  20212. if(smalltalk.assert($2)){
  20213. return _st(self._sequence())._add_(self._visit_(_st(_st(aNode)._nodes())._last()));
  20214. } else {
  20215. $3=_st($IRBlockReturn())._new();
  20216. _st($3)._add_(self._visit_(_st(_st(aNode)._nodes())._last()));
  20217. $4=_st($3)._yourself();
  20218. return _st(self._sequence())._add_($4);
  20219. };
  20220. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  20221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  20222. return $1;
  20223. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20224. args: ["aNode"],
  20225. 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) ]]]",
  20226. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "do:", "add:", "visit:", "sequence", "allButLast", "nodes", "ifFalse:ifTrue:", "last", "yourself", "isReturnNode"],
  20227. referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
  20228. }),
  20229. smalltalk.IRASTTranslator);
  20230. smalltalk.addMethod(
  20231. smalltalk.method({
  20232. selector: "visitCascadeNode:",
  20233. category: 'visiting',
  20234. fn: function (aNode){
  20235. var self=this;
  20236. var alias;
  20237. function $VariableNode(){return smalltalk.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  20238. return smalltalk.withContext(function($ctx1) {
  20239. var $1,$2;
  20240. $1=_st(_st(aNode)._receiver())._isImmutable();
  20241. if(! smalltalk.assert($1)){
  20242. alias=self._alias_(_st(aNode)._receiver());
  20243. alias;
  20244. _st(_st(aNode)._nodes())._do_((function(each){
  20245. return smalltalk.withContext(function($ctx2) {
  20246. return _st(each)._receiver_(_st(_st($VariableNode())._new())._binding_(_st(alias)._variable()));
  20247. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20248. };
  20249. _st(_st(_st(aNode)._nodes())._allButLast())._do_((function(each){
  20250. return smalltalk.withContext(function($ctx2) {
  20251. return _st(self._sequence())._add_(self._visit_(each));
  20252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20253. $2=self._alias_(_st(_st(aNode)._nodes())._last());
  20254. return $2;
  20255. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias},smalltalk.IRASTTranslator)})},
  20256. args: ["aNode"],
  20257. 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",
  20258. messageSends: ["ifFalse:", "alias:", "receiver", "do:", "receiver:", "binding:", "variable", "new", "nodes", "isImmutable", "add:", "visit:", "sequence", "allButLast", "last"],
  20259. referencedClasses: ["VariableNode"]
  20260. }),
  20261. smalltalk.IRASTTranslator);
  20262. smalltalk.addMethod(
  20263. smalltalk.method({
  20264. selector: "visitDynamicArrayNode:",
  20265. category: 'visiting',
  20266. fn: function (aNode){
  20267. var self=this;
  20268. var array;
  20269. function $IRDynamicArray(){return smalltalk.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  20270. return smalltalk.withContext(function($ctx1) {
  20271. var $1;
  20272. array=_st($IRDynamicArray())._new();
  20273. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  20274. return smalltalk.withContext(function($ctx2) {
  20275. return _st(array)._add_(each);
  20276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20277. $1=array;
  20278. return $1;
  20279. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},smalltalk.IRASTTranslator)})},
  20280. args: ["aNode"],
  20281. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [:each | array add: each].\x0a\x09^ array",
  20282. messageSends: ["new", "do:", "add:", "aliasTemporally:", "nodes"],
  20283. referencedClasses: ["IRDynamicArray"]
  20284. }),
  20285. smalltalk.IRASTTranslator);
  20286. smalltalk.addMethod(
  20287. smalltalk.method({
  20288. selector: "visitDynamicDictionaryNode:",
  20289. category: 'visiting',
  20290. fn: function (aNode){
  20291. var self=this;
  20292. var dictionary;
  20293. function $IRDynamicDictionary(){return smalltalk.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  20294. return smalltalk.withContext(function($ctx1) {
  20295. var $1;
  20296. dictionary=_st($IRDynamicDictionary())._new();
  20297. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  20298. return smalltalk.withContext(function($ctx2) {
  20299. return _st(dictionary)._add_(each);
  20300. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20301. $1=dictionary;
  20302. return $1;
  20303. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},smalltalk.IRASTTranslator)})},
  20304. args: ["aNode"],
  20305. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [:each | dictionary add: each].\x0a\x09^ dictionary",
  20306. messageSends: ["new", "do:", "add:", "aliasTemporally:", "nodes"],
  20307. referencedClasses: ["IRDynamicDictionary"]
  20308. }),
  20309. smalltalk.IRASTTranslator);
  20310. smalltalk.addMethod(
  20311. smalltalk.method({
  20312. selector: "visitJSStatementNode:",
  20313. category: 'visiting',
  20314. fn: function (aNode){
  20315. var self=this;
  20316. function $IRVerbatim(){return smalltalk.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  20317. return smalltalk.withContext(function($ctx1) {
  20318. var $2,$3,$1;
  20319. $2=_st($IRVerbatim())._new();
  20320. _st($2)._source_(_st(_st(aNode)._source())._crlfSanitized());
  20321. $3=_st($2)._yourself();
  20322. $1=$3;
  20323. return $1;
  20324. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20325. args: ["aNode"],
  20326. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  20327. messageSends: ["source:", "crlfSanitized", "source", "new", "yourself"],
  20328. referencedClasses: ["IRVerbatim"]
  20329. }),
  20330. smalltalk.IRASTTranslator);
  20331. smalltalk.addMethod(
  20332. smalltalk.method({
  20333. selector: "visitMethodNode:",
  20334. category: 'visiting',
  20335. fn: function (aNode){
  20336. var self=this;
  20337. function $IRMethod(){return smalltalk.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  20338. function $IRTempDeclaration(){return smalltalk.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  20339. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  20340. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  20341. return smalltalk.withContext(function($ctx1) {
  20342. var $1,$2,$3,$4,$5,$6,$7,$8;
  20343. $1=_st($IRMethod())._new();
  20344. _st($1)._source_(_st(self._source())._crlfSanitized());
  20345. _st($1)._theClass_(self._theClass());
  20346. _st($1)._arguments_(_st(aNode)._arguments());
  20347. _st($1)._selector_(_st(aNode)._selector());
  20348. _st($1)._messageSends_(_st(aNode)._messageSends());
  20349. _st($1)._superSends_(_st(aNode)._superSends());
  20350. _st($1)._classReferences_(_st(aNode)._classReferences());
  20351. _st($1)._scope_(_st(aNode)._scope());
  20352. $2=_st($1)._yourself();
  20353. self._method_($2);
  20354. _st(_st(_st(aNode)._scope())._temps())._do_((function(each){
  20355. return smalltalk.withContext(function($ctx2) {
  20356. $3=_st($IRTempDeclaration())._new();
  20357. _st($3)._name_(_st(each)._name());
  20358. _st($3)._scope_(_st(aNode)._scope());
  20359. $4=_st($3)._yourself();
  20360. return _st(self._method())._add_($4);
  20361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20362. _st(_st(aNode)._nodes())._do_((function(each){
  20363. return smalltalk.withContext(function($ctx2) {
  20364. return _st(self._method())._add_(self._visit_(each));
  20365. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20366. $5=_st(_st(aNode)._scope())._hasLocalReturn();
  20367. if(! smalltalk.assert($5)){
  20368. $6=_st($IRVariable())._new();
  20369. _st($6)._variable_(_st(_st(_st(aNode)._scope())._pseudoVars())._at_("self"));
  20370. $7=_st($6)._yourself();
  20371. _st(_st(self._method())._add_(_st($IRReturn())._new()))._add_($7);
  20372. };
  20373. $8=self._method();
  20374. return $8;
  20375. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20376. args: ["aNode"],
  20377. 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",
  20378. messageSends: ["method:", "source:", "crlfSanitized", "source", "new", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "messageSends:", "messageSends", "superSends:", "superSends", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "add:", "name:", "name", "method", "temps", "visit:", "nodes", "ifFalse:", "variable:", "at:", "pseudoVars", "hasLocalReturn"],
  20379. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRVariable", "IRReturn"]
  20380. }),
  20381. smalltalk.IRASTTranslator);
  20382. smalltalk.addMethod(
  20383. smalltalk.method({
  20384. selector: "visitReturnNode:",
  20385. category: 'visiting',
  20386. fn: function (aNode){
  20387. var self=this;
  20388. var return_;
  20389. function $IRNonLocalReturn(){return smalltalk.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  20390. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  20391. return smalltalk.withContext(function($ctx1) {
  20392. var $1,$2;
  20393. $1=_st(aNode)._nonLocalReturn();
  20394. if(smalltalk.assert($1)){
  20395. return_=_st($IRNonLocalReturn())._new();
  20396. } else {
  20397. return_=_st($IRReturn())._new();
  20398. };
  20399. _st(return_)._scope_(_st(aNode)._scope());
  20400. _st(_st(aNode)._nodes())._do_((function(each){
  20401. return smalltalk.withContext(function($ctx2) {
  20402. return _st(return_)._add_(self._alias_(each));
  20403. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20404. $2=return_;
  20405. return $2;
  20406. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},smalltalk.IRASTTranslator)})},
  20407. args: ["aNode"],
  20408. 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",
  20409. messageSends: ["ifTrue:ifFalse:", "new", "nonLocalReturn", "scope:", "scope", "do:", "add:", "alias:", "nodes"],
  20410. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  20411. }),
  20412. smalltalk.IRASTTranslator);
  20413. smalltalk.addMethod(
  20414. smalltalk.method({
  20415. selector: "visitSendNode:",
  20416. category: 'visiting',
  20417. fn: function (aNode){
  20418. var self=this;
  20419. var send,all,receiver,arguments;
  20420. function $IRSend(){return smalltalk.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  20421. return smalltalk.withContext(function($ctx1) {
  20422. var $1,$2,$3,$4;
  20423. send=_st($IRSend())._new();
  20424. $1=send;
  20425. _st($1)._selector_(_st(aNode)._selector());
  20426. $2=_st($1)._index_(_st(aNode)._index());
  20427. $3=_st(aNode)._superSend();
  20428. if(smalltalk.assert($3)){
  20429. _st(send)._classSend_(_st(self._theClass())._superclass());
  20430. };
  20431. all=self._aliasTemporally_(_st([_st(aNode)._receiver()]).__comma(_st(aNode)._arguments()));
  20432. receiver=_st(all)._first();
  20433. arguments=_st(all)._allButFirst();
  20434. _st(send)._add_(receiver);
  20435. _st(arguments)._do_((function(each){
  20436. return smalltalk.withContext(function($ctx2) {
  20437. return _st(send)._add_(each);
  20438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20439. $4=send;
  20440. return $4;
  20441. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments:arguments},smalltalk.IRASTTranslator)})},
  20442. args: ["aNode"],
  20443. 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",
  20444. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "classSend:", "superclass", "theClass", "superSend", "aliasTemporally:", ",", "arguments", "receiver", "first", "allButFirst", "add:", "do:"],
  20445. referencedClasses: ["IRSend"]
  20446. }),
  20447. smalltalk.IRASTTranslator);
  20448. smalltalk.addMethod(
  20449. smalltalk.method({
  20450. selector: "visitSequenceNode:",
  20451. category: 'visiting',
  20452. fn: function (aNode){
  20453. var self=this;
  20454. function $IRSequence(){return smalltalk.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  20455. return smalltalk.withContext(function($ctx1) {
  20456. var $2,$1;
  20457. $1=self._withSequence_do_(_st($IRSequence())._new(),(function(){
  20458. return smalltalk.withContext(function($ctx2) {
  20459. return _st(_st(aNode)._nodes())._do_((function(each){
  20460. var instruction;
  20461. return smalltalk.withContext(function($ctx3) {
  20462. instruction=self._visit_(each);
  20463. instruction;
  20464. $2=_st(instruction)._isVariable();
  20465. if(! smalltalk.assert($2)){
  20466. return _st(self._sequence())._add_(instruction);
  20467. };
  20468. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2)})}));
  20469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  20470. return $1;
  20471. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20472. args: ["aNode"],
  20473. 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 ]]]",
  20474. messageSends: ["withSequence:do:", "new", "do:", "visit:", "ifFalse:", "add:", "sequence", "isVariable", "nodes"],
  20475. referencedClasses: ["IRSequence"]
  20476. }),
  20477. smalltalk.IRASTTranslator);
  20478. smalltalk.addMethod(
  20479. smalltalk.method({
  20480. selector: "visitValueNode:",
  20481. category: 'visiting',
  20482. fn: function (aNode){
  20483. var self=this;
  20484. function $IRValue(){return smalltalk.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  20485. return smalltalk.withContext(function($ctx1) {
  20486. var $2,$3,$1;
  20487. $2=_st($IRValue())._new();
  20488. _st($2)._value_(_st(aNode)._value());
  20489. $3=_st($2)._yourself();
  20490. $1=$3;
  20491. return $1;
  20492. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20493. args: ["aNode"],
  20494. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  20495. messageSends: ["value:", "value", "new", "yourself"],
  20496. referencedClasses: ["IRValue"]
  20497. }),
  20498. smalltalk.IRASTTranslator);
  20499. smalltalk.addMethod(
  20500. smalltalk.method({
  20501. selector: "visitVariableNode:",
  20502. category: 'visiting',
  20503. fn: function (aNode){
  20504. var self=this;
  20505. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  20506. return smalltalk.withContext(function($ctx1) {
  20507. var $2,$3,$1;
  20508. $2=_st($IRVariable())._new();
  20509. _st($2)._variable_(_st(aNode)._binding());
  20510. $3=_st($2)._yourself();
  20511. $1=$3;
  20512. return $1;
  20513. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20514. args: ["aNode"],
  20515. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  20516. messageSends: ["variable:", "binding", "new", "yourself"],
  20517. referencedClasses: ["IRVariable"]
  20518. }),
  20519. smalltalk.IRASTTranslator);
  20520. smalltalk.addMethod(
  20521. smalltalk.method({
  20522. selector: "withSequence:do:",
  20523. category: 'accessing',
  20524. fn: function (aSequence,aBlock){
  20525. var self=this;
  20526. var outerSequence;
  20527. return smalltalk.withContext(function($ctx1) {
  20528. var $1;
  20529. outerSequence=self._sequence();
  20530. self._sequence_(aSequence);
  20531. _st(aBlock)._value();
  20532. self._sequence_(outerSequence);
  20533. $1=aSequence;
  20534. return $1;
  20535. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},smalltalk.IRASTTranslator)})},
  20536. args: ["aSequence", "aBlock"],
  20537. 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",
  20538. messageSends: ["sequence", "sequence:", "value"],
  20539. referencedClasses: []
  20540. }),
  20541. smalltalk.IRASTTranslator);
  20542. smalltalk.addClass('IRInstruction', smalltalk.Object, ['parent', 'instructions'], 'Compiler-IR');
  20543. 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.";
  20544. smalltalk.addMethod(
  20545. smalltalk.method({
  20546. selector: "accept:",
  20547. category: 'visiting',
  20548. fn: function (aVisitor){
  20549. var self=this;
  20550. return smalltalk.withContext(function($ctx1) {
  20551. var $1;
  20552. $1=_st(aVisitor)._visitIRInstruction_(self);
  20553. return $1;
  20554. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInstruction)})},
  20555. args: ["aVisitor"],
  20556. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  20557. messageSends: ["visitIRInstruction:"],
  20558. referencedClasses: []
  20559. }),
  20560. smalltalk.IRInstruction);
  20561. smalltalk.addMethod(
  20562. smalltalk.method({
  20563. selector: "add:",
  20564. category: 'building',
  20565. fn: function (anObject){
  20566. var self=this;
  20567. return smalltalk.withContext(function($ctx1) {
  20568. var $1;
  20569. _st(anObject)._parent_(self);
  20570. $1=_st(self._instructions())._add_(anObject);
  20571. return $1;
  20572. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.IRInstruction)})},
  20573. args: ["anObject"],
  20574. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  20575. messageSends: ["parent:", "add:", "instructions"],
  20576. referencedClasses: []
  20577. }),
  20578. smalltalk.IRInstruction);
  20579. smalltalk.addMethod(
  20580. smalltalk.method({
  20581. selector: "canBeAssigned",
  20582. category: 'testing',
  20583. fn: function (){
  20584. var self=this;
  20585. return smalltalk.withContext(function($ctx1) {
  20586. return true;
  20587. }, function($ctx1) {$ctx1.fill(self,"canBeAssigned",{},smalltalk.IRInstruction)})},
  20588. args: [],
  20589. source: "canBeAssigned\x0a\x09^ true",
  20590. messageSends: [],
  20591. referencedClasses: []
  20592. }),
  20593. smalltalk.IRInstruction);
  20594. smalltalk.addMethod(
  20595. smalltalk.method({
  20596. selector: "instructions",
  20597. category: 'accessing',
  20598. fn: function (){
  20599. var self=this;
  20600. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  20601. return smalltalk.withContext(function($ctx1) {
  20602. var $2,$1;
  20603. $2=self["@instructions"];
  20604. if(($receiver = $2) == nil || $receiver == undefined){
  20605. self["@instructions"]=_st($OrderedCollection())._new();
  20606. $1=self["@instructions"];
  20607. } else {
  20608. $1=$2;
  20609. };
  20610. return $1;
  20611. }, function($ctx1) {$ctx1.fill(self,"instructions",{},smalltalk.IRInstruction)})},
  20612. args: [],
  20613. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  20614. messageSends: ["ifNil:", "new"],
  20615. referencedClasses: ["OrderedCollection"]
  20616. }),
  20617. smalltalk.IRInstruction);
  20618. smalltalk.addMethod(
  20619. smalltalk.method({
  20620. selector: "isClosure",
  20621. category: 'testing',
  20622. fn: function (){
  20623. var self=this;
  20624. return smalltalk.withContext(function($ctx1) {
  20625. return false;
  20626. }, function($ctx1) {$ctx1.fill(self,"isClosure",{},smalltalk.IRInstruction)})},
  20627. args: [],
  20628. source: "isClosure\x0a\x09^ false",
  20629. messageSends: [],
  20630. referencedClasses: []
  20631. }),
  20632. smalltalk.IRInstruction);
  20633. smalltalk.addMethod(
  20634. smalltalk.method({
  20635. selector: "isInlined",
  20636. category: 'testing',
  20637. fn: function (){
  20638. var self=this;
  20639. return smalltalk.withContext(function($ctx1) {
  20640. return false;
  20641. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInstruction)})},
  20642. args: [],
  20643. source: "isInlined\x0a\x09^ false",
  20644. messageSends: [],
  20645. referencedClasses: []
  20646. }),
  20647. smalltalk.IRInstruction);
  20648. smalltalk.addMethod(
  20649. smalltalk.method({
  20650. selector: "isLocalReturn",
  20651. category: 'testing',
  20652. fn: function (){
  20653. var self=this;
  20654. return smalltalk.withContext(function($ctx1) {
  20655. return false;
  20656. }, function($ctx1) {$ctx1.fill(self,"isLocalReturn",{},smalltalk.IRInstruction)})},
  20657. args: [],
  20658. source: "isLocalReturn\x0a\x09^ false",
  20659. messageSends: [],
  20660. referencedClasses: []
  20661. }),
  20662. smalltalk.IRInstruction);
  20663. smalltalk.addMethod(
  20664. smalltalk.method({
  20665. selector: "isMethod",
  20666. category: 'testing',
  20667. fn: function (){
  20668. var self=this;
  20669. return smalltalk.withContext(function($ctx1) {
  20670. return false;
  20671. }, function($ctx1) {$ctx1.fill(self,"isMethod",{},smalltalk.IRInstruction)})},
  20672. args: [],
  20673. source: "isMethod\x0a\x09^ false",
  20674. messageSends: [],
  20675. referencedClasses: []
  20676. }),
  20677. smalltalk.IRInstruction);
  20678. smalltalk.addMethod(
  20679. smalltalk.method({
  20680. selector: "isReturn",
  20681. category: 'testing',
  20682. fn: function (){
  20683. var self=this;
  20684. return smalltalk.withContext(function($ctx1) {
  20685. return false;
  20686. }, function($ctx1) {$ctx1.fill(self,"isReturn",{},smalltalk.IRInstruction)})},
  20687. args: [],
  20688. source: "isReturn\x0a\x09^ false",
  20689. messageSends: [],
  20690. referencedClasses: []
  20691. }),
  20692. smalltalk.IRInstruction);
  20693. smalltalk.addMethod(
  20694. smalltalk.method({
  20695. selector: "isSend",
  20696. category: 'testing',
  20697. fn: function (){
  20698. var self=this;
  20699. return smalltalk.withContext(function($ctx1) {
  20700. return false;
  20701. }, function($ctx1) {$ctx1.fill(self,"isSend",{},smalltalk.IRInstruction)})},
  20702. args: [],
  20703. source: "isSend\x0a\x09^ false",
  20704. messageSends: [],
  20705. referencedClasses: []
  20706. }),
  20707. smalltalk.IRInstruction);
  20708. smalltalk.addMethod(
  20709. smalltalk.method({
  20710. selector: "isSequence",
  20711. category: 'testing',
  20712. fn: function (){
  20713. var self=this;
  20714. return smalltalk.withContext(function($ctx1) {
  20715. return false;
  20716. }, function($ctx1) {$ctx1.fill(self,"isSequence",{},smalltalk.IRInstruction)})},
  20717. args: [],
  20718. source: "isSequence\x0a\x09^ false",
  20719. messageSends: [],
  20720. referencedClasses: []
  20721. }),
  20722. smalltalk.IRInstruction);
  20723. smalltalk.addMethod(
  20724. smalltalk.method({
  20725. selector: "isTempDeclaration",
  20726. category: 'testing',
  20727. fn: function (){
  20728. var self=this;
  20729. return smalltalk.withContext(function($ctx1) {
  20730. return false;
  20731. }, function($ctx1) {$ctx1.fill(self,"isTempDeclaration",{},smalltalk.IRInstruction)})},
  20732. args: [],
  20733. source: "isTempDeclaration\x0a\x09^ false",
  20734. messageSends: [],
  20735. referencedClasses: []
  20736. }),
  20737. smalltalk.IRInstruction);
  20738. smalltalk.addMethod(
  20739. smalltalk.method({
  20740. selector: "isVariable",
  20741. category: 'testing',
  20742. fn: function (){
  20743. var self=this;
  20744. return smalltalk.withContext(function($ctx1) {
  20745. return false;
  20746. }, function($ctx1) {$ctx1.fill(self,"isVariable",{},smalltalk.IRInstruction)})},
  20747. args: [],
  20748. source: "isVariable\x0a\x09^ false",
  20749. messageSends: [],
  20750. referencedClasses: []
  20751. }),
  20752. smalltalk.IRInstruction);
  20753. smalltalk.addMethod(
  20754. smalltalk.method({
  20755. selector: "method",
  20756. category: 'accessing',
  20757. fn: function (){
  20758. var self=this;
  20759. return smalltalk.withContext(function($ctx1) {
  20760. var $1;
  20761. $1=_st(self._parent())._method();
  20762. return $1;
  20763. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.IRInstruction)})},
  20764. args: [],
  20765. source: "method\x0a\x09^ self parent method",
  20766. messageSends: ["method", "parent"],
  20767. referencedClasses: []
  20768. }),
  20769. smalltalk.IRInstruction);
  20770. smalltalk.addMethod(
  20771. smalltalk.method({
  20772. selector: "needsBoxingAsReceiver",
  20773. category: 'testing',
  20774. fn: function (){
  20775. var self=this;
  20776. return smalltalk.withContext(function($ctx1) {
  20777. return true;
  20778. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},smalltalk.IRInstruction)})},
  20779. args: [],
  20780. source: "needsBoxingAsReceiver\x0a\x09^ true",
  20781. messageSends: [],
  20782. referencedClasses: []
  20783. }),
  20784. smalltalk.IRInstruction);
  20785. smalltalk.addMethod(
  20786. smalltalk.method({
  20787. selector: "parent",
  20788. category: 'accessing',
  20789. fn: function (){
  20790. var self=this;
  20791. return smalltalk.withContext(function($ctx1) {
  20792. var $1;
  20793. $1=self["@parent"];
  20794. return $1;
  20795. }, function($ctx1) {$ctx1.fill(self,"parent",{},smalltalk.IRInstruction)})},
  20796. args: [],
  20797. source: "parent\x0a\x09^ parent",
  20798. messageSends: [],
  20799. referencedClasses: []
  20800. }),
  20801. smalltalk.IRInstruction);
  20802. smalltalk.addMethod(
  20803. smalltalk.method({
  20804. selector: "parent:",
  20805. category: 'accessing',
  20806. fn: function (anIRInstruction){
  20807. var self=this;
  20808. return smalltalk.withContext(function($ctx1) {
  20809. self["@parent"]=anIRInstruction;
  20810. return self}, function($ctx1) {$ctx1.fill(self,"parent:",{anIRInstruction:anIRInstruction},smalltalk.IRInstruction)})},
  20811. args: ["anIRInstruction"],
  20812. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  20813. messageSends: [],
  20814. referencedClasses: []
  20815. }),
  20816. smalltalk.IRInstruction);
  20817. smalltalk.addMethod(
  20818. smalltalk.method({
  20819. selector: "remove",
  20820. category: 'building',
  20821. fn: function (){
  20822. var self=this;
  20823. return smalltalk.withContext(function($ctx1) {
  20824. _st(self._parent())._remove_(self);
  20825. return self}, function($ctx1) {$ctx1.fill(self,"remove",{},smalltalk.IRInstruction)})},
  20826. args: [],
  20827. source: "remove\x0a\x09self parent remove: self",
  20828. messageSends: ["remove:", "parent"],
  20829. referencedClasses: []
  20830. }),
  20831. smalltalk.IRInstruction);
  20832. smalltalk.addMethod(
  20833. smalltalk.method({
  20834. selector: "remove:",
  20835. category: 'building',
  20836. fn: function (anIRInstruction){
  20837. var self=this;
  20838. return smalltalk.withContext(function($ctx1) {
  20839. _st(self._instructions())._remove_(anIRInstruction);
  20840. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},smalltalk.IRInstruction)})},
  20841. args: ["anIRInstruction"],
  20842. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  20843. messageSends: ["remove:", "instructions"],
  20844. referencedClasses: []
  20845. }),
  20846. smalltalk.IRInstruction);
  20847. smalltalk.addMethod(
  20848. smalltalk.method({
  20849. selector: "replace:with:",
  20850. category: 'building',
  20851. fn: function (anIRInstruction,anotherIRInstruction){
  20852. var self=this;
  20853. return smalltalk.withContext(function($ctx1) {
  20854. _st(anotherIRInstruction)._parent_(self);
  20855. _st(self._instructions())._at_put_(_st(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  20856. return self}, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRInstruction)})},
  20857. args: ["anIRInstruction", "anotherIRInstruction"],
  20858. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  20859. messageSends: ["parent:", "at:put:", "indexOf:", "instructions"],
  20860. referencedClasses: []
  20861. }),
  20862. smalltalk.IRInstruction);
  20863. smalltalk.addMethod(
  20864. smalltalk.method({
  20865. selector: "replaceWith:",
  20866. category: 'building',
  20867. fn: function (anIRInstruction){
  20868. var self=this;
  20869. return smalltalk.withContext(function($ctx1) {
  20870. _st(self._parent())._replace_with_(self,anIRInstruction);
  20871. return self}, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},smalltalk.IRInstruction)})},
  20872. args: ["anIRInstruction"],
  20873. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  20874. messageSends: ["replace:with:", "parent"],
  20875. referencedClasses: []
  20876. }),
  20877. smalltalk.IRInstruction);
  20878. smalltalk.addMethod(
  20879. smalltalk.method({
  20880. selector: "on:",
  20881. category: 'instance creation',
  20882. fn: function (aBuilder){
  20883. var self=this;
  20884. return smalltalk.withContext(function($ctx1) {
  20885. var $2,$3,$1;
  20886. $2=self._new();
  20887. _st($2)._builder_(aBuilder);
  20888. $3=_st($2)._yourself();
  20889. $1=$3;
  20890. return $1;
  20891. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},smalltalk.IRInstruction.klass)})},
  20892. args: ["aBuilder"],
  20893. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  20894. messageSends: ["builder:", "new", "yourself"],
  20895. referencedClasses: []
  20896. }),
  20897. smalltalk.IRInstruction.klass);
  20898. smalltalk.addClass('IRAssignment', smalltalk.IRInstruction, [], 'Compiler-IR');
  20899. smalltalk.addMethod(
  20900. smalltalk.method({
  20901. selector: "accept:",
  20902. category: 'visiting',
  20903. fn: function (aVisitor){
  20904. var self=this;
  20905. return smalltalk.withContext(function($ctx1) {
  20906. var $1;
  20907. $1=_st(aVisitor)._visitIRAssignment_(self);
  20908. return $1;
  20909. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRAssignment)})},
  20910. args: ["aVisitor"],
  20911. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  20912. messageSends: ["visitIRAssignment:"],
  20913. referencedClasses: []
  20914. }),
  20915. smalltalk.IRAssignment);
  20916. smalltalk.addClass('IRDynamicArray', smalltalk.IRInstruction, [], 'Compiler-IR');
  20917. smalltalk.addMethod(
  20918. smalltalk.method({
  20919. selector: "accept:",
  20920. category: 'visiting',
  20921. fn: function (aVisitor){
  20922. var self=this;
  20923. return smalltalk.withContext(function($ctx1) {
  20924. var $1;
  20925. $1=_st(aVisitor)._visitIRDynamicArray_(self);
  20926. return $1;
  20927. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRDynamicArray)})},
  20928. args: ["aVisitor"],
  20929. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  20930. messageSends: ["visitIRDynamicArray:"],
  20931. referencedClasses: []
  20932. }),
  20933. smalltalk.IRDynamicArray);
  20934. smalltalk.addClass('IRDynamicDictionary', smalltalk.IRInstruction, [], 'Compiler-IR');
  20935. smalltalk.addMethod(
  20936. smalltalk.method({
  20937. selector: "accept:",
  20938. category: 'visiting',
  20939. fn: function (aVisitor){
  20940. var self=this;
  20941. return smalltalk.withContext(function($ctx1) {
  20942. var $1;
  20943. $1=_st(aVisitor)._visitIRDynamicDictionary_(self);
  20944. return $1;
  20945. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRDynamicDictionary)})},
  20946. args: ["aVisitor"],
  20947. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  20948. messageSends: ["visitIRDynamicDictionary:"],
  20949. referencedClasses: []
  20950. }),
  20951. smalltalk.IRDynamicDictionary);
  20952. smalltalk.addClass('IRScopedInstruction', smalltalk.IRInstruction, ['scope'], 'Compiler-IR');
  20953. smalltalk.addMethod(
  20954. smalltalk.method({
  20955. selector: "scope",
  20956. category: 'accessing',
  20957. fn: function (){
  20958. var self=this;
  20959. return smalltalk.withContext(function($ctx1) {
  20960. var $1;
  20961. $1=self["@scope"];
  20962. return $1;
  20963. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.IRScopedInstruction)})},
  20964. args: [],
  20965. source: "scope\x0a\x09^ scope",
  20966. messageSends: [],
  20967. referencedClasses: []
  20968. }),
  20969. smalltalk.IRScopedInstruction);
  20970. smalltalk.addMethod(
  20971. smalltalk.method({
  20972. selector: "scope:",
  20973. category: 'accessing',
  20974. fn: function (aScope){
  20975. var self=this;
  20976. return smalltalk.withContext(function($ctx1) {
  20977. self["@scope"]=aScope;
  20978. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},smalltalk.IRScopedInstruction)})},
  20979. args: ["aScope"],
  20980. source: "scope: aScope\x0a\x09scope := aScope",
  20981. messageSends: [],
  20982. referencedClasses: []
  20983. }),
  20984. smalltalk.IRScopedInstruction);
  20985. smalltalk.addClass('IRClosureInstruction', smalltalk.IRScopedInstruction, ['arguments'], 'Compiler-IR');
  20986. smalltalk.addMethod(
  20987. smalltalk.method({
  20988. selector: "arguments",
  20989. category: 'accessing',
  20990. fn: function (){
  20991. var self=this;
  20992. return smalltalk.withContext(function($ctx1) {
  20993. var $2,$1;
  20994. $2=self["@arguments"];
  20995. if(($receiver = $2) == nil || $receiver == undefined){
  20996. $1=[];
  20997. } else {
  20998. $1=$2;
  20999. };
  21000. return $1;
  21001. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.IRClosureInstruction)})},
  21002. args: [],
  21003. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  21004. messageSends: ["ifNil:"],
  21005. referencedClasses: []
  21006. }),
  21007. smalltalk.IRClosureInstruction);
  21008. smalltalk.addMethod(
  21009. smalltalk.method({
  21010. selector: "arguments:",
  21011. category: 'accessing',
  21012. fn: function (aCollection){
  21013. var self=this;
  21014. return smalltalk.withContext(function($ctx1) {
  21015. self["@arguments"]=aCollection;
  21016. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.IRClosureInstruction)})},
  21017. args: ["aCollection"],
  21018. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  21019. messageSends: [],
  21020. referencedClasses: []
  21021. }),
  21022. smalltalk.IRClosureInstruction);
  21023. smalltalk.addMethod(
  21024. smalltalk.method({
  21025. selector: "locals",
  21026. category: 'accessing',
  21027. fn: function (){
  21028. var self=this;
  21029. return smalltalk.withContext(function($ctx1) {
  21030. var $2,$3,$1;
  21031. $2=_st(self._arguments())._copy();
  21032. _st($2)._addAll_(_st(self._tempDeclarations())._collect_((function(each){
  21033. return smalltalk.withContext(function($ctx2) {
  21034. return _st(each)._name();
  21035. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  21036. $3=_st($2)._yourself();
  21037. $1=$3;
  21038. return $1;
  21039. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.IRClosureInstruction)})},
  21040. args: [],
  21041. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  21042. messageSends: ["addAll:", "collect:", "name", "tempDeclarations", "copy", "arguments", "yourself"],
  21043. referencedClasses: []
  21044. }),
  21045. smalltalk.IRClosureInstruction);
  21046. smalltalk.addMethod(
  21047. smalltalk.method({
  21048. selector: "scope:",
  21049. category: 'accessing',
  21050. fn: function (aScope){
  21051. var self=this;
  21052. return smalltalk.withContext(function($ctx1) {
  21053. smalltalk.IRScopedInstruction.fn.prototype._scope_.apply(_st(self), [aScope]);
  21054. _st(aScope)._instruction_(self);
  21055. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},smalltalk.IRClosureInstruction)})},
  21056. args: ["aScope"],
  21057. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  21058. messageSends: ["scope:", "instruction:"],
  21059. referencedClasses: []
  21060. }),
  21061. smalltalk.IRClosureInstruction);
  21062. smalltalk.addMethod(
  21063. smalltalk.method({
  21064. selector: "tempDeclarations",
  21065. category: 'accessing',
  21066. fn: function (){
  21067. var self=this;
  21068. return smalltalk.withContext(function($ctx1) {
  21069. var $1;
  21070. $1=_st(self._instructions())._select_((function(each){
  21071. return smalltalk.withContext(function($ctx2) {
  21072. return _st(each)._isTempDeclaration();
  21073. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  21074. return $1;
  21075. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},smalltalk.IRClosureInstruction)})},
  21076. args: [],
  21077. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  21078. messageSends: ["select:", "isTempDeclaration", "instructions"],
  21079. referencedClasses: []
  21080. }),
  21081. smalltalk.IRClosureInstruction);
  21082. smalltalk.addClass('IRClosure', smalltalk.IRClosureInstruction, [], 'Compiler-IR');
  21083. smalltalk.addMethod(
  21084. smalltalk.method({
  21085. selector: "accept:",
  21086. category: 'visiting',
  21087. fn: function (aVisitor){
  21088. var self=this;
  21089. return smalltalk.withContext(function($ctx1) {
  21090. var $1;
  21091. $1=_st(aVisitor)._visitIRClosure_(self);
  21092. return $1;
  21093. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRClosure)})},
  21094. args: ["aVisitor"],
  21095. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  21096. messageSends: ["visitIRClosure:"],
  21097. referencedClasses: []
  21098. }),
  21099. smalltalk.IRClosure);
  21100. smalltalk.addMethod(
  21101. smalltalk.method({
  21102. selector: "isClosure",
  21103. category: 'testing',
  21104. fn: function (){
  21105. var self=this;
  21106. return smalltalk.withContext(function($ctx1) {
  21107. return true;
  21108. }, function($ctx1) {$ctx1.fill(self,"isClosure",{},smalltalk.IRClosure)})},
  21109. args: [],
  21110. source: "isClosure\x0a\x09^ true",
  21111. messageSends: [],
  21112. referencedClasses: []
  21113. }),
  21114. smalltalk.IRClosure);
  21115. smalltalk.addMethod(
  21116. smalltalk.method({
  21117. selector: "sequence",
  21118. category: 'accessing',
  21119. fn: function (){
  21120. var self=this;
  21121. return smalltalk.withContext(function($ctx1) {
  21122. var $1;
  21123. $1=_st(self._instructions())._last();
  21124. return $1;
  21125. }, function($ctx1) {$ctx1.fill(self,"sequence",{},smalltalk.IRClosure)})},
  21126. args: [],
  21127. source: "sequence\x0a\x09^ self instructions last",
  21128. messageSends: ["last", "instructions"],
  21129. referencedClasses: []
  21130. }),
  21131. smalltalk.IRClosure);
  21132. smalltalk.addClass('IRMethod', smalltalk.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'messageSends', 'superSends', 'internalVariables'], 'Compiler-IR');
  21133. smalltalk.IRMethod.comment="I am a method instruction";
  21134. smalltalk.addMethod(
  21135. smalltalk.method({
  21136. selector: "accept:",
  21137. category: 'visiting',
  21138. fn: function (aVisitor){
  21139. var self=this;
  21140. return smalltalk.withContext(function($ctx1) {
  21141. var $1;
  21142. $1=_st(aVisitor)._visitIRMethod_(self);
  21143. return $1;
  21144. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRMethod)})},
  21145. args: ["aVisitor"],
  21146. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  21147. messageSends: ["visitIRMethod:"],
  21148. referencedClasses: []
  21149. }),
  21150. smalltalk.IRMethod);
  21151. smalltalk.addMethod(
  21152. smalltalk.method({
  21153. selector: "classReferences",
  21154. category: 'accessing',
  21155. fn: function (){
  21156. var self=this;
  21157. return smalltalk.withContext(function($ctx1) {
  21158. var $1;
  21159. $1=self["@classReferences"];
  21160. return $1;
  21161. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},smalltalk.IRMethod)})},
  21162. args: [],
  21163. source: "classReferences\x0a\x09^ classReferences",
  21164. messageSends: [],
  21165. referencedClasses: []
  21166. }),
  21167. smalltalk.IRMethod);
  21168. smalltalk.addMethod(
  21169. smalltalk.method({
  21170. selector: "classReferences:",
  21171. category: 'accessing',
  21172. fn: function (aCollection){
  21173. var self=this;
  21174. return smalltalk.withContext(function($ctx1) {
  21175. self["@classReferences"]=aCollection;
  21176. return self}, function($ctx1) {$ctx1.fill(self,"classReferences:",{aCollection:aCollection},smalltalk.IRMethod)})},
  21177. args: ["aCollection"],
  21178. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  21179. messageSends: [],
  21180. referencedClasses: []
  21181. }),
  21182. smalltalk.IRMethod);
  21183. smalltalk.addMethod(
  21184. smalltalk.method({
  21185. selector: "internalVariables",
  21186. category: 'accessing',
  21187. fn: function (){
  21188. var self=this;
  21189. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  21190. return smalltalk.withContext(function($ctx1) {
  21191. var $2,$1;
  21192. $2=self["@internalVariables"];
  21193. if(($receiver = $2) == nil || $receiver == undefined){
  21194. self["@internalVariables"]=_st($Set())._new();
  21195. $1=self["@internalVariables"];
  21196. } else {
  21197. $1=$2;
  21198. };
  21199. return $1;
  21200. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},smalltalk.IRMethod)})},
  21201. args: [],
  21202. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  21203. messageSends: ["ifNil:", "new"],
  21204. referencedClasses: ["Set"]
  21205. }),
  21206. smalltalk.IRMethod);
  21207. smalltalk.addMethod(
  21208. smalltalk.method({
  21209. selector: "isMethod",
  21210. category: 'accessing',
  21211. fn: function (){
  21212. var self=this;
  21213. return smalltalk.withContext(function($ctx1) {
  21214. return true;
  21215. }, function($ctx1) {$ctx1.fill(self,"isMethod",{},smalltalk.IRMethod)})},
  21216. args: [],
  21217. source: "isMethod\x0a\x09^ true",
  21218. messageSends: [],
  21219. referencedClasses: []
  21220. }),
  21221. smalltalk.IRMethod);
  21222. smalltalk.addMethod(
  21223. smalltalk.method({
  21224. selector: "messageSends",
  21225. category: 'accessing',
  21226. fn: function (){
  21227. var self=this;
  21228. return smalltalk.withContext(function($ctx1) {
  21229. var $1;
  21230. $1=self["@messageSends"];
  21231. return $1;
  21232. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.IRMethod)})},
  21233. args: [],
  21234. source: "messageSends\x0a\x09^ messageSends",
  21235. messageSends: [],
  21236. referencedClasses: []
  21237. }),
  21238. smalltalk.IRMethod);
  21239. smalltalk.addMethod(
  21240. smalltalk.method({
  21241. selector: "messageSends:",
  21242. category: 'accessing',
  21243. fn: function (aCollection){
  21244. var self=this;
  21245. return smalltalk.withContext(function($ctx1) {
  21246. self["@messageSends"]=aCollection;
  21247. return self}, function($ctx1) {$ctx1.fill(self,"messageSends:",{aCollection:aCollection},smalltalk.IRMethod)})},
  21248. args: ["aCollection"],
  21249. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  21250. messageSends: [],
  21251. referencedClasses: []
  21252. }),
  21253. smalltalk.IRMethod);
  21254. smalltalk.addMethod(
  21255. smalltalk.method({
  21256. selector: "method",
  21257. category: 'accessing',
  21258. fn: function (){
  21259. var self=this;
  21260. return smalltalk.withContext(function($ctx1) {
  21261. var $1;
  21262. $1=self;
  21263. return $1;
  21264. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.IRMethod)})},
  21265. args: [],
  21266. source: "method\x0a\x09^ self",
  21267. messageSends: [],
  21268. referencedClasses: []
  21269. }),
  21270. smalltalk.IRMethod);
  21271. smalltalk.addMethod(
  21272. smalltalk.method({
  21273. selector: "selector",
  21274. category: 'accessing',
  21275. fn: function (){
  21276. var self=this;
  21277. return smalltalk.withContext(function($ctx1) {
  21278. var $1;
  21279. $1=self["@selector"];
  21280. return $1;
  21281. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.IRMethod)})},
  21282. args: [],
  21283. source: "selector\x0a\x09^ selector",
  21284. messageSends: [],
  21285. referencedClasses: []
  21286. }),
  21287. smalltalk.IRMethod);
  21288. smalltalk.addMethod(
  21289. smalltalk.method({
  21290. selector: "selector:",
  21291. category: 'accessing',
  21292. fn: function (aString){
  21293. var self=this;
  21294. return smalltalk.withContext(function($ctx1) {
  21295. self["@selector"]=aString;
  21296. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.IRMethod)})},
  21297. args: ["aString"],
  21298. source: "selector: aString\x0a\x09selector := aString",
  21299. messageSends: [],
  21300. referencedClasses: []
  21301. }),
  21302. smalltalk.IRMethod);
  21303. smalltalk.addMethod(
  21304. smalltalk.method({
  21305. selector: "source",
  21306. category: 'accessing',
  21307. fn: function (){
  21308. var self=this;
  21309. return smalltalk.withContext(function($ctx1) {
  21310. var $1;
  21311. $1=self["@source"];
  21312. return $1;
  21313. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.IRMethod)})},
  21314. args: [],
  21315. source: "source\x0a\x09^ source",
  21316. messageSends: [],
  21317. referencedClasses: []
  21318. }),
  21319. smalltalk.IRMethod);
  21320. smalltalk.addMethod(
  21321. smalltalk.method({
  21322. selector: "source:",
  21323. category: 'accessing',
  21324. fn: function (aString){
  21325. var self=this;
  21326. return smalltalk.withContext(function($ctx1) {
  21327. self["@source"]=aString;
  21328. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.IRMethod)})},
  21329. args: ["aString"],
  21330. source: "source: aString\x0a\x09source := aString",
  21331. messageSends: [],
  21332. referencedClasses: []
  21333. }),
  21334. smalltalk.IRMethod);
  21335. smalltalk.addMethod(
  21336. smalltalk.method({
  21337. selector: "superSends",
  21338. category: 'accessing',
  21339. fn: function (){
  21340. var self=this;
  21341. return smalltalk.withContext(function($ctx1) {
  21342. var $1;
  21343. $1=self["@superSends"];
  21344. return $1;
  21345. }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.IRMethod)})},
  21346. args: [],
  21347. source: "superSends\x0a\x09^ superSends",
  21348. messageSends: [],
  21349. referencedClasses: []
  21350. }),
  21351. smalltalk.IRMethod);
  21352. smalltalk.addMethod(
  21353. smalltalk.method({
  21354. selector: "superSends:",
  21355. category: 'accessing',
  21356. fn: function (aCollection){
  21357. var self=this;
  21358. return smalltalk.withContext(function($ctx1) {
  21359. self["@superSends"]=aCollection;
  21360. return self}, function($ctx1) {$ctx1.fill(self,"superSends:",{aCollection:aCollection},smalltalk.IRMethod)})},
  21361. args: ["aCollection"],
  21362. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  21363. messageSends: [],
  21364. referencedClasses: []
  21365. }),
  21366. smalltalk.IRMethod);
  21367. smalltalk.addMethod(
  21368. smalltalk.method({
  21369. selector: "theClass",
  21370. category: 'accessing',
  21371. fn: function (){
  21372. var self=this;
  21373. return smalltalk.withContext(function($ctx1) {
  21374. var $1;
  21375. $1=self["@theClass"];
  21376. return $1;
  21377. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.IRMethod)})},
  21378. args: [],
  21379. source: "theClass\x0a\x09^ theClass",
  21380. messageSends: [],
  21381. referencedClasses: []
  21382. }),
  21383. smalltalk.IRMethod);
  21384. smalltalk.addMethod(
  21385. smalltalk.method({
  21386. selector: "theClass:",
  21387. category: 'accessing',
  21388. fn: function (aClass){
  21389. var self=this;
  21390. return smalltalk.withContext(function($ctx1) {
  21391. self["@theClass"]=aClass;
  21392. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.IRMethod)})},
  21393. args: ["aClass"],
  21394. source: "theClass: aClass\x0a\x09theClass := aClass",
  21395. messageSends: [],
  21396. referencedClasses: []
  21397. }),
  21398. smalltalk.IRMethod);
  21399. smalltalk.addClass('IRReturn', smalltalk.IRScopedInstruction, [], 'Compiler-IR');
  21400. smalltalk.IRReturn.comment="I am a local return instruction.";
  21401. smalltalk.addMethod(
  21402. smalltalk.method({
  21403. selector: "accept:",
  21404. category: 'visiting',
  21405. fn: function (aVisitor){
  21406. var self=this;
  21407. return smalltalk.withContext(function($ctx1) {
  21408. var $1;
  21409. $1=_st(aVisitor)._visitIRReturn_(self);
  21410. return $1;
  21411. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRReturn)})},
  21412. args: ["aVisitor"],
  21413. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  21414. messageSends: ["visitIRReturn:"],
  21415. referencedClasses: []
  21416. }),
  21417. smalltalk.IRReturn);
  21418. smalltalk.addMethod(
  21419. smalltalk.method({
  21420. selector: "canBeAssigned",
  21421. category: 'testing',
  21422. fn: function (){
  21423. var self=this;
  21424. return smalltalk.withContext(function($ctx1) {
  21425. return false;
  21426. }, function($ctx1) {$ctx1.fill(self,"canBeAssigned",{},smalltalk.IRReturn)})},
  21427. args: [],
  21428. source: "canBeAssigned\x0a\x09^ false",
  21429. messageSends: [],
  21430. referencedClasses: []
  21431. }),
  21432. smalltalk.IRReturn);
  21433. smalltalk.addMethod(
  21434. smalltalk.method({
  21435. selector: "isBlockReturn",
  21436. category: 'testing',
  21437. fn: function (){
  21438. var self=this;
  21439. return smalltalk.withContext(function($ctx1) {
  21440. return false;
  21441. }, function($ctx1) {$ctx1.fill(self,"isBlockReturn",{},smalltalk.IRReturn)})},
  21442. args: [],
  21443. source: "isBlockReturn\x0a\x09^ false",
  21444. messageSends: [],
  21445. referencedClasses: []
  21446. }),
  21447. smalltalk.IRReturn);
  21448. smalltalk.addMethod(
  21449. smalltalk.method({
  21450. selector: "isLocalReturn",
  21451. category: 'testing',
  21452. fn: function (){
  21453. var self=this;
  21454. return smalltalk.withContext(function($ctx1) {
  21455. return true;
  21456. }, function($ctx1) {$ctx1.fill(self,"isLocalReturn",{},smalltalk.IRReturn)})},
  21457. args: [],
  21458. source: "isLocalReturn\x0a\x09^ true",
  21459. messageSends: [],
  21460. referencedClasses: []
  21461. }),
  21462. smalltalk.IRReturn);
  21463. smalltalk.addMethod(
  21464. smalltalk.method({
  21465. selector: "isNonLocalReturn",
  21466. category: 'testing',
  21467. fn: function (){
  21468. var self=this;
  21469. return smalltalk.withContext(function($ctx1) {
  21470. var $1;
  21471. $1=_st(self._isLocalReturn())._not();
  21472. return $1;
  21473. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},smalltalk.IRReturn)})},
  21474. args: [],
  21475. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  21476. messageSends: ["not", "isLocalReturn"],
  21477. referencedClasses: []
  21478. }),
  21479. smalltalk.IRReturn);
  21480. smalltalk.addMethod(
  21481. smalltalk.method({
  21482. selector: "isReturn",
  21483. category: 'testing',
  21484. fn: function (){
  21485. var self=this;
  21486. return smalltalk.withContext(function($ctx1) {
  21487. return true;
  21488. }, function($ctx1) {$ctx1.fill(self,"isReturn",{},smalltalk.IRReturn)})},
  21489. args: [],
  21490. source: "isReturn\x0a\x09^ true",
  21491. messageSends: [],
  21492. referencedClasses: []
  21493. }),
  21494. smalltalk.IRReturn);
  21495. smalltalk.addClass('IRBlockReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  21496. smalltalk.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  21497. smalltalk.addMethod(
  21498. smalltalk.method({
  21499. selector: "accept:",
  21500. category: 'visiting',
  21501. fn: function (aVisitor){
  21502. var self=this;
  21503. return smalltalk.withContext(function($ctx1) {
  21504. var $1;
  21505. $1=_st(aVisitor)._visitIRBlockReturn_(self);
  21506. return $1;
  21507. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRBlockReturn)})},
  21508. args: ["aVisitor"],
  21509. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  21510. messageSends: ["visitIRBlockReturn:"],
  21511. referencedClasses: []
  21512. }),
  21513. smalltalk.IRBlockReturn);
  21514. smalltalk.addMethod(
  21515. smalltalk.method({
  21516. selector: "isBlockReturn",
  21517. category: 'testing',
  21518. fn: function (){
  21519. var self=this;
  21520. return smalltalk.withContext(function($ctx1) {
  21521. return true;
  21522. }, function($ctx1) {$ctx1.fill(self,"isBlockReturn",{},smalltalk.IRBlockReturn)})},
  21523. args: [],
  21524. source: "isBlockReturn\x0a\x09^ true",
  21525. messageSends: [],
  21526. referencedClasses: []
  21527. }),
  21528. smalltalk.IRBlockReturn);
  21529. smalltalk.addClass('IRNonLocalReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  21530. 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.";
  21531. smalltalk.addMethod(
  21532. smalltalk.method({
  21533. selector: "accept:",
  21534. category: 'visiting',
  21535. fn: function (aVisitor){
  21536. var self=this;
  21537. return smalltalk.withContext(function($ctx1) {
  21538. var $1;
  21539. $1=_st(aVisitor)._visitIRNonLocalReturn_(self);
  21540. return $1;
  21541. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRNonLocalReturn)})},
  21542. args: ["aVisitor"],
  21543. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  21544. messageSends: ["visitIRNonLocalReturn:"],
  21545. referencedClasses: []
  21546. }),
  21547. smalltalk.IRNonLocalReturn);
  21548. smalltalk.addMethod(
  21549. smalltalk.method({
  21550. selector: "isLocalReturn",
  21551. category: 'testing',
  21552. fn: function (){
  21553. var self=this;
  21554. return smalltalk.withContext(function($ctx1) {
  21555. return false;
  21556. }, function($ctx1) {$ctx1.fill(self,"isLocalReturn",{},smalltalk.IRNonLocalReturn)})},
  21557. args: [],
  21558. source: "isLocalReturn\x0a\x09^ false",
  21559. messageSends: [],
  21560. referencedClasses: []
  21561. }),
  21562. smalltalk.IRNonLocalReturn);
  21563. smalltalk.addClass('IRTempDeclaration', smalltalk.IRScopedInstruction, ['name'], 'Compiler-IR');
  21564. smalltalk.addMethod(
  21565. smalltalk.method({
  21566. selector: "accept:",
  21567. category: 'visiting',
  21568. fn: function (aVisitor){
  21569. var self=this;
  21570. return smalltalk.withContext(function($ctx1) {
  21571. var $1;
  21572. $1=_st(aVisitor)._visitIRTempDeclaration_(self);
  21573. return $1;
  21574. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRTempDeclaration)})},
  21575. args: ["aVisitor"],
  21576. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  21577. messageSends: ["visitIRTempDeclaration:"],
  21578. referencedClasses: []
  21579. }),
  21580. smalltalk.IRTempDeclaration);
  21581. smalltalk.addMethod(
  21582. smalltalk.method({
  21583. selector: "isTempDeclaration",
  21584. category: 'testing',
  21585. fn: function (){
  21586. var self=this;
  21587. return smalltalk.withContext(function($ctx1) {
  21588. return true;
  21589. }, function($ctx1) {$ctx1.fill(self,"isTempDeclaration",{},smalltalk.IRTempDeclaration)})},
  21590. args: [],
  21591. source: "isTempDeclaration\x0a\x09^ true",
  21592. messageSends: [],
  21593. referencedClasses: []
  21594. }),
  21595. smalltalk.IRTempDeclaration);
  21596. smalltalk.addMethod(
  21597. smalltalk.method({
  21598. selector: "name",
  21599. category: 'accessing',
  21600. fn: function (){
  21601. var self=this;
  21602. return smalltalk.withContext(function($ctx1) {
  21603. var $1;
  21604. $1=self["@name"];
  21605. return $1;
  21606. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.IRTempDeclaration)})},
  21607. args: [],
  21608. source: "name\x0a\x09^ name",
  21609. messageSends: [],
  21610. referencedClasses: []
  21611. }),
  21612. smalltalk.IRTempDeclaration);
  21613. smalltalk.addMethod(
  21614. smalltalk.method({
  21615. selector: "name:",
  21616. category: 'accessing',
  21617. fn: function (aString){
  21618. var self=this;
  21619. return smalltalk.withContext(function($ctx1) {
  21620. self["@name"]=aString;
  21621. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.IRTempDeclaration)})},
  21622. args: ["aString"],
  21623. source: "name: aString\x0a\x09name := aString",
  21624. messageSends: [],
  21625. referencedClasses: []
  21626. }),
  21627. smalltalk.IRTempDeclaration);
  21628. smalltalk.addClass('IRSend', smalltalk.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  21629. smalltalk.IRSend.comment="I am a message send instruction.";
  21630. smalltalk.addMethod(
  21631. smalltalk.method({
  21632. selector: "accept:",
  21633. category: 'visiting',
  21634. fn: function (aVisitor){
  21635. var self=this;
  21636. return smalltalk.withContext(function($ctx1) {
  21637. var $1;
  21638. $1=_st(aVisitor)._visitIRSend_(self);
  21639. return $1;
  21640. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRSend)})},
  21641. args: ["aVisitor"],
  21642. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  21643. messageSends: ["visitIRSend:"],
  21644. referencedClasses: []
  21645. }),
  21646. smalltalk.IRSend);
  21647. smalltalk.addMethod(
  21648. smalltalk.method({
  21649. selector: "classSend",
  21650. category: 'accessing',
  21651. fn: function (){
  21652. var self=this;
  21653. return smalltalk.withContext(function($ctx1) {
  21654. var $1;
  21655. $1=self["@classSend"];
  21656. return $1;
  21657. }, function($ctx1) {$ctx1.fill(self,"classSend",{},smalltalk.IRSend)})},
  21658. args: [],
  21659. source: "classSend\x0a\x09^ classSend",
  21660. messageSends: [],
  21661. referencedClasses: []
  21662. }),
  21663. smalltalk.IRSend);
  21664. smalltalk.addMethod(
  21665. smalltalk.method({
  21666. selector: "classSend:",
  21667. category: 'accessing',
  21668. fn: function (aClass){
  21669. var self=this;
  21670. return smalltalk.withContext(function($ctx1) {
  21671. self["@classSend"]=aClass;
  21672. return self}, function($ctx1) {$ctx1.fill(self,"classSend:",{aClass:aClass},smalltalk.IRSend)})},
  21673. args: ["aClass"],
  21674. source: "classSend: aClass\x0a\x09classSend := aClass",
  21675. messageSends: [],
  21676. referencedClasses: []
  21677. }),
  21678. smalltalk.IRSend);
  21679. smalltalk.addMethod(
  21680. smalltalk.method({
  21681. selector: "index",
  21682. category: 'accessing',
  21683. fn: function (){
  21684. var self=this;
  21685. return smalltalk.withContext(function($ctx1) {
  21686. var $1;
  21687. $1=self["@index"];
  21688. return $1;
  21689. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.IRSend)})},
  21690. args: [],
  21691. source: "index\x0a\x09^ index",
  21692. messageSends: [],
  21693. referencedClasses: []
  21694. }),
  21695. smalltalk.IRSend);
  21696. smalltalk.addMethod(
  21697. smalltalk.method({
  21698. selector: "index:",
  21699. category: 'accessing',
  21700. fn: function (anInteger){
  21701. var self=this;
  21702. return smalltalk.withContext(function($ctx1) {
  21703. self["@index"]=anInteger;
  21704. return self}, function($ctx1) {$ctx1.fill(self,"index:",{anInteger:anInteger},smalltalk.IRSend)})},
  21705. args: ["anInteger"],
  21706. source: "index: anInteger\x0a\x09index := anInteger",
  21707. messageSends: [],
  21708. referencedClasses: []
  21709. }),
  21710. smalltalk.IRSend);
  21711. smalltalk.addMethod(
  21712. smalltalk.method({
  21713. selector: "isSend",
  21714. category: 'testing',
  21715. fn: function (){
  21716. var self=this;
  21717. return smalltalk.withContext(function($ctx1) {
  21718. return true;
  21719. }, function($ctx1) {$ctx1.fill(self,"isSend",{},smalltalk.IRSend)})},
  21720. args: [],
  21721. source: "isSend\x0a\x09^ true",
  21722. messageSends: [],
  21723. referencedClasses: []
  21724. }),
  21725. smalltalk.IRSend);
  21726. smalltalk.addMethod(
  21727. smalltalk.method({
  21728. selector: "selector",
  21729. category: 'accessing',
  21730. fn: function (){
  21731. var self=this;
  21732. return smalltalk.withContext(function($ctx1) {
  21733. var $1;
  21734. $1=self["@selector"];
  21735. return $1;
  21736. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.IRSend)})},
  21737. args: [],
  21738. source: "selector\x0a\x09^ selector",
  21739. messageSends: [],
  21740. referencedClasses: []
  21741. }),
  21742. smalltalk.IRSend);
  21743. smalltalk.addMethod(
  21744. smalltalk.method({
  21745. selector: "selector:",
  21746. category: 'accessing',
  21747. fn: function (aString){
  21748. var self=this;
  21749. return smalltalk.withContext(function($ctx1) {
  21750. self["@selector"]=aString;
  21751. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.IRSend)})},
  21752. args: ["aString"],
  21753. source: "selector: aString\x0a\x09selector := aString",
  21754. messageSends: [],
  21755. referencedClasses: []
  21756. }),
  21757. smalltalk.IRSend);
  21758. smalltalk.addClass('IRSequence', smalltalk.IRInstruction, [], 'Compiler-IR');
  21759. smalltalk.addMethod(
  21760. smalltalk.method({
  21761. selector: "accept:",
  21762. category: 'visiting',
  21763. fn: function (aVisitor){
  21764. var self=this;
  21765. return smalltalk.withContext(function($ctx1) {
  21766. var $1;
  21767. $1=_st(aVisitor)._visitIRSequence_(self);
  21768. return $1;
  21769. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRSequence)})},
  21770. args: ["aVisitor"],
  21771. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  21772. messageSends: ["visitIRSequence:"],
  21773. referencedClasses: []
  21774. }),
  21775. smalltalk.IRSequence);
  21776. smalltalk.addMethod(
  21777. smalltalk.method({
  21778. selector: "isSequence",
  21779. category: 'testing',
  21780. fn: function (){
  21781. var self=this;
  21782. return smalltalk.withContext(function($ctx1) {
  21783. return true;
  21784. }, function($ctx1) {$ctx1.fill(self,"isSequence",{},smalltalk.IRSequence)})},
  21785. args: [],
  21786. source: "isSequence\x0a\x09^ true",
  21787. messageSends: [],
  21788. referencedClasses: []
  21789. }),
  21790. smalltalk.IRSequence);
  21791. smalltalk.addClass('IRBlockSequence', smalltalk.IRSequence, [], 'Compiler-IR');
  21792. smalltalk.addMethod(
  21793. smalltalk.method({
  21794. selector: "accept:",
  21795. category: 'visiting',
  21796. fn: function (aVisitor){
  21797. var self=this;
  21798. return smalltalk.withContext(function($ctx1) {
  21799. var $1;
  21800. $1=_st(aVisitor)._visitIRBlockSequence_(self);
  21801. return $1;
  21802. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRBlockSequence)})},
  21803. args: ["aVisitor"],
  21804. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  21805. messageSends: ["visitIRBlockSequence:"],
  21806. referencedClasses: []
  21807. }),
  21808. smalltalk.IRBlockSequence);
  21809. smalltalk.addClass('IRValue', smalltalk.IRInstruction, ['value'], 'Compiler-IR');
  21810. smalltalk.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  21811. smalltalk.addMethod(
  21812. smalltalk.method({
  21813. selector: "accept:",
  21814. category: 'visiting',
  21815. fn: function (aVisitor){
  21816. var self=this;
  21817. return smalltalk.withContext(function($ctx1) {
  21818. var $1;
  21819. $1=_st(aVisitor)._visitIRValue_(self);
  21820. return $1;
  21821. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRValue)})},
  21822. args: ["aVisitor"],
  21823. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  21824. messageSends: ["visitIRValue:"],
  21825. referencedClasses: []
  21826. }),
  21827. smalltalk.IRValue);
  21828. smalltalk.addMethod(
  21829. smalltalk.method({
  21830. selector: "needsBoxingAsReceiver",
  21831. category: 'testing',
  21832. fn: function (){
  21833. var self=this;
  21834. return smalltalk.withContext(function($ctx1) {
  21835. return false;
  21836. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},smalltalk.IRValue)})},
  21837. args: [],
  21838. source: "needsBoxingAsReceiver\x0a\x09^ false",
  21839. messageSends: [],
  21840. referencedClasses: []
  21841. }),
  21842. smalltalk.IRValue);
  21843. smalltalk.addMethod(
  21844. smalltalk.method({
  21845. selector: "value",
  21846. category: 'accessing',
  21847. fn: function (){
  21848. var self=this;
  21849. return smalltalk.withContext(function($ctx1) {
  21850. var $1;
  21851. $1=self["@value"];
  21852. return $1;
  21853. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.IRValue)})},
  21854. args: [],
  21855. source: "value\x0a\x09^value",
  21856. messageSends: [],
  21857. referencedClasses: []
  21858. }),
  21859. smalltalk.IRValue);
  21860. smalltalk.addMethod(
  21861. smalltalk.method({
  21862. selector: "value:",
  21863. category: 'accessing',
  21864. fn: function (aString){
  21865. var self=this;
  21866. return smalltalk.withContext(function($ctx1) {
  21867. self["@value"]=aString;
  21868. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aString:aString},smalltalk.IRValue)})},
  21869. args: ["aString"],
  21870. source: "value: aString\x0a\x09value := aString",
  21871. messageSends: [],
  21872. referencedClasses: []
  21873. }),
  21874. smalltalk.IRValue);
  21875. smalltalk.addClass('IRVariable', smalltalk.IRInstruction, ['variable'], 'Compiler-IR');
  21876. smalltalk.IRVariable.comment="I am a variable instruction.";
  21877. smalltalk.addMethod(
  21878. smalltalk.method({
  21879. selector: "accept:",
  21880. category: 'visiting',
  21881. fn: function (aVisitor){
  21882. var self=this;
  21883. return smalltalk.withContext(function($ctx1) {
  21884. var $1;
  21885. $1=_st(aVisitor)._visitIRVariable_(self);
  21886. return $1;
  21887. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRVariable)})},
  21888. args: ["aVisitor"],
  21889. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  21890. messageSends: ["visitIRVariable:"],
  21891. referencedClasses: []
  21892. }),
  21893. smalltalk.IRVariable);
  21894. smalltalk.addMethod(
  21895. smalltalk.method({
  21896. selector: "isVariable",
  21897. category: 'testing',
  21898. fn: function (){
  21899. var self=this;
  21900. return smalltalk.withContext(function($ctx1) {
  21901. return true;
  21902. }, function($ctx1) {$ctx1.fill(self,"isVariable",{},smalltalk.IRVariable)})},
  21903. args: [],
  21904. source: "isVariable\x0a\x09^ true",
  21905. messageSends: [],
  21906. referencedClasses: []
  21907. }),
  21908. smalltalk.IRVariable);
  21909. smalltalk.addMethod(
  21910. smalltalk.method({
  21911. selector: "needsBoxingAsReceiver",
  21912. category: 'testing',
  21913. fn: function (){
  21914. var self=this;
  21915. return smalltalk.withContext(function($ctx1) {
  21916. var $1;
  21917. $1=_st(_st(self._variable())._isPseudoVar())._not();
  21918. return $1;
  21919. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},smalltalk.IRVariable)})},
  21920. args: [],
  21921. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  21922. messageSends: ["not", "isPseudoVar", "variable"],
  21923. referencedClasses: []
  21924. }),
  21925. smalltalk.IRVariable);
  21926. smalltalk.addMethod(
  21927. smalltalk.method({
  21928. selector: "variable",
  21929. category: 'accessing',
  21930. fn: function (){
  21931. var self=this;
  21932. return smalltalk.withContext(function($ctx1) {
  21933. var $1;
  21934. $1=self["@variable"];
  21935. return $1;
  21936. }, function($ctx1) {$ctx1.fill(self,"variable",{},smalltalk.IRVariable)})},
  21937. args: [],
  21938. source: "variable\x0a\x09^ variable",
  21939. messageSends: [],
  21940. referencedClasses: []
  21941. }),
  21942. smalltalk.IRVariable);
  21943. smalltalk.addMethod(
  21944. smalltalk.method({
  21945. selector: "variable:",
  21946. category: 'accessing',
  21947. fn: function (aScopeVariable){
  21948. var self=this;
  21949. return smalltalk.withContext(function($ctx1) {
  21950. self["@variable"]=aScopeVariable;
  21951. return self}, function($ctx1) {$ctx1.fill(self,"variable:",{aScopeVariable:aScopeVariable},smalltalk.IRVariable)})},
  21952. args: ["aScopeVariable"],
  21953. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  21954. messageSends: [],
  21955. referencedClasses: []
  21956. }),
  21957. smalltalk.IRVariable);
  21958. smalltalk.addClass('IRVerbatim', smalltalk.IRInstruction, ['source'], 'Compiler-IR');
  21959. smalltalk.addMethod(
  21960. smalltalk.method({
  21961. selector: "accept:",
  21962. category: 'visiting',
  21963. fn: function (aVisitor){
  21964. var self=this;
  21965. return smalltalk.withContext(function($ctx1) {
  21966. var $1;
  21967. $1=_st(aVisitor)._visitIRVerbatim_(self);
  21968. return $1;
  21969. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRVerbatim)})},
  21970. args: ["aVisitor"],
  21971. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  21972. messageSends: ["visitIRVerbatim:"],
  21973. referencedClasses: []
  21974. }),
  21975. smalltalk.IRVerbatim);
  21976. smalltalk.addMethod(
  21977. smalltalk.method({
  21978. selector: "source",
  21979. category: 'accessing',
  21980. fn: function (){
  21981. var self=this;
  21982. return smalltalk.withContext(function($ctx1) {
  21983. var $1;
  21984. $1=self["@source"];
  21985. return $1;
  21986. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.IRVerbatim)})},
  21987. args: [],
  21988. source: "source\x0a\x09^ source",
  21989. messageSends: [],
  21990. referencedClasses: []
  21991. }),
  21992. smalltalk.IRVerbatim);
  21993. smalltalk.addMethod(
  21994. smalltalk.method({
  21995. selector: "source:",
  21996. category: 'accessing',
  21997. fn: function (aString){
  21998. var self=this;
  21999. return smalltalk.withContext(function($ctx1) {
  22000. self["@source"]=aString;
  22001. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.IRVerbatim)})},
  22002. args: ["aString"],
  22003. source: "source: aString\x0a\x09source := aString",
  22004. messageSends: [],
  22005. referencedClasses: []
  22006. }),
  22007. smalltalk.IRVerbatim);
  22008. smalltalk.addClass('IRVisitor', smalltalk.Object, [], 'Compiler-IR');
  22009. smalltalk.addMethod(
  22010. smalltalk.method({
  22011. selector: "visit:",
  22012. category: 'visiting',
  22013. fn: function (anIRInstruction){
  22014. var self=this;
  22015. return smalltalk.withContext(function($ctx1) {
  22016. var $1;
  22017. $1=_st(anIRInstruction)._accept_(self);
  22018. return $1;
  22019. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},smalltalk.IRVisitor)})},
  22020. args: ["anIRInstruction"],
  22021. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  22022. messageSends: ["accept:"],
  22023. referencedClasses: []
  22024. }),
  22025. smalltalk.IRVisitor);
  22026. smalltalk.addMethod(
  22027. smalltalk.method({
  22028. selector: "visitIRAssignment:",
  22029. category: 'visiting',
  22030. fn: function (anIRAssignment){
  22031. var self=this;
  22032. return smalltalk.withContext(function($ctx1) {
  22033. var $1;
  22034. $1=self._visitIRInstruction_(anIRAssignment);
  22035. return $1;
  22036. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRVisitor)})},
  22037. args: ["anIRAssignment"],
  22038. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  22039. messageSends: ["visitIRInstruction:"],
  22040. referencedClasses: []
  22041. }),
  22042. smalltalk.IRVisitor);
  22043. smalltalk.addMethod(
  22044. smalltalk.method({
  22045. selector: "visitIRBlockReturn:",
  22046. category: 'visiting',
  22047. fn: function (anIRBlockReturn){
  22048. var self=this;
  22049. return smalltalk.withContext(function($ctx1) {
  22050. var $1;
  22051. $1=self._visitIRReturn_(anIRBlockReturn);
  22052. return $1;
  22053. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},smalltalk.IRVisitor)})},
  22054. args: ["anIRBlockReturn"],
  22055. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  22056. messageSends: ["visitIRReturn:"],
  22057. referencedClasses: []
  22058. }),
  22059. smalltalk.IRVisitor);
  22060. smalltalk.addMethod(
  22061. smalltalk.method({
  22062. selector: "visitIRBlockSequence:",
  22063. category: 'visiting',
  22064. fn: function (anIRBlockSequence){
  22065. var self=this;
  22066. return smalltalk.withContext(function($ctx1) {
  22067. var $1;
  22068. $1=self._visitIRSequence_(anIRBlockSequence);
  22069. return $1;
  22070. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},smalltalk.IRVisitor)})},
  22071. args: ["anIRBlockSequence"],
  22072. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  22073. messageSends: ["visitIRSequence:"],
  22074. referencedClasses: []
  22075. }),
  22076. smalltalk.IRVisitor);
  22077. smalltalk.addMethod(
  22078. smalltalk.method({
  22079. selector: "visitIRClosure:",
  22080. category: 'visiting',
  22081. fn: function (anIRClosure){
  22082. var self=this;
  22083. return smalltalk.withContext(function($ctx1) {
  22084. var $1;
  22085. $1=self._visitIRInstruction_(anIRClosure);
  22086. return $1;
  22087. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},smalltalk.IRVisitor)})},
  22088. args: ["anIRClosure"],
  22089. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  22090. messageSends: ["visitIRInstruction:"],
  22091. referencedClasses: []
  22092. }),
  22093. smalltalk.IRVisitor);
  22094. smalltalk.addMethod(
  22095. smalltalk.method({
  22096. selector: "visitIRDynamicArray:",
  22097. category: 'visiting',
  22098. fn: function (anIRDynamicArray){
  22099. var self=this;
  22100. return smalltalk.withContext(function($ctx1) {
  22101. var $1;
  22102. $1=self._visitIRInstruction_(anIRDynamicArray);
  22103. return $1;
  22104. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},smalltalk.IRVisitor)})},
  22105. args: ["anIRDynamicArray"],
  22106. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  22107. messageSends: ["visitIRInstruction:"],
  22108. referencedClasses: []
  22109. }),
  22110. smalltalk.IRVisitor);
  22111. smalltalk.addMethod(
  22112. smalltalk.method({
  22113. selector: "visitIRDynamicDictionary:",
  22114. category: 'visiting',
  22115. fn: function (anIRDynamicDictionary){
  22116. var self=this;
  22117. return smalltalk.withContext(function($ctx1) {
  22118. var $1;
  22119. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  22120. return $1;
  22121. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},smalltalk.IRVisitor)})},
  22122. args: ["anIRDynamicDictionary"],
  22123. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  22124. messageSends: ["visitIRInstruction:"],
  22125. referencedClasses: []
  22126. }),
  22127. smalltalk.IRVisitor);
  22128. smalltalk.addMethod(
  22129. smalltalk.method({
  22130. selector: "visitIRInlinedClosure:",
  22131. category: 'visiting',
  22132. fn: function (anIRInlinedClosure){
  22133. var self=this;
  22134. return smalltalk.withContext(function($ctx1) {
  22135. var $1;
  22136. $1=self._visitIRClosure_(anIRInlinedClosure);
  22137. return $1;
  22138. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},smalltalk.IRVisitor)})},
  22139. args: ["anIRInlinedClosure"],
  22140. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  22141. messageSends: ["visitIRClosure:"],
  22142. referencedClasses: []
  22143. }),
  22144. smalltalk.IRVisitor);
  22145. smalltalk.addMethod(
  22146. smalltalk.method({
  22147. selector: "visitIRInlinedSequence:",
  22148. category: 'visiting',
  22149. fn: function (anIRInlinedSequence){
  22150. var self=this;
  22151. return smalltalk.withContext(function($ctx1) {
  22152. var $1;
  22153. $1=self._visitIRSequence_(anIRInlinedSequence);
  22154. return $1;
  22155. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},smalltalk.IRVisitor)})},
  22156. args: ["anIRInlinedSequence"],
  22157. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  22158. messageSends: ["visitIRSequence:"],
  22159. referencedClasses: []
  22160. }),
  22161. smalltalk.IRVisitor);
  22162. smalltalk.addMethod(
  22163. smalltalk.method({
  22164. selector: "visitIRInstruction:",
  22165. category: 'visiting',
  22166. fn: function (anIRInstruction){
  22167. var self=this;
  22168. return smalltalk.withContext(function($ctx1) {
  22169. var $1;
  22170. _st(_st(anIRInstruction)._instructions())._do_((function(each){
  22171. return smalltalk.withContext(function($ctx2) {
  22172. return self._visit_(each);
  22173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  22174. $1=anIRInstruction;
  22175. return $1;
  22176. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},smalltalk.IRVisitor)})},
  22177. args: ["anIRInstruction"],
  22178. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  22179. messageSends: ["do:", "visit:", "instructions"],
  22180. referencedClasses: []
  22181. }),
  22182. smalltalk.IRVisitor);
  22183. smalltalk.addMethod(
  22184. smalltalk.method({
  22185. selector: "visitIRMethod:",
  22186. category: 'visiting',
  22187. fn: function (anIRMethod){
  22188. var self=this;
  22189. return smalltalk.withContext(function($ctx1) {
  22190. var $1;
  22191. $1=self._visitIRInstruction_(anIRMethod);
  22192. return $1;
  22193. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},smalltalk.IRVisitor)})},
  22194. args: ["anIRMethod"],
  22195. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  22196. messageSends: ["visitIRInstruction:"],
  22197. referencedClasses: []
  22198. }),
  22199. smalltalk.IRVisitor);
  22200. smalltalk.addMethod(
  22201. smalltalk.method({
  22202. selector: "visitIRNonLocalReturn:",
  22203. category: 'visiting',
  22204. fn: function (anIRNonLocalReturn){
  22205. var self=this;
  22206. return smalltalk.withContext(function($ctx1) {
  22207. var $1;
  22208. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  22209. return $1;
  22210. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},smalltalk.IRVisitor)})},
  22211. args: ["anIRNonLocalReturn"],
  22212. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  22213. messageSends: ["visitIRInstruction:"],
  22214. referencedClasses: []
  22215. }),
  22216. smalltalk.IRVisitor);
  22217. smalltalk.addMethod(
  22218. smalltalk.method({
  22219. selector: "visitIRNonLocalReturnHandling:",
  22220. category: 'visiting',
  22221. fn: function (anIRNonLocalReturnHandling){
  22222. var self=this;
  22223. return smalltalk.withContext(function($ctx1) {
  22224. var $1;
  22225. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  22226. return $1;
  22227. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},smalltalk.IRVisitor)})},
  22228. args: ["anIRNonLocalReturnHandling"],
  22229. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  22230. messageSends: ["visitIRInstruction:"],
  22231. referencedClasses: []
  22232. }),
  22233. smalltalk.IRVisitor);
  22234. smalltalk.addMethod(
  22235. smalltalk.method({
  22236. selector: "visitIRReturn:",
  22237. category: 'visiting',
  22238. fn: function (anIRReturn){
  22239. var self=this;
  22240. return smalltalk.withContext(function($ctx1) {
  22241. var $1;
  22242. $1=self._visitIRInstruction_(anIRReturn);
  22243. return $1;
  22244. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},smalltalk.IRVisitor)})},
  22245. args: ["anIRReturn"],
  22246. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  22247. messageSends: ["visitIRInstruction:"],
  22248. referencedClasses: []
  22249. }),
  22250. smalltalk.IRVisitor);
  22251. smalltalk.addMethod(
  22252. smalltalk.method({
  22253. selector: "visitIRSend:",
  22254. category: 'visiting',
  22255. fn: function (anIRSend){
  22256. var self=this;
  22257. return smalltalk.withContext(function($ctx1) {
  22258. var $1;
  22259. $1=self._visitIRInstruction_(anIRSend);
  22260. return $1;
  22261. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},smalltalk.IRVisitor)})},
  22262. args: ["anIRSend"],
  22263. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  22264. messageSends: ["visitIRInstruction:"],
  22265. referencedClasses: []
  22266. }),
  22267. smalltalk.IRVisitor);
  22268. smalltalk.addMethod(
  22269. smalltalk.method({
  22270. selector: "visitIRSequence:",
  22271. category: 'visiting',
  22272. fn: function (anIRSequence){
  22273. var self=this;
  22274. return smalltalk.withContext(function($ctx1) {
  22275. var $1;
  22276. $1=self._visitIRInstruction_(anIRSequence);
  22277. return $1;
  22278. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},smalltalk.IRVisitor)})},
  22279. args: ["anIRSequence"],
  22280. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  22281. messageSends: ["visitIRInstruction:"],
  22282. referencedClasses: []
  22283. }),
  22284. smalltalk.IRVisitor);
  22285. smalltalk.addMethod(
  22286. smalltalk.method({
  22287. selector: "visitIRTempDeclaration:",
  22288. category: 'visiting',
  22289. fn: function (anIRTempDeclaration){
  22290. var self=this;
  22291. return smalltalk.withContext(function($ctx1) {
  22292. var $1;
  22293. $1=self._visitIRInstruction_(anIRTempDeclaration);
  22294. return $1;
  22295. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},smalltalk.IRVisitor)})},
  22296. args: ["anIRTempDeclaration"],
  22297. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  22298. messageSends: ["visitIRInstruction:"],
  22299. referencedClasses: []
  22300. }),
  22301. smalltalk.IRVisitor);
  22302. smalltalk.addMethod(
  22303. smalltalk.method({
  22304. selector: "visitIRValue:",
  22305. category: 'visiting',
  22306. fn: function (anIRValue){
  22307. var self=this;
  22308. return smalltalk.withContext(function($ctx1) {
  22309. var $1;
  22310. $1=self._visitIRInstruction_(anIRValue);
  22311. return $1;
  22312. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},smalltalk.IRVisitor)})},
  22313. args: ["anIRValue"],
  22314. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  22315. messageSends: ["visitIRInstruction:"],
  22316. referencedClasses: []
  22317. }),
  22318. smalltalk.IRVisitor);
  22319. smalltalk.addMethod(
  22320. smalltalk.method({
  22321. selector: "visitIRVariable:",
  22322. category: 'visiting',
  22323. fn: function (anIRVariable){
  22324. var self=this;
  22325. return smalltalk.withContext(function($ctx1) {
  22326. var $1;
  22327. $1=self._visitIRInstruction_(anIRVariable);
  22328. return $1;
  22329. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},smalltalk.IRVisitor)})},
  22330. args: ["anIRVariable"],
  22331. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  22332. messageSends: ["visitIRInstruction:"],
  22333. referencedClasses: []
  22334. }),
  22335. smalltalk.IRVisitor);
  22336. smalltalk.addMethod(
  22337. smalltalk.method({
  22338. selector: "visitIRVerbatim:",
  22339. category: 'visiting',
  22340. fn: function (anIRVerbatim){
  22341. var self=this;
  22342. return smalltalk.withContext(function($ctx1) {
  22343. var $1;
  22344. $1=self._visitIRInstruction_(anIRVerbatim);
  22345. return $1;
  22346. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},smalltalk.IRVisitor)})},
  22347. args: ["anIRVerbatim"],
  22348. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  22349. messageSends: ["visitIRInstruction:"],
  22350. referencedClasses: []
  22351. }),
  22352. smalltalk.IRVisitor);
  22353. smalltalk.addClass('IRJSTranslator', smalltalk.IRVisitor, ['stream'], 'Compiler-IR');
  22354. smalltalk.addMethod(
  22355. smalltalk.method({
  22356. selector: "contents",
  22357. category: 'accessing',
  22358. fn: function (){
  22359. var self=this;
  22360. return smalltalk.withContext(function($ctx1) {
  22361. var $1;
  22362. $1=_st(self._stream())._contents();
  22363. return $1;
  22364. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.IRJSTranslator)})},
  22365. args: [],
  22366. source: "contents\x0a\x09^ self stream contents",
  22367. messageSends: ["contents", "stream"],
  22368. referencedClasses: []
  22369. }),
  22370. smalltalk.IRJSTranslator);
  22371. smalltalk.addMethod(
  22372. smalltalk.method({
  22373. selector: "initialize",
  22374. category: 'initialization',
  22375. fn: function (){
  22376. var self=this;
  22377. function $JSStream(){return smalltalk.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  22378. return smalltalk.withContext(function($ctx1) {
  22379. smalltalk.IRVisitor.fn.prototype._initialize.apply(_st(self), []);
  22380. self["@stream"]=_st($JSStream())._new();
  22381. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.IRJSTranslator)})},
  22382. args: [],
  22383. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  22384. messageSends: ["initialize", "new"],
  22385. referencedClasses: ["JSStream"]
  22386. }),
  22387. smalltalk.IRJSTranslator);
  22388. smalltalk.addMethod(
  22389. smalltalk.method({
  22390. selector: "stream",
  22391. category: 'accessing',
  22392. fn: function (){
  22393. var self=this;
  22394. return smalltalk.withContext(function($ctx1) {
  22395. var $1;
  22396. $1=self["@stream"];
  22397. return $1;
  22398. }, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.IRJSTranslator)})},
  22399. args: [],
  22400. source: "stream\x0a\x09^ stream",
  22401. messageSends: [],
  22402. referencedClasses: []
  22403. }),
  22404. smalltalk.IRJSTranslator);
  22405. smalltalk.addMethod(
  22406. smalltalk.method({
  22407. selector: "stream:",
  22408. category: 'accessing',
  22409. fn: function (aStream){
  22410. var self=this;
  22411. return smalltalk.withContext(function($ctx1) {
  22412. self["@stream"]=aStream;
  22413. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.IRJSTranslator)})},
  22414. args: ["aStream"],
  22415. source: "stream: aStream\x0a\x09stream := aStream",
  22416. messageSends: [],
  22417. referencedClasses: []
  22418. }),
  22419. smalltalk.IRJSTranslator);
  22420. smalltalk.addMethod(
  22421. smalltalk.method({
  22422. selector: "visitIRAssignment:",
  22423. category: 'visiting',
  22424. fn: function (anIRAssignment){
  22425. var self=this;
  22426. return smalltalk.withContext(function($ctx1) {
  22427. self._visit_(_st(_st(anIRAssignment)._instructions())._first());
  22428. _st(self._stream())._nextPutAssignment();
  22429. self._visit_(_st(_st(anIRAssignment)._instructions())._last());
  22430. return self}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRJSTranslator)})},
  22431. args: ["anIRAssignment"],
  22432. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  22433. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  22434. referencedClasses: []
  22435. }),
  22436. smalltalk.IRJSTranslator);
  22437. smalltalk.addMethod(
  22438. smalltalk.method({
  22439. selector: "visitIRClosure:",
  22440. category: 'visiting',
  22441. fn: function (anIRClosure){
  22442. var self=this;
  22443. return smalltalk.withContext(function($ctx1) {
  22444. _st(self._stream())._nextPutClosureWith_arguments_((function(){
  22445. return smalltalk.withContext(function($ctx2) {
  22446. _st(self._stream())._nextPutVars_(_st(_st(anIRClosure)._tempDeclarations())._collect_((function(each){
  22447. return smalltalk.withContext(function($ctx3) {
  22448. return _st(_st(each)._name())._asVariableName();
  22449. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})})));
  22450. return _st(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  22451. return smalltalk.withContext(function($ctx3) {
  22452. return smalltalk.IRVisitor.fn.prototype._visitIRClosure_.apply(_st(self), [anIRClosure]);
  22453. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  22454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),_st(anIRClosure)._arguments());
  22455. return self}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},smalltalk.IRJSTranslator)})},
  22456. args: ["anIRClosure"],
  22457. 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",
  22458. messageSends: ["nextPutClosureWith:arguments:", "nextPutVars:", "collect:", "asVariableName", "name", "tempDeclarations", "stream", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"],
  22459. referencedClasses: []
  22460. }),
  22461. smalltalk.IRJSTranslator);
  22462. smalltalk.addMethod(
  22463. smalltalk.method({
  22464. selector: "visitIRDynamicArray:",
  22465. category: 'visiting',
  22466. fn: function (anIRDynamicArray){
  22467. var self=this;
  22468. return smalltalk.withContext(function($ctx1) {
  22469. _st(self._stream())._nextPutAll_("[");
  22470. _st(_st(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  22471. return smalltalk.withContext(function($ctx2) {
  22472. return self._visit_(each);
  22473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22474. return smalltalk.withContext(function($ctx2) {
  22475. return _st(self._stream())._nextPutAll_(",");
  22476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22477. _st(self["@stream"])._nextPutAll_("]");
  22478. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},smalltalk.IRJSTranslator)})},
  22479. args: ["anIRDynamicArray"],
  22480. 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: ']'",
  22481. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  22482. referencedClasses: []
  22483. }),
  22484. smalltalk.IRJSTranslator);
  22485. smalltalk.addMethod(
  22486. smalltalk.method({
  22487. selector: "visitIRDynamicDictionary:",
  22488. category: 'visiting',
  22489. fn: function (anIRDynamicDictionary){
  22490. var self=this;
  22491. return smalltalk.withContext(function($ctx1) {
  22492. _st(self._stream())._nextPutAll_("smalltalk.HashedCollection._from_([");
  22493. _st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  22494. return smalltalk.withContext(function($ctx2) {
  22495. return self._visit_(each);
  22496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22497. return smalltalk.withContext(function($ctx2) {
  22498. return _st(self._stream())._nextPutAll_(",");
  22499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22500. _st(self._stream())._nextPutAll_("])");
  22501. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},smalltalk.IRJSTranslator)})},
  22502. args: ["anIRDynamicDictionary"],
  22503. 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: '])'",
  22504. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  22505. referencedClasses: []
  22506. }),
  22507. smalltalk.IRJSTranslator);
  22508. smalltalk.addMethod(
  22509. smalltalk.method({
  22510. selector: "visitIRMethod:",
  22511. category: 'visiting',
  22512. fn: function (anIRMethod){
  22513. var self=this;
  22514. return smalltalk.withContext(function($ctx1) {
  22515. var $1,$2;
  22516. _st(self._stream())._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  22517. return smalltalk.withContext(function($ctx2) {
  22518. return _st(self._stream())._nextPutFunctionWith_arguments_((function(){
  22519. return smalltalk.withContext(function($ctx3) {
  22520. _st(self._stream())._nextPutVars_(_st(_st(anIRMethod)._tempDeclarations())._collect_((function(each){
  22521. return smalltalk.withContext(function($ctx4) {
  22522. return _st(_st(each)._name())._asVariableName();
  22523. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3)})})));
  22524. _st(_st(anIRMethod)._classReferences())._do_((function(each){
  22525. return smalltalk.withContext(function($ctx4) {
  22526. return _st(self._stream())._nextPutClassRefFunction_(each);
  22527. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3)})}));
  22528. return _st(self._stream())._nextPutContextFor_during_(anIRMethod,(function(){
  22529. return smalltalk.withContext(function($ctx4) {
  22530. $1=_st(_st(anIRMethod)._internalVariables())._notEmpty();
  22531. if(smalltalk.assert($1)){
  22532. _st(self._stream())._nextPutVars_(_st(_st(_st(anIRMethod)._internalVariables())._asArray())._collect_((function(each){
  22533. return smalltalk.withContext(function($ctx5) {
  22534. return _st(_st(each)._variable())._alias();
  22535. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4)})})));
  22536. };
  22537. $2=_st(_st(anIRMethod)._scope())._hasNonLocalReturn();
  22538. if(smalltalk.assert($2)){
  22539. return _st(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  22540. return smalltalk.withContext(function($ctx5) {
  22541. return smalltalk.IRVisitor.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]);
  22542. }, function($ctx5) {$ctx5.fillBlock({},$ctx4)})}));
  22543. } else {
  22544. return smalltalk.IRVisitor.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]);
  22545. };
  22546. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  22547. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}),_st(anIRMethod)._arguments());
  22548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22549. return self}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},smalltalk.IRJSTranslator)})},
  22550. args: ["anIRMethod"],
  22551. 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 ]",
  22552. messageSends: ["nextPutMethodDeclaration:with:", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "asVariableName", "name", "tempDeclarations", "stream", "do:", "nextPutClassRefFunction:", "classReferences", "nextPutContextFor:during:", "ifTrue:", "alias", "variable", "asArray", "internalVariables", "notEmpty", "ifTrue:ifFalse:", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "hasNonLocalReturn", "scope", "arguments"],
  22553. referencedClasses: []
  22554. }),
  22555. smalltalk.IRJSTranslator);
  22556. smalltalk.addMethod(
  22557. smalltalk.method({
  22558. selector: "visitIRNonLocalReturn:",
  22559. category: 'visiting',
  22560. fn: function (anIRNonLocalReturn){
  22561. var self=this;
  22562. return smalltalk.withContext(function($ctx1) {
  22563. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  22564. return smalltalk.withContext(function($ctx2) {
  22565. return smalltalk.IRVisitor.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]);
  22566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22567. return self}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},smalltalk.IRJSTranslator)})},
  22568. args: ["anIRNonLocalReturn"],
  22569. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  22570. messageSends: ["nextPutNonLocalReturnWith:", "visitIRNonLocalReturn:", "stream"],
  22571. referencedClasses: []
  22572. }),
  22573. smalltalk.IRJSTranslator);
  22574. smalltalk.addMethod(
  22575. smalltalk.method({
  22576. selector: "visitIRReturn:",
  22577. category: 'visiting',
  22578. fn: function (anIRReturn){
  22579. var self=this;
  22580. return smalltalk.withContext(function($ctx1) {
  22581. _st(self._stream())._nextPutReturnWith_((function(){
  22582. return smalltalk.withContext(function($ctx2) {
  22583. return smalltalk.IRVisitor.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]);
  22584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22585. return self}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},smalltalk.IRJSTranslator)})},
  22586. args: ["anIRReturn"],
  22587. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  22588. messageSends: ["nextPutReturnWith:", "visitIRReturn:", "stream"],
  22589. referencedClasses: []
  22590. }),
  22591. smalltalk.IRJSTranslator);
  22592. smalltalk.addMethod(
  22593. smalltalk.method({
  22594. selector: "visitIRSend:",
  22595. category: 'visiting',
  22596. fn: function (anIRSend){
  22597. var self=this;
  22598. return smalltalk.withContext(function($ctx1) {
  22599. var $1;
  22600. $1=_st(anIRSend)._classSend();
  22601. if(($receiver = $1) == nil || $receiver == undefined){
  22602. self._visitSend_(anIRSend);
  22603. } else {
  22604. self._visitSuperSend_(anIRSend);
  22605. };
  22606. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},smalltalk.IRJSTranslator)})},
  22607. args: ["anIRSend"],
  22608. source: "visitIRSend: anIRSend\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ]",
  22609. messageSends: ["ifNil:ifNotNil:", "visitSend:", "visitSuperSend:", "classSend"],
  22610. referencedClasses: []
  22611. }),
  22612. smalltalk.IRJSTranslator);
  22613. smalltalk.addMethod(
  22614. smalltalk.method({
  22615. selector: "visitIRSequence:",
  22616. category: 'visiting',
  22617. fn: function (anIRSequence){
  22618. var self=this;
  22619. return smalltalk.withContext(function($ctx1) {
  22620. _st(self._stream())._nextPutSequenceWith_((function(){
  22621. return smalltalk.withContext(function($ctx2) {
  22622. return _st(_st(anIRSequence)._instructions())._do_((function(each){
  22623. return smalltalk.withContext(function($ctx3) {
  22624. return _st(self._stream())._nextPutStatementWith_(self._visit_(each));
  22625. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  22626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22627. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},smalltalk.IRJSTranslator)})},
  22628. args: ["anIRSequence"],
  22629. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ]]",
  22630. messageSends: ["nextPutSequenceWith:", "do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  22631. referencedClasses: []
  22632. }),
  22633. smalltalk.IRJSTranslator);
  22634. smalltalk.addMethod(
  22635. smalltalk.method({
  22636. selector: "visitIRTempDeclaration:",
  22637. category: 'visiting',
  22638. fn: function (anIRTempDeclaration){
  22639. var self=this;
  22640. return smalltalk.withContext(function($ctx1) {
  22641. return self}, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},smalltalk.IRJSTranslator)})},
  22642. args: ["anIRTempDeclaration"],
  22643. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  22644. messageSends: [],
  22645. referencedClasses: []
  22646. }),
  22647. smalltalk.IRJSTranslator);
  22648. smalltalk.addMethod(
  22649. smalltalk.method({
  22650. selector: "visitIRValue:",
  22651. category: 'visiting',
  22652. fn: function (anIRValue){
  22653. var self=this;
  22654. return smalltalk.withContext(function($ctx1) {
  22655. _st(self._stream())._nextPutAll_(_st(_st(anIRValue)._value())._asJavascript());
  22656. return self}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},smalltalk.IRJSTranslator)})},
  22657. args: ["anIRValue"],
  22658. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  22659. messageSends: ["nextPutAll:", "asJavascript", "value", "stream"],
  22660. referencedClasses: []
  22661. }),
  22662. smalltalk.IRJSTranslator);
  22663. smalltalk.addMethod(
  22664. smalltalk.method({
  22665. selector: "visitIRVariable:",
  22666. category: 'visiting',
  22667. fn: function (anIRVariable){
  22668. var self=this;
  22669. return smalltalk.withContext(function($ctx1) {
  22670. var $1;
  22671. $1=_st(_st(_st(anIRVariable)._variable())._name()).__eq("thisContext");
  22672. if(smalltalk.assert($1)){
  22673. _st(self._stream())._nextPutAll_("smalltalk.getThisContext()");
  22674. } else {
  22675. _st(self._stream())._nextPutAll_(_st(_st(anIRVariable)._variable())._alias());
  22676. };
  22677. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},smalltalk.IRJSTranslator)})},
  22678. args: ["anIRVariable"],
  22679. 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 ]",
  22680. messageSends: ["ifTrue:ifFalse:", "nextPutAll:", "stream", "alias", "variable", "=", "name"],
  22681. referencedClasses: []
  22682. }),
  22683. smalltalk.IRJSTranslator);
  22684. smalltalk.addMethod(
  22685. smalltalk.method({
  22686. selector: "visitIRVerbatim:",
  22687. category: 'visiting',
  22688. fn: function (anIRVerbatim){
  22689. var self=this;
  22690. return smalltalk.withContext(function($ctx1) {
  22691. _st(self._stream())._nextPutStatementWith_((function(){
  22692. return smalltalk.withContext(function($ctx2) {
  22693. return _st(self._stream())._nextPutAll_(_st(anIRVerbatim)._source());
  22694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22695. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},smalltalk.IRJSTranslator)})},
  22696. args: ["anIRVerbatim"],
  22697. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  22698. messageSends: ["nextPutStatementWith:", "nextPutAll:", "source", "stream"],
  22699. referencedClasses: []
  22700. }),
  22701. smalltalk.IRJSTranslator);
  22702. smalltalk.addMethod(
  22703. smalltalk.method({
  22704. selector: "visitReceiver:",
  22705. category: 'visiting',
  22706. fn: function (anIRInstruction){
  22707. var self=this;
  22708. return smalltalk.withContext(function($ctx1) {
  22709. var $1,$2;
  22710. $1=_st(anIRInstruction)._needsBoxingAsReceiver();
  22711. if(! smalltalk.assert($1)){
  22712. $2=self._visit_(anIRInstruction);
  22713. return $2;
  22714. };
  22715. _st(self._stream())._nextPutAll_("_st(");
  22716. self._visit_(anIRInstruction);
  22717. _st(self._stream())._nextPutAll_(")");
  22718. return self}, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},smalltalk.IRJSTranslator)})},
  22719. args: ["anIRInstruction"],
  22720. 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: ')'",
  22721. messageSends: ["ifFalse:", "visit:", "needsBoxingAsReceiver", "nextPutAll:", "stream"],
  22722. referencedClasses: []
  22723. }),
  22724. smalltalk.IRJSTranslator);
  22725. smalltalk.addMethod(
  22726. smalltalk.method({
  22727. selector: "visitSend:",
  22728. category: 'visiting',
  22729. fn: function (anIRSend){
  22730. var self=this;
  22731. return smalltalk.withContext(function($ctx1) {
  22732. self._visitReceiver_(_st(_st(anIRSend)._instructions())._first());
  22733. _st(self._stream())._nextPutAll_(_st(".".__comma(_st(_st(anIRSend)._selector())._asSelector())).__comma("("));
  22734. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  22735. return smalltalk.withContext(function($ctx2) {
  22736. return self._visit_(each);
  22737. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22738. return smalltalk.withContext(function($ctx2) {
  22739. return _st(self._stream())._nextPutAll_(",");
  22740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22741. _st(self._stream())._nextPutAll_(")");
  22742. return self}, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},smalltalk.IRJSTranslator)})},
  22743. args: ["anIRSend"],
  22744. 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: ')'",
  22745. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", ",", "asSelector", "selector", "stream", "do:separatedBy:", "visit:", "allButFirst"],
  22746. referencedClasses: []
  22747. }),
  22748. smalltalk.IRJSTranslator);
  22749. smalltalk.addMethod(
  22750. smalltalk.method({
  22751. selector: "visitSuperSend:",
  22752. category: 'visiting',
  22753. fn: function (anIRSend){
  22754. var self=this;
  22755. return smalltalk.withContext(function($ctx1) {
  22756. var $1,$2;
  22757. $1=self._stream();
  22758. _st($1)._nextPutAll_(_st(_st(_st(anIRSend)._classSend())._asJavascript()).__comma(".fn.prototype."));
  22759. _st($1)._nextPutAll_(_st(_st(_st(anIRSend)._selector())._asSelector()).__comma(".apply("));
  22760. $2=_st($1)._nextPutAll_("_st(");
  22761. self._visit_(_st(_st(anIRSend)._instructions())._first());
  22762. _st(self._stream())._nextPutAll_("), [");
  22763. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  22764. return smalltalk.withContext(function($ctx2) {
  22765. return self._visit_(each);
  22766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22767. return smalltalk.withContext(function($ctx2) {
  22768. return _st(self._stream())._nextPutAll_(",");
  22769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22770. _st(self._stream())._nextPutAll_("])");
  22771. return self}, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},smalltalk.IRJSTranslator)})},
  22772. args: ["anIRSend"],
  22773. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: anIRSend classSend asJavascript, '.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asSelector, '.apply(';\x0a\x09\x09nextPutAll: '_st('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  22774. messageSends: ["nextPutAll:", ",", "asJavascript", "classSend", "stream", "asSelector", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"],
  22775. referencedClasses: []
  22776. }),
  22777. smalltalk.IRJSTranslator);
  22778. smalltalk.addClass('JSStream', smalltalk.Object, ['stream'], 'Compiler-IR');
  22779. smalltalk.addMethod(
  22780. smalltalk.method({
  22781. selector: "contents",
  22782. category: 'accessing',
  22783. fn: function (){
  22784. var self=this;
  22785. return smalltalk.withContext(function($ctx1) {
  22786. var $1;
  22787. $1=_st(self["@stream"])._contents();
  22788. return $1;
  22789. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.JSStream)})},
  22790. args: [],
  22791. source: "contents\x0a\x09^ stream contents",
  22792. messageSends: ["contents"],
  22793. referencedClasses: []
  22794. }),
  22795. smalltalk.JSStream);
  22796. smalltalk.addMethod(
  22797. smalltalk.method({
  22798. selector: "initialize",
  22799. category: 'initialization',
  22800. fn: function (){
  22801. var self=this;
  22802. return smalltalk.withContext(function($ctx1) {
  22803. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  22804. self["@stream"]=""._writeStream();
  22805. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.JSStream)})},
  22806. args: [],
  22807. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  22808. messageSends: ["initialize", "writeStream"],
  22809. referencedClasses: []
  22810. }),
  22811. smalltalk.JSStream);
  22812. smalltalk.addMethod(
  22813. smalltalk.method({
  22814. selector: "lf",
  22815. category: 'streaming',
  22816. fn: function (){
  22817. var self=this;
  22818. return smalltalk.withContext(function($ctx1) {
  22819. _st(self["@stream"])._lf();
  22820. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.JSStream)})},
  22821. args: [],
  22822. source: "lf\x0a\x09stream lf",
  22823. messageSends: ["lf"],
  22824. referencedClasses: []
  22825. }),
  22826. smalltalk.JSStream);
  22827. smalltalk.addMethod(
  22828. smalltalk.method({
  22829. selector: "nextPut:",
  22830. category: 'streaming',
  22831. fn: function (aString){
  22832. var self=this;
  22833. return smalltalk.withContext(function($ctx1) {
  22834. _st(self["@stream"])._nextPut_(aString);
  22835. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},smalltalk.JSStream)})},
  22836. args: ["aString"],
  22837. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  22838. messageSends: ["nextPut:"],
  22839. referencedClasses: []
  22840. }),
  22841. smalltalk.JSStream);
  22842. smalltalk.addMethod(
  22843. smalltalk.method({
  22844. selector: "nextPutAll:",
  22845. category: 'streaming',
  22846. fn: function (aString){
  22847. var self=this;
  22848. return smalltalk.withContext(function($ctx1) {
  22849. _st(self["@stream"])._nextPutAll_(aString);
  22850. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},smalltalk.JSStream)})},
  22851. args: ["aString"],
  22852. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  22853. messageSends: ["nextPutAll:"],
  22854. referencedClasses: []
  22855. }),
  22856. smalltalk.JSStream);
  22857. smalltalk.addMethod(
  22858. smalltalk.method({
  22859. selector: "nextPutAssignment",
  22860. category: 'streaming',
  22861. fn: function (){
  22862. var self=this;
  22863. return smalltalk.withContext(function($ctx1) {
  22864. _st(self["@stream"])._nextPutAll_("=");
  22865. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},smalltalk.JSStream)})},
  22866. args: [],
  22867. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  22868. messageSends: ["nextPutAll:"],
  22869. referencedClasses: []
  22870. }),
  22871. smalltalk.JSStream);
  22872. smalltalk.addMethod(
  22873. smalltalk.method({
  22874. selector: "nextPutBlockContextFor:during:",
  22875. category: 'streaming',
  22876. fn: function (anIRClosure,aBlock){
  22877. var self=this;
  22878. return smalltalk.withContext(function($ctx1) {
  22879. var $1,$2,$3,$4,$5,$6,$7,$8;
  22880. $1=self;
  22881. _st($1)._nextPutAll_(_st("return smalltalk.withContext(function(".__comma(_st(_st(anIRClosure)._scope())._alias())).__comma(") {"));
  22882. $2=_st($1)._lf();
  22883. _st(aBlock)._value();
  22884. $3=self;
  22885. _st($3)._nextPutAll_(_st("}, function(".__comma(_st(_st(anIRClosure)._scope())._alias())).__comma(") {"));
  22886. $4=_st($3)._nextPutAll_(_st(_st(_st(anIRClosure)._scope())._alias()).__comma(".fillBlock({"));
  22887. _st(_st(anIRClosure)._locals())._do_separatedBy_((function(each){
  22888. return smalltalk.withContext(function($ctx2) {
  22889. $5=self;
  22890. _st($5)._nextPutAll_(_st(each)._asVariableName());
  22891. _st($5)._nextPutAll_(":");
  22892. $6=_st($5)._nextPutAll_(_st(each)._asVariableName());
  22893. return $6;
  22894. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22895. return smalltalk.withContext(function($ctx2) {
  22896. return self._nextPutAll_(",");
  22897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22898. $7=self;
  22899. _st($7)._nextPutAll_("},");
  22900. $8=_st($7)._nextPutAll_(_st(_st(_st(_st(anIRClosure)._scope())._outerScope())._alias()).__comma(")})"));
  22901. return self}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},smalltalk.JSStream)})},
  22902. args: ["anIRClosure", "aBlock"],
  22903. 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, ')})'",
  22904. messageSends: ["nextPutAll:", ",", "alias", "scope", "lf", "value", "do:separatedBy:", "asVariableName", "locals", "outerScope"],
  22905. referencedClasses: []
  22906. }),
  22907. smalltalk.JSStream);
  22908. smalltalk.addMethod(
  22909. smalltalk.method({
  22910. selector: "nextPutClassRefFunction:",
  22911. category: 'streaming',
  22912. fn: function (aString){
  22913. var self=this;
  22914. return smalltalk.withContext(function($ctx1) {
  22915. var $1,$2;
  22916. $1=self["@stream"];
  22917. _st($1)._nextPutAll_("function $");
  22918. _st($1)._nextPutAll_(aString);
  22919. _st($1)._nextPutAll_("(){return smalltalk.");
  22920. _st($1)._nextPutAll_(aString);
  22921. _st($1)._nextPutAll_("||(typeof ");
  22922. _st($1)._nextPutAll_(aString);
  22923. _st($1)._nextPutAll_("==\x22undefined\x22?nil:");
  22924. _st($1)._nextPutAll_(aString);
  22925. _st($1)._nextPutAll_(")}");
  22926. $2=_st($1)._lf();
  22927. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},smalltalk.JSStream)})},
  22928. args: ["aString"],
  22929. 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",
  22930. messageSends: ["nextPutAll:", "lf"],
  22931. referencedClasses: []
  22932. }),
  22933. smalltalk.JSStream);
  22934. smalltalk.addMethod(
  22935. smalltalk.method({
  22936. selector: "nextPutClosureWith:arguments:",
  22937. category: 'streaming',
  22938. fn: function (aBlock,anArray){
  22939. var self=this;
  22940. return smalltalk.withContext(function($ctx1) {
  22941. var $1,$2;
  22942. _st(self["@stream"])._nextPutAll_("(function(");
  22943. _st(anArray)._do_separatedBy_((function(each){
  22944. return smalltalk.withContext(function($ctx2) {
  22945. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  22946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22947. return smalltalk.withContext(function($ctx2) {
  22948. return _st(self["@stream"])._nextPut_(",");
  22949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22950. $1=self["@stream"];
  22951. _st($1)._nextPutAll_("){");
  22952. $2=_st($1)._lf();
  22953. _st(aBlock)._value();
  22954. _st(self["@stream"])._nextPutAll_("})");
  22955. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},smalltalk.JSStream)})},
  22956. args: ["aBlock", "anArray"],
  22957. 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: '})'",
  22958. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  22959. referencedClasses: []
  22960. }),
  22961. smalltalk.JSStream);
  22962. smalltalk.addMethod(
  22963. smalltalk.method({
  22964. selector: "nextPutContextFor:during:",
  22965. category: 'streaming',
  22966. fn: function (aMethod,aBlock){
  22967. var self=this;
  22968. return smalltalk.withContext(function($ctx1) {
  22969. var $1,$2,$3,$4,$5,$6,$7,$8;
  22970. $1=self;
  22971. _st($1)._nextPutAll_(_st("return smalltalk.withContext(function(".__comma(_st(_st(aMethod)._scope())._alias())).__comma(") { "));
  22972. $2=_st($1)._lf();
  22973. _st(aBlock)._value();
  22974. $3=self;
  22975. _st($3)._nextPutAll_(_st(_st("}, function(".__comma(_st(_st(aMethod)._scope())._alias())).__comma(") {")).__comma(_st(_st(aMethod)._scope())._alias()));
  22976. $4=_st($3)._nextPutAll_(_st(".fill(self,".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(",{"));
  22977. _st(_st(aMethod)._locals())._do_separatedBy_((function(each){
  22978. return smalltalk.withContext(function($ctx2) {
  22979. $5=self;
  22980. _st($5)._nextPutAll_(_st(each)._asVariableName());
  22981. _st($5)._nextPutAll_(":");
  22982. $6=_st($5)._nextPutAll_(_st(each)._asVariableName());
  22983. return $6;
  22984. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22985. return smalltalk.withContext(function($ctx2) {
  22986. return self._nextPutAll_(",");
  22987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22988. $7=self;
  22989. _st($7)._nextPutAll_("},");
  22990. _st($7)._nextPutAll_(_st(_st(aMethod)._theClass())._asJavascript());
  22991. $8=_st($7)._nextPutAll_(")})");
  22992. return self}, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},smalltalk.JSStream)})},
  22993. args: ["aMethod", "aBlock"],
  22994. 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: ')})'",
  22995. messageSends: ["nextPutAll:", ",", "alias", "scope", "lf", "value", "asJavascript", "selector", "do:separatedBy:", "asVariableName", "locals", "theClass"],
  22996. referencedClasses: []
  22997. }),
  22998. smalltalk.JSStream);
  22999. smalltalk.addMethod(
  23000. smalltalk.method({
  23001. selector: "nextPutFunctionWith:arguments:",
  23002. category: 'streaming',
  23003. fn: function (aBlock,anArray){
  23004. var self=this;
  23005. return smalltalk.withContext(function($ctx1) {
  23006. var $1,$2,$3,$4;
  23007. _st(self["@stream"])._nextPutAll_("fn: function(");
  23008. _st(anArray)._do_separatedBy_((function(each){
  23009. return smalltalk.withContext(function($ctx2) {
  23010. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  23011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  23012. return smalltalk.withContext(function($ctx2) {
  23013. return _st(self["@stream"])._nextPut_(",");
  23014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23015. $1=self["@stream"];
  23016. _st($1)._nextPutAll_("){");
  23017. $2=_st($1)._lf();
  23018. $3=self["@stream"];
  23019. _st($3)._nextPutAll_("var self=this;");
  23020. $4=_st($3)._lf();
  23021. _st(aBlock)._value();
  23022. _st(self["@stream"])._nextPutAll_("}");
  23023. return self}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},smalltalk.JSStream)})},
  23024. args: ["aBlock", "anArray"],
  23025. 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: '}'",
  23026. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  23027. referencedClasses: []
  23028. }),
  23029. smalltalk.JSStream);
  23030. smalltalk.addMethod(
  23031. smalltalk.method({
  23032. selector: "nextPutIf:with:",
  23033. category: 'streaming',
  23034. fn: function (aBlock,anotherBlock){
  23035. var self=this;
  23036. return smalltalk.withContext(function($ctx1) {
  23037. var $1,$2;
  23038. _st(self["@stream"])._nextPutAll_("if(");
  23039. _st(aBlock)._value();
  23040. $1=self["@stream"];
  23041. _st($1)._nextPutAll_("){");
  23042. $2=_st($1)._lf();
  23043. _st(anotherBlock)._value();
  23044. _st(self["@stream"])._nextPutAll_("}");
  23045. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSStream)})},
  23046. args: ["aBlock", "anotherBlock"],
  23047. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  23048. messageSends: ["nextPutAll:", "value", "lf"],
  23049. referencedClasses: []
  23050. }),
  23051. smalltalk.JSStream);
  23052. smalltalk.addMethod(
  23053. smalltalk.method({
  23054. selector: "nextPutIfElse:with:with:",
  23055. category: 'streaming',
  23056. fn: function (aBlock,ifBlock,elseBlock){
  23057. var self=this;
  23058. return smalltalk.withContext(function($ctx1) {
  23059. var $1,$2,$3,$4;
  23060. _st(self["@stream"])._nextPutAll_("if(");
  23061. _st(aBlock)._value();
  23062. $1=self["@stream"];
  23063. _st($1)._nextPutAll_("){");
  23064. $2=_st($1)._lf();
  23065. _st(ifBlock)._value();
  23066. $3=self["@stream"];
  23067. _st($3)._nextPutAll_("} else {");
  23068. $4=_st($3)._lf();
  23069. _st(elseBlock)._value();
  23070. _st(self["@stream"])._nextPutAll_("}");
  23071. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},smalltalk.JSStream)})},
  23072. args: ["aBlock", "ifBlock", "elseBlock"],
  23073. 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: '}'",
  23074. messageSends: ["nextPutAll:", "value", "lf"],
  23075. referencedClasses: []
  23076. }),
  23077. smalltalk.JSStream);
  23078. smalltalk.addMethod(
  23079. smalltalk.method({
  23080. selector: "nextPutMethodDeclaration:with:",
  23081. category: 'streaming',
  23082. fn: function (aMethod,aBlock){
  23083. var self=this;
  23084. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  23085. return smalltalk.withContext(function($ctx1) {
  23086. var $1,$2,$3,$4,$5,$6;
  23087. $1=self["@stream"];
  23088. _st($1)._nextPutAll_("smalltalk.method({");
  23089. _st($1)._lf();
  23090. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  23091. _st($1)._lf();
  23092. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  23093. $2=_st($1)._lf();
  23094. _st(aBlock)._value();
  23095. $3=self["@stream"];
  23096. _st($3)._nextPutAll_(_st(",".__comma(_st($String())._lf())).__comma("messageSends: "));
  23097. _st($3)._nextPutAll_(_st(_st(_st(_st(aMethod)._messageSends())._asArray())._asJavascript()).__comma(","));
  23098. _st($3)._lf();
  23099. _st($3)._nextPutAll_(_st("args: ".__comma(_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
  23100. return smalltalk.withContext(function($ctx2) {
  23101. return _st(each)._value();
  23102. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._asArray())._asJavascript())).__comma(","));
  23103. _st($3)._lf();
  23104. $4=_st($3)._nextPutAll_("referencedClasses: [");
  23105. _st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
  23106. return smalltalk.withContext(function($ctx2) {
  23107. return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
  23108. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  23109. return smalltalk.withContext(function($ctx2) {
  23110. return _st(self["@stream"])._nextPutAll_(",");
  23111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23112. $5=self["@stream"];
  23113. _st($5)._nextPutAll_("]");
  23114. $6=_st($5)._nextPutAll_("})");
  23115. return self}, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},smalltalk.JSStream)})},
  23116. args: ["aMethod", "aBlock"],
  23117. 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: '})'",
  23118. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  23119. referencedClasses: ["String"]
  23120. }),
  23121. smalltalk.JSStream);
  23122. smalltalk.addMethod(
  23123. smalltalk.method({
  23124. selector: "nextPutNonLocalReturnHandlingWith:",
  23125. category: 'streaming',
  23126. fn: function (aBlock){
  23127. var self=this;
  23128. return smalltalk.withContext(function($ctx1) {
  23129. var $1,$2,$3,$4;
  23130. $1=self["@stream"];
  23131. _st($1)._nextPutAll_("var $early={};");
  23132. _st($1)._lf();
  23133. _st($1)._nextPutAll_("try {");
  23134. $2=_st($1)._lf();
  23135. _st(aBlock)._value();
  23136. $3=self["@stream"];
  23137. _st($3)._nextPutAll_("}");
  23138. _st($3)._lf();
  23139. _st($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  23140. $4=_st($3)._lf();
  23141. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  23142. args: ["aBlock"],
  23143. 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",
  23144. messageSends: ["nextPutAll:", "lf", "value"],
  23145. referencedClasses: []
  23146. }),
  23147. smalltalk.JSStream);
  23148. smalltalk.addMethod(
  23149. smalltalk.method({
  23150. selector: "nextPutNonLocalReturnWith:",
  23151. category: 'streaming',
  23152. fn: function (aBlock){
  23153. var self=this;
  23154. return smalltalk.withContext(function($ctx1) {
  23155. _st(self["@stream"])._nextPutAll_("throw $early=[");
  23156. _st(aBlock)._value();
  23157. _st(self["@stream"])._nextPutAll_("]");
  23158. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  23159. args: ["aBlock"],
  23160. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  23161. messageSends: ["nextPutAll:", "value"],
  23162. referencedClasses: []
  23163. }),
  23164. smalltalk.JSStream);
  23165. smalltalk.addMethod(
  23166. smalltalk.method({
  23167. selector: "nextPutReturn",
  23168. category: 'streaming',
  23169. fn: function (){
  23170. var self=this;
  23171. return smalltalk.withContext(function($ctx1) {
  23172. _st(self["@stream"])._nextPutAll_("return ");
  23173. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},smalltalk.JSStream)})},
  23174. args: [],
  23175. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  23176. messageSends: ["nextPutAll:"],
  23177. referencedClasses: []
  23178. }),
  23179. smalltalk.JSStream);
  23180. smalltalk.addMethod(
  23181. smalltalk.method({
  23182. selector: "nextPutReturnWith:",
  23183. category: 'streaming',
  23184. fn: function (aBlock){
  23185. var self=this;
  23186. return smalltalk.withContext(function($ctx1) {
  23187. self._nextPutReturn();
  23188. _st(aBlock)._value();
  23189. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  23190. args: ["aBlock"],
  23191. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  23192. messageSends: ["nextPutReturn", "value"],
  23193. referencedClasses: []
  23194. }),
  23195. smalltalk.JSStream);
  23196. smalltalk.addMethod(
  23197. smalltalk.method({
  23198. selector: "nextPutSequenceWith:",
  23199. category: 'streaming',
  23200. fn: function (aBlock){
  23201. var self=this;
  23202. return smalltalk.withContext(function($ctx1) {
  23203. _st(aBlock)._value();
  23204. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  23205. args: ["aBlock"],
  23206. 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",
  23207. messageSends: ["value"],
  23208. referencedClasses: []
  23209. }),
  23210. smalltalk.JSStream);
  23211. smalltalk.addMethod(
  23212. smalltalk.method({
  23213. selector: "nextPutStatement:with:",
  23214. category: 'streaming',
  23215. fn: function (anInteger,aBlock){
  23216. var self=this;
  23217. return smalltalk.withContext(function($ctx1) {
  23218. var $1,$2,$3,$4;
  23219. $1=self["@stream"];
  23220. _st($1)._nextPutAll_(_st("case ".__comma(_st(anInteger)._asString())).__comma(":"));
  23221. $2=_st($1)._lf();
  23222. self._nextPutStatementWith_(aBlock);
  23223. $3=self["@stream"];
  23224. _st($3)._nextPutAll_(_st("smalltalk.thisContext.pc=".__comma(_st(_st(anInteger).__plus((1)))._asString())).__comma(";"));
  23225. $4=_st($3)._lf();
  23226. return self}, function($ctx1) {$ctx1.fill(self,"nextPutStatement:with:",{anInteger:anInteger,aBlock:aBlock},smalltalk.JSStream)})},
  23227. args: ["anInteger", "aBlock"],
  23228. source: "nextPutStatement: anInteger with: aBlock\x0a\x09stream nextPutAll: 'case ', anInteger asString, ':'; lf.\x0a\x09self nextPutStatementWith: aBlock.\x0a\x09stream nextPutAll: 'smalltalk.thisContext.pc=', (anInteger + 1) asString, ';'; lf",
  23229. messageSends: ["nextPutAll:", ",", "asString", "lf", "nextPutStatementWith:", "+"],
  23230. referencedClasses: []
  23231. }),
  23232. smalltalk.JSStream);
  23233. smalltalk.addMethod(
  23234. smalltalk.method({
  23235. selector: "nextPutStatementWith:",
  23236. category: 'streaming',
  23237. fn: function (aBlock){
  23238. var self=this;
  23239. return smalltalk.withContext(function($ctx1) {
  23240. var $1,$2;
  23241. _st(aBlock)._value();
  23242. $1=self["@stream"];
  23243. _st($1)._nextPutAll_(";");
  23244. $2=_st($1)._lf();
  23245. return self}, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  23246. args: ["aBlock"],
  23247. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  23248. messageSends: ["value", "nextPutAll:", "lf"],
  23249. referencedClasses: []
  23250. }),
  23251. smalltalk.JSStream);
  23252. smalltalk.addMethod(
  23253. smalltalk.method({
  23254. selector: "nextPutVars:",
  23255. category: 'streaming',
  23256. fn: function (aCollection){
  23257. var self=this;
  23258. return smalltalk.withContext(function($ctx1) {
  23259. var $1,$2,$3;
  23260. var $early={};
  23261. try {
  23262. _st(aCollection)._ifEmpty_((function(){
  23263. return smalltalk.withContext(function($ctx2) {
  23264. $1=self;
  23265. throw $early=[$1];
  23266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23267. _st(self["@stream"])._nextPutAll_("var ");
  23268. _st(aCollection)._do_separatedBy_((function(each){
  23269. return smalltalk.withContext(function($ctx2) {
  23270. return _st(self["@stream"])._nextPutAll_(each);
  23271. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  23272. return smalltalk.withContext(function($ctx2) {
  23273. return _st(self["@stream"])._nextPutAll_(",");
  23274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23275. $2=self["@stream"];
  23276. _st($2)._nextPutAll_(";");
  23277. $3=_st($2)._lf();
  23278. return self}
  23279. catch(e) {if(e===$early)return e[0]; throw e}
  23280. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},smalltalk.JSStream)})},
  23281. args: ["aCollection"],
  23282. 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",
  23283. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"],
  23284. referencedClasses: []
  23285. }),
  23286. smalltalk.JSStream);
  23287. smalltalk.addMethod(
  23288. smalltalk.method({
  23289. selector: "appendToInstruction:",
  23290. category: '*Compiler-IR',
  23291. fn: function (anIRInstruction){
  23292. var self=this;
  23293. return smalltalk.withContext(function($ctx1) {
  23294. _st(anIRInstruction)._appendBlock_(self);
  23295. return self}, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},smalltalk.BlockClosure)})},
  23296. args: ["anIRInstruction"],
  23297. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  23298. messageSends: ["appendBlock:"],
  23299. referencedClasses: []
  23300. }),
  23301. smalltalk.BlockClosure);
  23302. smalltalk.addMethod(
  23303. smalltalk.method({
  23304. selector: "asVariableName",
  23305. category: '*Compiler-IR',
  23306. fn: function (){
  23307. var self=this;
  23308. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23309. return smalltalk.withContext(function($ctx1) {
  23310. var $2,$1;
  23311. $2=_st(_st(_st($Smalltalk())._current())._reservedWords())._includes_(self);
  23312. if(smalltalk.assert($2)){
  23313. $1=self.__comma("_");
  23314. } else {
  23315. $1=self;
  23316. };
  23317. return $1;
  23318. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},smalltalk.String)})},
  23319. args: [],
  23320. source: "asVariableName\x0a\x09^ (Smalltalk current reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  23321. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
  23322. referencedClasses: ["Smalltalk"]
  23323. }),
  23324. smalltalk.String);
  23325. smalltalk.addPackage('Compiler-Inlining');
  23326. smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining');
  23327. smalltalk.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  23328. smalltalk.addMethod(
  23329. smalltalk.method({
  23330. selector: "accept:",
  23331. category: 'visiting',
  23332. fn: function (aVisitor){
  23333. var self=this;
  23334. return smalltalk.withContext(function($ctx1) {
  23335. var $1;
  23336. $1=_st(aVisitor)._visitIRInlinedAssignment_(self);
  23337. return $1;
  23338. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedAssignment)})},
  23339. args: ["aVisitor"],
  23340. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  23341. messageSends: ["visitIRInlinedAssignment:"],
  23342. referencedClasses: []
  23343. }),
  23344. smalltalk.IRInlinedAssignment);
  23345. smalltalk.addMethod(
  23346. smalltalk.method({
  23347. selector: "isInlined",
  23348. category: 'testing',
  23349. fn: function (){
  23350. var self=this;
  23351. return smalltalk.withContext(function($ctx1) {
  23352. return true;
  23353. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedAssignment)})},
  23354. args: [],
  23355. source: "isInlined\x0a\x09^ true",
  23356. messageSends: [],
  23357. referencedClasses: []
  23358. }),
  23359. smalltalk.IRInlinedAssignment);
  23360. smalltalk.addClass('IRInlinedClosure', smalltalk.IRClosure, [], 'Compiler-Inlining');
  23361. smalltalk.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  23362. smalltalk.addMethod(
  23363. smalltalk.method({
  23364. selector: "accept:",
  23365. category: 'visiting',
  23366. fn: function (aVisitor){
  23367. var self=this;
  23368. return smalltalk.withContext(function($ctx1) {
  23369. _st(aVisitor)._visitIRInlinedClosure_(self);
  23370. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedClosure)})},
  23371. args: ["aVisitor"],
  23372. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  23373. messageSends: ["visitIRInlinedClosure:"],
  23374. referencedClasses: []
  23375. }),
  23376. smalltalk.IRInlinedClosure);
  23377. smalltalk.addMethod(
  23378. smalltalk.method({
  23379. selector: "isInlined",
  23380. category: 'testing',
  23381. fn: function (){
  23382. var self=this;
  23383. return smalltalk.withContext(function($ctx1) {
  23384. return true;
  23385. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedClosure)})},
  23386. args: [],
  23387. source: "isInlined\x0a\x09^ true",
  23388. messageSends: [],
  23389. referencedClasses: []
  23390. }),
  23391. smalltalk.IRInlinedClosure);
  23392. smalltalk.addClass('IRInlinedReturn', smalltalk.IRReturn, [], 'Compiler-Inlining');
  23393. smalltalk.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  23394. smalltalk.addMethod(
  23395. smalltalk.method({
  23396. selector: "accept:",
  23397. category: 'visiting',
  23398. fn: function (aVisitor){
  23399. var self=this;
  23400. return smalltalk.withContext(function($ctx1) {
  23401. var $1;
  23402. $1=_st(aVisitor)._visitIRInlinedReturn_(self);
  23403. return $1;
  23404. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedReturn)})},
  23405. args: ["aVisitor"],
  23406. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  23407. messageSends: ["visitIRInlinedReturn:"],
  23408. referencedClasses: []
  23409. }),
  23410. smalltalk.IRInlinedReturn);
  23411. smalltalk.addMethod(
  23412. smalltalk.method({
  23413. selector: "isInlined",
  23414. category: 'testing',
  23415. fn: function (){
  23416. var self=this;
  23417. return smalltalk.withContext(function($ctx1) {
  23418. return true;
  23419. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedReturn)})},
  23420. args: [],
  23421. source: "isInlined\x0a\x09^ true",
  23422. messageSends: [],
  23423. referencedClasses: []
  23424. }),
  23425. smalltalk.IRInlinedReturn);
  23426. smalltalk.addClass('IRInlinedSend', smalltalk.IRSend, [], 'Compiler-Inlining');
  23427. smalltalk.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  23428. smalltalk.addMethod(
  23429. smalltalk.method({
  23430. selector: "accept:",
  23431. category: 'visiting',
  23432. fn: function (aVisitor){
  23433. var self=this;
  23434. return smalltalk.withContext(function($ctx1) {
  23435. _st(aVisitor)._visitInlinedSend_(self);
  23436. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedSend)})},
  23437. args: ["aVisitor"],
  23438. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  23439. messageSends: ["visitInlinedSend:"],
  23440. referencedClasses: []
  23441. }),
  23442. smalltalk.IRInlinedSend);
  23443. smalltalk.addMethod(
  23444. smalltalk.method({
  23445. selector: "isInlined",
  23446. category: 'testing',
  23447. fn: function (){
  23448. var self=this;
  23449. return smalltalk.withContext(function($ctx1) {
  23450. return true;
  23451. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedSend)})},
  23452. args: [],
  23453. source: "isInlined\x0a\x09^ true",
  23454. messageSends: [],
  23455. referencedClasses: []
  23456. }),
  23457. smalltalk.IRInlinedSend);
  23458. smalltalk.addClass('IRInlinedIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  23459. smalltalk.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  23460. smalltalk.addMethod(
  23461. smalltalk.method({
  23462. selector: "accept:",
  23463. category: 'visiting',
  23464. fn: function (aVisitor){
  23465. var self=this;
  23466. return smalltalk.withContext(function($ctx1) {
  23467. _st(aVisitor)._visitIRInlinedIfFalse_(self);
  23468. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfFalse)})},
  23469. args: ["aVisitor"],
  23470. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  23471. messageSends: ["visitIRInlinedIfFalse:"],
  23472. referencedClasses: []
  23473. }),
  23474. smalltalk.IRInlinedIfFalse);
  23475. smalltalk.addClass('IRInlinedIfNilIfNotNil', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  23476. smalltalk.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  23477. smalltalk.addMethod(
  23478. smalltalk.method({
  23479. selector: "accept:",
  23480. category: 'visiting',
  23481. fn: function (aVisitor){
  23482. var self=this;
  23483. return smalltalk.withContext(function($ctx1) {
  23484. _st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  23485. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfNilIfNotNil)})},
  23486. args: ["aVisitor"],
  23487. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  23488. messageSends: ["visitIRInlinedIfNilIfNotNil:"],
  23489. referencedClasses: []
  23490. }),
  23491. smalltalk.IRInlinedIfNilIfNotNil);
  23492. smalltalk.addClass('IRInlinedIfTrue', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  23493. smalltalk.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  23494. smalltalk.addMethod(
  23495. smalltalk.method({
  23496. selector: "accept:",
  23497. category: 'visiting',
  23498. fn: function (aVisitor){
  23499. var self=this;
  23500. return smalltalk.withContext(function($ctx1) {
  23501. _st(aVisitor)._visitIRInlinedIfTrue_(self);
  23502. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfTrue)})},
  23503. args: ["aVisitor"],
  23504. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  23505. messageSends: ["visitIRInlinedIfTrue:"],
  23506. referencedClasses: []
  23507. }),
  23508. smalltalk.IRInlinedIfTrue);
  23509. smalltalk.addClass('IRInlinedIfTrueIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  23510. smalltalk.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  23511. smalltalk.addMethod(
  23512. smalltalk.method({
  23513. selector: "accept:",
  23514. category: 'visiting',
  23515. fn: function (aVisitor){
  23516. var self=this;
  23517. return smalltalk.withContext(function($ctx1) {
  23518. _st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  23519. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfTrueIfFalse)})},
  23520. args: ["aVisitor"],
  23521. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  23522. messageSends: ["visitIRInlinedIfTrueIfFalse:"],
  23523. referencedClasses: []
  23524. }),
  23525. smalltalk.IRInlinedIfTrueIfFalse);
  23526. smalltalk.addClass('IRInlinedSequence', smalltalk.IRBlockSequence, [], 'Compiler-Inlining');
  23527. smalltalk.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  23528. smalltalk.addMethod(
  23529. smalltalk.method({
  23530. selector: "accept:",
  23531. category: 'visiting',
  23532. fn: function (aVisitor){
  23533. var self=this;
  23534. return smalltalk.withContext(function($ctx1) {
  23535. _st(aVisitor)._visitIRInlinedSequence_(self);
  23536. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedSequence)})},
  23537. args: ["aVisitor"],
  23538. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  23539. messageSends: ["visitIRInlinedSequence:"],
  23540. referencedClasses: []
  23541. }),
  23542. smalltalk.IRInlinedSequence);
  23543. smalltalk.addMethod(
  23544. smalltalk.method({
  23545. selector: "isInlined",
  23546. category: 'testing',
  23547. fn: function (){
  23548. var self=this;
  23549. return smalltalk.withContext(function($ctx1) {
  23550. return true;
  23551. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedSequence)})},
  23552. args: [],
  23553. source: "isInlined\x0a\x09^ true",
  23554. messageSends: [],
  23555. referencedClasses: []
  23556. }),
  23557. smalltalk.IRInlinedSequence);
  23558. smalltalk.addClass('IRInliner', smalltalk.IRVisitor, [], 'Compiler-Inlining');
  23559. 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`";
  23560. smalltalk.addMethod(
  23561. smalltalk.method({
  23562. selector: "assignmentInliner",
  23563. category: 'factory',
  23564. fn: function (){
  23565. var self=this;
  23566. function $IRAssignmentInliner(){return smalltalk.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  23567. return smalltalk.withContext(function($ctx1) {
  23568. var $2,$3,$1;
  23569. $2=_st($IRAssignmentInliner())._new();
  23570. _st($2)._translator_(self);
  23571. $3=_st($2)._yourself();
  23572. $1=$3;
  23573. return $1;
  23574. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},smalltalk.IRInliner)})},
  23575. args: [],
  23576. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  23577. messageSends: ["translator:", "new", "yourself"],
  23578. referencedClasses: ["IRAssignmentInliner"]
  23579. }),
  23580. smalltalk.IRInliner);
  23581. smalltalk.addMethod(
  23582. smalltalk.method({
  23583. selector: "returnInliner",
  23584. category: 'factory',
  23585. fn: function (){
  23586. var self=this;
  23587. function $IRReturnInliner(){return smalltalk.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  23588. return smalltalk.withContext(function($ctx1) {
  23589. var $2,$3,$1;
  23590. $2=_st($IRReturnInliner())._new();
  23591. _st($2)._translator_(self);
  23592. $3=_st($2)._yourself();
  23593. $1=$3;
  23594. return $1;
  23595. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},smalltalk.IRInliner)})},
  23596. args: [],
  23597. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  23598. messageSends: ["translator:", "new", "yourself"],
  23599. referencedClasses: ["IRReturnInliner"]
  23600. }),
  23601. smalltalk.IRInliner);
  23602. smalltalk.addMethod(
  23603. smalltalk.method({
  23604. selector: "sendInliner",
  23605. category: 'factory',
  23606. fn: function (){
  23607. var self=this;
  23608. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  23609. return smalltalk.withContext(function($ctx1) {
  23610. var $2,$3,$1;
  23611. $2=_st($IRSendInliner())._new();
  23612. _st($2)._translator_(self);
  23613. $3=_st($2)._yourself();
  23614. $1=$3;
  23615. return $1;
  23616. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},smalltalk.IRInliner)})},
  23617. args: [],
  23618. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  23619. messageSends: ["translator:", "new", "yourself"],
  23620. referencedClasses: ["IRSendInliner"]
  23621. }),
  23622. smalltalk.IRInliner);
  23623. smalltalk.addMethod(
  23624. smalltalk.method({
  23625. selector: "shouldInlineAssignment:",
  23626. category: 'testing',
  23627. fn: function (anIRAssignment){
  23628. var self=this;
  23629. return smalltalk.withContext(function($ctx1) {
  23630. var $1;
  23631. $1=_st(_st(_st(anIRAssignment)._isInlined())._not())._and_((function(){
  23632. return smalltalk.withContext(function($ctx2) {
  23633. return _st(_st(_st(_st(anIRAssignment)._instructions())._last())._isSend())._and_((function(){
  23634. return smalltalk.withContext(function($ctx3) {
  23635. return self._shouldInlineSend_(_st(_st(anIRAssignment)._instructions())._last());
  23636. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  23637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23638. return $1;
  23639. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRInliner)})},
  23640. args: ["anIRAssignment"],
  23641. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  23642. messageSends: ["and:", "shouldInlineSend:", "last", "instructions", "isSend", "not", "isInlined"],
  23643. referencedClasses: []
  23644. }),
  23645. smalltalk.IRInliner);
  23646. smalltalk.addMethod(
  23647. smalltalk.method({
  23648. selector: "shouldInlineReturn:",
  23649. category: 'testing',
  23650. fn: function (anIRReturn){
  23651. var self=this;
  23652. return smalltalk.withContext(function($ctx1) {
  23653. var $1;
  23654. $1=_st(_st(_st(anIRReturn)._isInlined())._not())._and_((function(){
  23655. return smalltalk.withContext(function($ctx2) {
  23656. return _st(_st(_st(_st(anIRReturn)._instructions())._first())._isSend())._and_((function(){
  23657. return smalltalk.withContext(function($ctx3) {
  23658. return self._shouldInlineSend_(_st(_st(anIRReturn)._instructions())._first());
  23659. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  23660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23661. return $1;
  23662. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},smalltalk.IRInliner)})},
  23663. args: ["anIRReturn"],
  23664. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  23665. messageSends: ["and:", "shouldInlineSend:", "first", "instructions", "isSend", "not", "isInlined"],
  23666. referencedClasses: []
  23667. }),
  23668. smalltalk.IRInliner);
  23669. smalltalk.addMethod(
  23670. smalltalk.method({
  23671. selector: "shouldInlineSend:",
  23672. category: 'testing',
  23673. fn: function (anIRSend){
  23674. var self=this;
  23675. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  23676. return smalltalk.withContext(function($ctx1) {
  23677. var $1;
  23678. $1=_st(_st(_st(anIRSend)._isInlined())._not())._and_((function(){
  23679. return smalltalk.withContext(function($ctx2) {
  23680. return _st($IRSendInliner())._shouldInline_(anIRSend);
  23681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23682. return $1;
  23683. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},smalltalk.IRInliner)})},
  23684. args: ["anIRSend"],
  23685. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  23686. messageSends: ["and:", "shouldInline:", "not", "isInlined"],
  23687. referencedClasses: ["IRSendInliner"]
  23688. }),
  23689. smalltalk.IRInliner);
  23690. smalltalk.addMethod(
  23691. smalltalk.method({
  23692. selector: "transformNonLocalReturn:",
  23693. category: 'visiting',
  23694. fn: function (anIRNonLocalReturn){
  23695. var self=this;
  23696. var localReturn;
  23697. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  23698. return smalltalk.withContext(function($ctx1) {
  23699. var $1,$2,$3,$4,$5;
  23700. $1=_st(_st(anIRNonLocalReturn)._scope())._canInlineNonLocalReturns();
  23701. if(smalltalk.assert($1)){
  23702. _st(_st(_st(anIRNonLocalReturn)._scope())._methodScope())._removeNonLocalReturn_(_st(anIRNonLocalReturn)._scope());
  23703. $2=_st($IRReturn())._new();
  23704. _st($2)._scope_(_st(anIRNonLocalReturn)._scope());
  23705. $3=_st($2)._yourself();
  23706. localReturn=$3;
  23707. localReturn;
  23708. _st(_st(anIRNonLocalReturn)._instructions())._do_((function(each){
  23709. return smalltalk.withContext(function($ctx2) {
  23710. return _st(localReturn)._add_(each);
  23711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  23712. _st(anIRNonLocalReturn)._replaceWith_(localReturn);
  23713. $4=localReturn;
  23714. return $4;
  23715. };
  23716. $5=smalltalk.IRVisitor.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]);
  23717. return $5;
  23718. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},smalltalk.IRInliner)})},
  23719. args: ["anIRNonLocalReturn"],
  23720. 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",
  23721. messageSends: ["ifTrue:", "removeNonLocalReturn:", "scope", "methodScope", "scope:", "new", "yourself", "do:", "add:", "instructions", "replaceWith:", "canInlineNonLocalReturns", "visitIRNonLocalReturn:"],
  23722. referencedClasses: ["IRReturn"]
  23723. }),
  23724. smalltalk.IRInliner);
  23725. smalltalk.addMethod(
  23726. smalltalk.method({
  23727. selector: "visitIRAssignment:",
  23728. category: 'visiting',
  23729. fn: function (anIRAssignment){
  23730. var self=this;
  23731. return smalltalk.withContext(function($ctx1) {
  23732. var $2,$1;
  23733. $2=self._shouldInlineAssignment_(anIRAssignment);
  23734. if(smalltalk.assert($2)){
  23735. $1=_st(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  23736. } else {
  23737. $1=smalltalk.IRVisitor.fn.prototype._visitIRAssignment_.apply(_st(self), [anIRAssignment]);
  23738. };
  23739. return $1;
  23740. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRInliner)})},
  23741. args: ["anIRAssignment"],
  23742. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  23743. messageSends: ["ifTrue:ifFalse:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:", "shouldInlineAssignment:"],
  23744. referencedClasses: []
  23745. }),
  23746. smalltalk.IRInliner);
  23747. smalltalk.addMethod(
  23748. smalltalk.method({
  23749. selector: "visitIRNonLocalReturn:",
  23750. category: 'visiting',
  23751. fn: function (anIRNonLocalReturn){
  23752. var self=this;
  23753. return smalltalk.withContext(function($ctx1) {
  23754. var $1;
  23755. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  23756. return $1;
  23757. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},smalltalk.IRInliner)})},
  23758. args: ["anIRNonLocalReturn"],
  23759. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  23760. messageSends: ["transformNonLocalReturn:"],
  23761. referencedClasses: []
  23762. }),
  23763. smalltalk.IRInliner);
  23764. smalltalk.addMethod(
  23765. smalltalk.method({
  23766. selector: "visitIRReturn:",
  23767. category: 'visiting',
  23768. fn: function (anIRReturn){
  23769. var self=this;
  23770. return smalltalk.withContext(function($ctx1) {
  23771. var $2,$1;
  23772. $2=self._shouldInlineReturn_(anIRReturn);
  23773. if(smalltalk.assert($2)){
  23774. $1=_st(self._returnInliner())._inlineReturn_(anIRReturn);
  23775. } else {
  23776. $1=smalltalk.IRVisitor.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]);
  23777. };
  23778. return $1;
  23779. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},smalltalk.IRInliner)})},
  23780. args: ["anIRReturn"],
  23781. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  23782. messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "returnInliner", "visitIRReturn:", "shouldInlineReturn:"],
  23783. referencedClasses: []
  23784. }),
  23785. smalltalk.IRInliner);
  23786. smalltalk.addMethod(
  23787. smalltalk.method({
  23788. selector: "visitIRSend:",
  23789. category: 'visiting',
  23790. fn: function (anIRSend){
  23791. var self=this;
  23792. return smalltalk.withContext(function($ctx1) {
  23793. var $2,$1;
  23794. $2=self._shouldInlineSend_(anIRSend);
  23795. if(smalltalk.assert($2)){
  23796. $1=_st(self._sendInliner())._inlineSend_(anIRSend);
  23797. } else {
  23798. $1=smalltalk.IRVisitor.fn.prototype._visitIRSend_.apply(_st(self), [anIRSend]);
  23799. };
  23800. return $1;
  23801. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},smalltalk.IRInliner)})},
  23802. args: ["anIRSend"],
  23803. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  23804. messageSends: ["ifTrue:ifFalse:", "inlineSend:", "sendInliner", "visitIRSend:", "shouldInlineSend:"],
  23805. referencedClasses: []
  23806. }),
  23807. smalltalk.IRInliner);
  23808. smalltalk.addClass('IRInliningJSTranslator', smalltalk.IRJSTranslator, [], 'Compiler-Inlining');
  23809. smalltalk.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  23810. smalltalk.addMethod(
  23811. smalltalk.method({
  23812. selector: "visitIRInlinedAssignment:",
  23813. category: 'visiting',
  23814. fn: function (anIRInlinedAssignment){
  23815. var self=this;
  23816. return smalltalk.withContext(function($ctx1) {
  23817. self._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last());
  23818. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},smalltalk.IRInliningJSTranslator)})},
  23819. args: ["anIRInlinedAssignment"],
  23820. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  23821. messageSends: ["visit:", "last", "instructions"],
  23822. referencedClasses: []
  23823. }),
  23824. smalltalk.IRInliningJSTranslator);
  23825. smalltalk.addMethod(
  23826. smalltalk.method({
  23827. selector: "visitIRInlinedClosure:",
  23828. category: 'visiting',
  23829. fn: function (anIRInlinedClosure){
  23830. var self=this;
  23831. return smalltalk.withContext(function($ctx1) {
  23832. _st(self._stream())._nextPutVars_(_st(_st(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  23833. return smalltalk.withContext(function($ctx2) {
  23834. return _st(_st(each)._name())._asVariableName();
  23835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  23836. _st(_st(anIRInlinedClosure)._instructions())._do_((function(each){
  23837. return smalltalk.withContext(function($ctx2) {
  23838. return self._visit_(each);
  23839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  23840. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},smalltalk.IRInliningJSTranslator)})},
  23841. args: ["anIRInlinedClosure"],
  23842. 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 ]",
  23843. messageSends: ["nextPutVars:", "collect:", "asVariableName", "name", "tempDeclarations", "stream", "do:", "visit:", "instructions"],
  23844. referencedClasses: []
  23845. }),
  23846. smalltalk.IRInliningJSTranslator);
  23847. smalltalk.addMethod(
  23848. smalltalk.method({
  23849. selector: "visitIRInlinedIfFalse:",
  23850. category: 'visiting',
  23851. fn: function (anIRInlinedIfFalse){
  23852. var self=this;
  23853. return smalltalk.withContext(function($ctx1) {
  23854. _st(self._stream())._nextPutIf_with_((function(){
  23855. return smalltalk.withContext(function($ctx2) {
  23856. _st(self._stream())._nextPutAll_("! smalltalk.assert(");
  23857. self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._first());
  23858. return _st(self._stream())._nextPutAll_(")");
  23859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23860. return smalltalk.withContext(function($ctx2) {
  23861. return self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
  23862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23863. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},smalltalk.IRInliningJSTranslator)})},
  23864. args: ["anIRInlinedIfFalse"],
  23865. 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 ]",
  23866. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  23867. referencedClasses: []
  23868. }),
  23869. smalltalk.IRInliningJSTranslator);
  23870. smalltalk.addMethod(
  23871. smalltalk.method({
  23872. selector: "visitIRInlinedIfNil:",
  23873. category: 'visiting',
  23874. fn: function (anIRInlinedIfNil){
  23875. var self=this;
  23876. return smalltalk.withContext(function($ctx1) {
  23877. _st(self._stream())._nextPutIf_with_((function(){
  23878. return smalltalk.withContext(function($ctx2) {
  23879. _st(self._stream())._nextPutAll_("($receiver = ");
  23880. self._visit_(_st(_st(anIRInlinedIfNil)._instructions())._first());
  23881. return _st(self._stream())._nextPutAll_(") == nil || $receiver == undefined");
  23882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23883. return smalltalk.withContext(function($ctx2) {
  23884. return self._visit_(_st(_st(anIRInlinedIfNil)._instructions())._last());
  23885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23886. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNil:",{anIRInlinedIfNil:anIRInlinedIfNil},smalltalk.IRInliningJSTranslator)})},
  23887. args: ["anIRInlinedIfNil"],
  23888. source: "visitIRInlinedIfNil: anIRInlinedIfNil\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '($receiver = '.\x0a\x09\x09self visit: anIRInlinedIfNil instructions first.\x0a\x09\x09self stream nextPutAll: ') == nil || $receiver == undefined' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNil instructions last ]",
  23889. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  23890. referencedClasses: []
  23891. }),
  23892. smalltalk.IRInliningJSTranslator);
  23893. smalltalk.addMethod(
  23894. smalltalk.method({
  23895. selector: "visitIRInlinedIfNilIfNotNil:",
  23896. category: 'visiting',
  23897. fn: function (anIRInlinedIfNilIfNotNil){
  23898. var self=this;
  23899. return smalltalk.withContext(function($ctx1) {
  23900. _st(self._stream())._nextPutIfElse_with_with_((function(){
  23901. return smalltalk.withContext(function($ctx2) {
  23902. _st(self._stream())._nextPutAll_("($receiver = ");
  23903. self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._first());
  23904. return _st(self._stream())._nextPutAll_(") == nil || $receiver == undefined");
  23905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23906. return smalltalk.withContext(function($ctx2) {
  23907. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._second());
  23908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23909. return smalltalk.withContext(function($ctx2) {
  23910. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third());
  23911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23912. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},smalltalk.IRInliningJSTranslator)})},
  23913. args: ["anIRInlinedIfNilIfNotNil"],
  23914. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '($receiver = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == nil || $receiver == undefined' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  23915. messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"],
  23916. referencedClasses: []
  23917. }),
  23918. smalltalk.IRInliningJSTranslator);
  23919. smalltalk.addMethod(
  23920. smalltalk.method({
  23921. selector: "visitIRInlinedIfTrue:",
  23922. category: 'visiting',
  23923. fn: function (anIRInlinedIfTrue){
  23924. var self=this;
  23925. return smalltalk.withContext(function($ctx1) {
  23926. _st(self._stream())._nextPutIf_with_((function(){
  23927. return smalltalk.withContext(function($ctx2) {
  23928. _st(self._stream())._nextPutAll_("smalltalk.assert(");
  23929. self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._first());
  23930. return _st(self._stream())._nextPutAll_(")");
  23931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23932. return smalltalk.withContext(function($ctx2) {
  23933. return self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
  23934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23935. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},smalltalk.IRInliningJSTranslator)})},
  23936. args: ["anIRInlinedIfTrue"],
  23937. 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 ]",
  23938. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  23939. referencedClasses: []
  23940. }),
  23941. smalltalk.IRInliningJSTranslator);
  23942. smalltalk.addMethod(
  23943. smalltalk.method({
  23944. selector: "visitIRInlinedIfTrueIfFalse:",
  23945. category: 'visiting',
  23946. fn: function (anIRInlinedIfTrueIfFalse){
  23947. var self=this;
  23948. return smalltalk.withContext(function($ctx1) {
  23949. _st(self._stream())._nextPutIfElse_with_with_((function(){
  23950. return smalltalk.withContext(function($ctx2) {
  23951. _st(self._stream())._nextPutAll_("smalltalk.assert(");
  23952. self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._first());
  23953. return _st(self._stream())._nextPutAll_(")");
  23954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23955. return smalltalk.withContext(function($ctx2) {
  23956. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._second());
  23957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23958. return smalltalk.withContext(function($ctx2) {
  23959. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third());
  23960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23961. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},smalltalk.IRInliningJSTranslator)})},
  23962. args: ["anIRInlinedIfTrueIfFalse"],
  23963. 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 ]",
  23964. messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"],
  23965. referencedClasses: []
  23966. }),
  23967. smalltalk.IRInliningJSTranslator);
  23968. smalltalk.addMethod(
  23969. smalltalk.method({
  23970. selector: "visitIRInlinedNonLocalReturn:",
  23971. category: 'visiting',
  23972. fn: function (anIRInlinedReturn){
  23973. var self=this;
  23974. return smalltalk.withContext(function($ctx1) {
  23975. _st(self._stream())._nextPutStatementWith_((function(){
  23976. return smalltalk.withContext(function($ctx2) {
  23977. return self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  23978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23979. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  23980. return smalltalk.withContext(function($ctx2) {
  23981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23982. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},smalltalk.IRInliningJSTranslator)})},
  23983. args: ["anIRInlinedReturn"],
  23984. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  23985. messageSends: ["nextPutStatementWith:", "visit:", "last", "instructions", "stream", "nextPutNonLocalReturnWith:"],
  23986. referencedClasses: []
  23987. }),
  23988. smalltalk.IRInliningJSTranslator);
  23989. smalltalk.addMethod(
  23990. smalltalk.method({
  23991. selector: "visitIRInlinedReturn:",
  23992. category: 'visiting',
  23993. fn: function (anIRInlinedReturn){
  23994. var self=this;
  23995. return smalltalk.withContext(function($ctx1) {
  23996. self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  23997. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},smalltalk.IRInliningJSTranslator)})},
  23998. args: ["anIRInlinedReturn"],
  23999. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  24000. messageSends: ["visit:", "last", "instructions"],
  24001. referencedClasses: []
  24002. }),
  24003. smalltalk.IRInliningJSTranslator);
  24004. smalltalk.addMethod(
  24005. smalltalk.method({
  24006. selector: "visitIRInlinedSequence:",
  24007. category: 'visiting',
  24008. fn: function (anIRInlinedSequence){
  24009. var self=this;
  24010. return smalltalk.withContext(function($ctx1) {
  24011. _st(_st(anIRInlinedSequence)._instructions())._do_((function(each){
  24012. return smalltalk.withContext(function($ctx2) {
  24013. return _st(self._stream())._nextPutStatementWith_((function(){
  24014. return smalltalk.withContext(function($ctx3) {
  24015. return self._visit_(each);
  24016. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  24017. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24018. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},smalltalk.IRInliningJSTranslator)})},
  24019. args: ["anIRInlinedSequence"],
  24020. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  24021. messageSends: ["do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  24022. referencedClasses: []
  24023. }),
  24024. smalltalk.IRInliningJSTranslator);
  24025. smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
  24026. smalltalk.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  24027. smalltalk.addMethod(
  24028. smalltalk.method({
  24029. selector: "ifFalse:",
  24030. category: 'inlining',
  24031. fn: function (anIRInstruction){
  24032. var self=this;
  24033. function $IRInlinedIfFalse(){return smalltalk.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  24034. return smalltalk.withContext(function($ctx1) {
  24035. var $1;
  24036. $1=self._inlinedSend_with_(_st($IRInlinedIfFalse())._new(),anIRInstruction);
  24037. return $1;
  24038. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  24039. args: ["anIRInstruction"],
  24040. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  24041. messageSends: ["inlinedSend:with:", "new"],
  24042. referencedClasses: ["IRInlinedIfFalse"]
  24043. }),
  24044. smalltalk.IRSendInliner);
  24045. smalltalk.addMethod(
  24046. smalltalk.method({
  24047. selector: "ifFalse:ifTrue:",
  24048. category: 'inlining',
  24049. fn: function (anIRInstruction,anotherIRInstruction){
  24050. var self=this;
  24051. return smalltalk.withContext(function($ctx1) {
  24052. var $1;
  24053. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  24054. return $1;
  24055. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  24056. args: ["anIRInstruction", "anotherIRInstruction"],
  24057. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  24058. messageSends: ["perform:withArguments:"],
  24059. referencedClasses: []
  24060. }),
  24061. smalltalk.IRSendInliner);
  24062. smalltalk.addMethod(
  24063. smalltalk.method({
  24064. selector: "ifNil:",
  24065. category: 'inlining',
  24066. fn: function (anIRInstruction){
  24067. var self=this;
  24068. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  24069. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  24070. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  24071. return smalltalk.withContext(function($ctx1) {
  24072. var $2,$3,$4,$5,$1;
  24073. $2=_st($IRClosure())._new();
  24074. _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  24075. $3=_st($IRBlockSequence())._new();
  24076. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  24077. $4=_st($3)._yourself();
  24078. _st($2)._add_($4);
  24079. $5=_st($2)._yourself();
  24080. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,$5);
  24081. return $1;
  24082. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  24083. args: ["anIRInstruction"],
  24084. 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)",
  24085. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  24086. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  24087. }),
  24088. smalltalk.IRSendInliner);
  24089. smalltalk.addMethod(
  24090. smalltalk.method({
  24091. selector: "ifNil:ifNotNil:",
  24092. category: 'inlining',
  24093. fn: function (anIRInstruction,anotherIRInstruction){
  24094. var self=this;
  24095. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  24096. return smalltalk.withContext(function($ctx1) {
  24097. var $1;
  24098. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  24099. return $1;
  24100. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  24101. args: ["anIRInstruction", "anotherIRInstruction"],
  24102. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  24103. messageSends: ["inlinedSend:with:with:", "new"],
  24104. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  24105. }),
  24106. smalltalk.IRSendInliner);
  24107. smalltalk.addMethod(
  24108. smalltalk.method({
  24109. selector: "ifNotNil:",
  24110. category: 'inlining',
  24111. fn: function (anIRInstruction){
  24112. var self=this;
  24113. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  24114. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  24115. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  24116. return smalltalk.withContext(function($ctx1) {
  24117. var $2,$3,$4,$5,$1;
  24118. $2=_st($IRClosure())._new();
  24119. _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  24120. $3=_st($IRBlockSequence())._new();
  24121. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  24122. $4=_st($3)._yourself();
  24123. _st($2)._add_($4);
  24124. $5=_st($2)._yourself();
  24125. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),$5,anIRInstruction);
  24126. return $1;
  24127. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  24128. args: ["anIRInstruction"],
  24129. 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",
  24130. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  24131. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  24132. }),
  24133. smalltalk.IRSendInliner);
  24134. smalltalk.addMethod(
  24135. smalltalk.method({
  24136. selector: "ifNotNil:ifNil:",
  24137. category: 'inlining',
  24138. fn: function (anIRInstruction,anotherIRInstruction){
  24139. var self=this;
  24140. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  24141. return smalltalk.withContext(function($ctx1) {
  24142. var $1;
  24143. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  24144. return $1;
  24145. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  24146. args: ["anIRInstruction", "anotherIRInstruction"],
  24147. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  24148. messageSends: ["inlinedSend:with:with:", "new"],
  24149. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  24150. }),
  24151. smalltalk.IRSendInliner);
  24152. smalltalk.addMethod(
  24153. smalltalk.method({
  24154. selector: "ifTrue:",
  24155. category: 'inlining',
  24156. fn: function (anIRInstruction){
  24157. var self=this;
  24158. function $IRInlinedIfTrue(){return smalltalk.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  24159. return smalltalk.withContext(function($ctx1) {
  24160. var $1;
  24161. $1=self._inlinedSend_with_(_st($IRInlinedIfTrue())._new(),anIRInstruction);
  24162. return $1;
  24163. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  24164. args: ["anIRInstruction"],
  24165. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  24166. messageSends: ["inlinedSend:with:", "new"],
  24167. referencedClasses: ["IRInlinedIfTrue"]
  24168. }),
  24169. smalltalk.IRSendInliner);
  24170. smalltalk.addMethod(
  24171. smalltalk.method({
  24172. selector: "ifTrue:ifFalse:",
  24173. category: 'inlining',
  24174. fn: function (anIRInstruction,anotherIRInstruction){
  24175. var self=this;
  24176. function $IRInlinedIfTrueIfFalse(){return smalltalk.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  24177. return smalltalk.withContext(function($ctx1) {
  24178. var $1;
  24179. $1=self._inlinedSend_with_with_(_st($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  24180. return $1;
  24181. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  24182. args: ["anIRInstruction", "anotherIRInstruction"],
  24183. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  24184. messageSends: ["inlinedSend:with:with:", "new"],
  24185. referencedClasses: ["IRInlinedIfTrueIfFalse"]
  24186. }),
  24187. smalltalk.IRSendInliner);
  24188. smalltalk.addMethod(
  24189. smalltalk.method({
  24190. selector: "inlineClosure:",
  24191. category: 'inlining',
  24192. fn: function (anIRClosure){
  24193. var self=this;
  24194. var inlinedClosure,sequence,statements;
  24195. function $IRTempDeclaration(){return smalltalk.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  24196. function $AliasVar(){return smalltalk.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  24197. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  24198. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  24199. return smalltalk.withContext(function($ctx1) {
  24200. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  24201. inlinedClosure=self._inlinedClosure();
  24202. _st(inlinedClosure)._scope_(_st(anIRClosure)._scope());
  24203. _st(_st(anIRClosure)._tempDeclarations())._do_((function(each){
  24204. return smalltalk.withContext(function($ctx2) {
  24205. return _st(inlinedClosure)._add_(each);
  24206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24207. sequence=self._inlinedSequence();
  24208. _st(_st(anIRClosure)._arguments())._do_((function(each){
  24209. return smalltalk.withContext(function($ctx2) {
  24210. $1=_st($IRTempDeclaration())._new();
  24211. _st($1)._name_(each);
  24212. $2=_st($1)._yourself();
  24213. _st(inlinedClosure)._add_($2);
  24214. $3=_st($IRAssignment())._new();
  24215. $4=_st($AliasVar())._new();
  24216. _st($4)._scope_(_st(inlinedClosure)._scope());
  24217. _st($4)._name_(each);
  24218. $5=_st($4)._yourself();
  24219. _st($3)._add_(_st(_st($IRVariable())._new())._variable_($5));
  24220. $6=_st($AliasVar())._new();
  24221. _st($6)._scope_(_st(inlinedClosure)._scope());
  24222. _st($6)._name_("$receiver");
  24223. $7=_st($6)._yourself();
  24224. _st($3)._add_(_st(_st($IRVariable())._new())._variable_($7));
  24225. $8=_st($3)._yourself();
  24226. return _st(sequence)._add_($8);
  24227. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24228. _st(inlinedClosure)._add_(sequence);
  24229. statements=_st(_st(_st(anIRClosure)._instructions())._last())._instructions();
  24230. _st(statements)._ifNotEmpty_((function(){
  24231. return smalltalk.withContext(function($ctx2) {
  24232. _st(_st(statements)._allButLast())._do_((function(each){
  24233. return smalltalk.withContext(function($ctx3) {
  24234. return _st(sequence)._add_(each);
  24235. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  24236. $9=_st(_st(_st(statements)._last())._isReturn())._and_((function(){
  24237. return smalltalk.withContext(function($ctx3) {
  24238. return _st(_st(statements)._last())._isBlockReturn();
  24239. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  24240. if(smalltalk.assert($9)){
  24241. return _st(sequence)._add_(_st(_st(_st(statements)._last())._instructions())._first());
  24242. } else {
  24243. return _st(sequence)._add_(_st(statements)._last());
  24244. };
  24245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24246. $10=inlinedClosure;
  24247. return $10;
  24248. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},smalltalk.IRSendInliner)})},
  24249. args: ["anIRClosure"],
  24250. 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",
  24251. messageSends: ["inlinedClosure", "scope:", "scope", "do:", "add:", "tempDeclarations", "inlinedSequence", "name:", "new", "yourself", "variable:", "arguments", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "first", "and:", "isBlockReturn", "isReturn"],
  24252. referencedClasses: ["IRTempDeclaration", "AliasVar", "IRVariable", "IRAssignment"]
  24253. }),
  24254. smalltalk.IRSendInliner);
  24255. smalltalk.addMethod(
  24256. smalltalk.method({
  24257. selector: "inlineSend:",
  24258. category: 'inlining',
  24259. fn: function (anIRSend){
  24260. var self=this;
  24261. return smalltalk.withContext(function($ctx1) {
  24262. var $1;
  24263. self._send_(anIRSend);
  24264. $1=self._perform_withArguments_(_st(self._send())._selector(),_st(_st(self._send())._instructions())._allButFirst());
  24265. return $1;
  24266. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},smalltalk.IRSendInliner)})},
  24267. args: ["anIRSend"],
  24268. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  24269. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
  24270. referencedClasses: []
  24271. }),
  24272. smalltalk.IRSendInliner);
  24273. smalltalk.addMethod(
  24274. smalltalk.method({
  24275. selector: "inlinedClosure",
  24276. category: 'factory',
  24277. fn: function (){
  24278. var self=this;
  24279. function $IRInlinedClosure(){return smalltalk.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  24280. return smalltalk.withContext(function($ctx1) {
  24281. var $1;
  24282. $1=_st($IRInlinedClosure())._new();
  24283. return $1;
  24284. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},smalltalk.IRSendInliner)})},
  24285. args: [],
  24286. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  24287. messageSends: ["new"],
  24288. referencedClasses: ["IRInlinedClosure"]
  24289. }),
  24290. smalltalk.IRSendInliner);
  24291. smalltalk.addMethod(
  24292. smalltalk.method({
  24293. selector: "inlinedSend:with:",
  24294. category: 'inlining',
  24295. fn: function (inlinedSend,anIRInstruction){
  24296. var self=this;
  24297. var inlinedClosure;
  24298. return smalltalk.withContext(function($ctx1) {
  24299. var $1,$2,$3,$4,$5;
  24300. $1=_st(anIRInstruction)._isClosure();
  24301. if(! smalltalk.assert($1)){
  24302. self._inliningError_("Message argument should be a block");
  24303. };
  24304. $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
  24305. if(! smalltalk.assert($2)){
  24306. self._inliningError_("Inlined block should have zero argument");
  24307. };
  24308. inlinedClosure=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  24309. $3=inlinedSend;
  24310. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  24311. $4=_st($3)._add_(inlinedClosure);
  24312. _st(self._send())._replaceWith_(inlinedSend);
  24313. $5=inlinedSend;
  24314. return $5;
  24315. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},smalltalk.IRSendInliner)})},
  24316. args: ["inlinedSend", "anIRInstruction"],
  24317. 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",
  24318. messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"],
  24319. referencedClasses: []
  24320. }),
  24321. smalltalk.IRSendInliner);
  24322. smalltalk.addMethod(
  24323. smalltalk.method({
  24324. selector: "inlinedSend:with:with:",
  24325. category: 'inlining',
  24326. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  24327. var self=this;
  24328. var inlinedClosure1,inlinedClosure2;
  24329. return smalltalk.withContext(function($ctx1) {
  24330. var $1,$2,$3,$4,$5;
  24331. $1=_st(anIRInstruction)._isClosure();
  24332. if(! smalltalk.assert($1)){
  24333. self._inliningError_("Message argument should be a block");
  24334. };
  24335. $2=_st(anotherIRInstruction)._isClosure();
  24336. if(! smalltalk.assert($2)){
  24337. self._inliningError_("Message argument should be a block");
  24338. };
  24339. inlinedClosure1=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  24340. inlinedClosure2=_st(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  24341. $3=inlinedSend;
  24342. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  24343. _st($3)._add_(inlinedClosure1);
  24344. $4=_st($3)._add_(inlinedClosure2);
  24345. _st(self._send())._replaceWith_(inlinedSend);
  24346. $5=inlinedSend;
  24347. return $5;
  24348. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},smalltalk.IRSendInliner)})},
  24349. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  24350. 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",
  24351. messageSends: ["ifFalse:", "inliningError:", "isClosure", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"],
  24352. referencedClasses: []
  24353. }),
  24354. smalltalk.IRSendInliner);
  24355. smalltalk.addMethod(
  24356. smalltalk.method({
  24357. selector: "inlinedSequence",
  24358. category: 'factory',
  24359. fn: function (){
  24360. var self=this;
  24361. function $IRInlinedSequence(){return smalltalk.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  24362. return smalltalk.withContext(function($ctx1) {
  24363. var $1;
  24364. $1=_st($IRInlinedSequence())._new();
  24365. return $1;
  24366. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},smalltalk.IRSendInliner)})},
  24367. args: [],
  24368. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  24369. messageSends: ["new"],
  24370. referencedClasses: ["IRInlinedSequence"]
  24371. }),
  24372. smalltalk.IRSendInliner);
  24373. smalltalk.addMethod(
  24374. smalltalk.method({
  24375. selector: "inliningError:",
  24376. category: 'error handling',
  24377. fn: function (aString){
  24378. var self=this;
  24379. function $InliningError(){return smalltalk.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  24380. return smalltalk.withContext(function($ctx1) {
  24381. _st($InliningError())._signal_(aString);
  24382. return self}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},smalltalk.IRSendInliner)})},
  24383. args: ["aString"],
  24384. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  24385. messageSends: ["signal:"],
  24386. referencedClasses: ["InliningError"]
  24387. }),
  24388. smalltalk.IRSendInliner);
  24389. smalltalk.addMethod(
  24390. smalltalk.method({
  24391. selector: "send",
  24392. category: 'accessing',
  24393. fn: function (){
  24394. var self=this;
  24395. return smalltalk.withContext(function($ctx1) {
  24396. var $1;
  24397. $1=self["@send"];
  24398. return $1;
  24399. }, function($ctx1) {$ctx1.fill(self,"send",{},smalltalk.IRSendInliner)})},
  24400. args: [],
  24401. source: "send\x0a\x09^ send",
  24402. messageSends: [],
  24403. referencedClasses: []
  24404. }),
  24405. smalltalk.IRSendInliner);
  24406. smalltalk.addMethod(
  24407. smalltalk.method({
  24408. selector: "send:",
  24409. category: 'accessing',
  24410. fn: function (anIRSend){
  24411. var self=this;
  24412. return smalltalk.withContext(function($ctx1) {
  24413. self["@send"]=anIRSend;
  24414. return self}, function($ctx1) {$ctx1.fill(self,"send:",{anIRSend:anIRSend},smalltalk.IRSendInliner)})},
  24415. args: ["anIRSend"],
  24416. source: "send: anIRSend\x0a\x09send := anIRSend",
  24417. messageSends: [],
  24418. referencedClasses: []
  24419. }),
  24420. smalltalk.IRSendInliner);
  24421. smalltalk.addMethod(
  24422. smalltalk.method({
  24423. selector: "translator",
  24424. category: 'accessing',
  24425. fn: function (){
  24426. var self=this;
  24427. return smalltalk.withContext(function($ctx1) {
  24428. var $1;
  24429. $1=self["@translator"];
  24430. return $1;
  24431. }, function($ctx1) {$ctx1.fill(self,"translator",{},smalltalk.IRSendInliner)})},
  24432. args: [],
  24433. source: "translator\x0a\x09^ translator",
  24434. messageSends: [],
  24435. referencedClasses: []
  24436. }),
  24437. smalltalk.IRSendInliner);
  24438. smalltalk.addMethod(
  24439. smalltalk.method({
  24440. selector: "translator:",
  24441. category: 'accessing',
  24442. fn: function (anASTTranslator){
  24443. var self=this;
  24444. return smalltalk.withContext(function($ctx1) {
  24445. self["@translator"]=anASTTranslator;
  24446. return self}, function($ctx1) {$ctx1.fill(self,"translator:",{anASTTranslator:anASTTranslator},smalltalk.IRSendInliner)})},
  24447. args: ["anASTTranslator"],
  24448. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  24449. messageSends: [],
  24450. referencedClasses: []
  24451. }),
  24452. smalltalk.IRSendInliner);
  24453. smalltalk.addMethod(
  24454. smalltalk.method({
  24455. selector: "inlinedSelectors",
  24456. category: 'accessing',
  24457. fn: function (){
  24458. var self=this;
  24459. return smalltalk.withContext(function($ctx1) {
  24460. var $1;
  24461. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  24462. return $1;
  24463. }, function($ctx1) {$ctx1.fill(self,"inlinedSelectors",{},smalltalk.IRSendInliner.klass)})},
  24464. args: [],
  24465. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  24466. messageSends: [],
  24467. referencedClasses: []
  24468. }),
  24469. smalltalk.IRSendInliner.klass);
  24470. smalltalk.addMethod(
  24471. smalltalk.method({
  24472. selector: "shouldInline:",
  24473. category: 'accessing',
  24474. fn: function (anIRInstruction){
  24475. var self=this;
  24476. return smalltalk.withContext(function($ctx1) {
  24477. var $1,$2;
  24478. var $early={};
  24479. try {
  24480. $1=_st(self._inlinedSelectors())._includes_(_st(anIRInstruction)._selector());
  24481. if(! smalltalk.assert($1)){
  24482. return false;
  24483. };
  24484. _st(_st(_st(anIRInstruction)._instructions())._allButFirst())._do_((function(each){
  24485. return smalltalk.withContext(function($ctx2) {
  24486. $2=_st(each)._isClosure();
  24487. if(! smalltalk.assert($2)){
  24488. throw $early=[false];
  24489. };
  24490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24491. return true;
  24492. }
  24493. catch(e) {if(e===$early)return e[0]; throw e}
  24494. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner.klass)})},
  24495. args: ["anIRInstruction"],
  24496. 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",
  24497. messageSends: ["ifFalse:", "includes:", "selector", "inlinedSelectors", "do:", "isClosure", "allButFirst", "instructions"],
  24498. referencedClasses: []
  24499. }),
  24500. smalltalk.IRSendInliner.klass);
  24501. smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  24502. 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};";
  24503. smalltalk.addMethod(
  24504. smalltalk.method({
  24505. selector: "assignment",
  24506. category: 'accessing',
  24507. fn: function (){
  24508. var self=this;
  24509. return smalltalk.withContext(function($ctx1) {
  24510. var $1;
  24511. $1=self["@assignment"];
  24512. return $1;
  24513. }, function($ctx1) {$ctx1.fill(self,"assignment",{},smalltalk.IRAssignmentInliner)})},
  24514. args: [],
  24515. source: "assignment\x0a\x09^ assignment",
  24516. messageSends: [],
  24517. referencedClasses: []
  24518. }),
  24519. smalltalk.IRAssignmentInliner);
  24520. smalltalk.addMethod(
  24521. smalltalk.method({
  24522. selector: "assignment:",
  24523. category: 'accessing',
  24524. fn: function (aNode){
  24525. var self=this;
  24526. return smalltalk.withContext(function($ctx1) {
  24527. self["@assignment"]=aNode;
  24528. return self}, function($ctx1) {$ctx1.fill(self,"assignment:",{aNode:aNode},smalltalk.IRAssignmentInliner)})},
  24529. args: ["aNode"],
  24530. source: "assignment: aNode\x0a\x09assignment := aNode",
  24531. messageSends: [],
  24532. referencedClasses: []
  24533. }),
  24534. smalltalk.IRAssignmentInliner);
  24535. smalltalk.addMethod(
  24536. smalltalk.method({
  24537. selector: "inlineAssignment:",
  24538. category: 'inlining',
  24539. fn: function (anIRAssignment){
  24540. var self=this;
  24541. var inlinedAssignment;
  24542. function $IRInlinedAssignment(){return smalltalk.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  24543. return smalltalk.withContext(function($ctx1) {
  24544. var $1;
  24545. self._assignment_(anIRAssignment);
  24546. inlinedAssignment=_st($IRInlinedAssignment())._new();
  24547. _st(_st(anIRAssignment)._instructions())._do_((function(each){
  24548. return smalltalk.withContext(function($ctx2) {
  24549. return _st(inlinedAssignment)._add_(each);
  24550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24551. _st(anIRAssignment)._replaceWith_(inlinedAssignment);
  24552. self._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last());
  24553. $1=inlinedAssignment;
  24554. return $1;
  24555. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},smalltalk.IRAssignmentInliner)})},
  24556. args: ["anIRAssignment"],
  24557. 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",
  24558. messageSends: ["assignment:", "new", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
  24559. referencedClasses: ["IRInlinedAssignment"]
  24560. }),
  24561. smalltalk.IRAssignmentInliner);
  24562. smalltalk.addMethod(
  24563. smalltalk.method({
  24564. selector: "inlineClosure:",
  24565. category: 'inlining',
  24566. fn: function (anIRClosure){
  24567. var self=this;
  24568. var inlinedClosure,statements;
  24569. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  24570. return smalltalk.withContext(function($ctx1) {
  24571. var $1,$2,$3,$4;
  24572. inlinedClosure=smalltalk.IRSendInliner.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  24573. statements=_st(_st(_st(inlinedClosure)._instructions())._last())._instructions();
  24574. _st(statements)._ifNotEmpty_((function(){
  24575. return smalltalk.withContext(function($ctx2) {
  24576. $1=_st(_st(statements)._last())._canBeAssigned();
  24577. if(smalltalk.assert($1)){
  24578. $2=_st($IRAssignment())._new();
  24579. _st($2)._add_(_st(_st(self._assignment())._instructions())._first());
  24580. _st($2)._add_(_st(_st(statements)._last())._copy());
  24581. $3=_st($2)._yourself();
  24582. return _st(_st(statements)._last())._replaceWith_($3);
  24583. };
  24584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24585. $4=inlinedClosure;
  24586. return $4;
  24587. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},smalltalk.IRAssignmentInliner)})},
  24588. args: ["anIRClosure"],
  24589. 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",
  24590. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "replaceWith:", "add:", "first", "assignment", "new", "copy", "yourself", "canBeAssigned"],
  24591. referencedClasses: ["IRAssignment"]
  24592. }),
  24593. smalltalk.IRAssignmentInliner);
  24594. smalltalk.addClass('IRReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  24595. smalltalk.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  24596. smalltalk.addMethod(
  24597. smalltalk.method({
  24598. selector: "inlineClosure:",
  24599. category: 'inlining',
  24600. fn: function (anIRClosure){
  24601. var self=this;
  24602. var closure,statements;
  24603. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  24604. return smalltalk.withContext(function($ctx1) {
  24605. var $1,$2,$3,$4;
  24606. closure=smalltalk.IRSendInliner.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  24607. statements=_st(_st(_st(closure)._instructions())._last())._instructions();
  24608. _st(statements)._ifNotEmpty_((function(){
  24609. return smalltalk.withContext(function($ctx2) {
  24610. $1=_st(_st(statements)._last())._isReturn();
  24611. if(! smalltalk.assert($1)){
  24612. $2=_st($IRReturn())._new();
  24613. _st($2)._add_(_st(_st(statements)._last())._copy());
  24614. $3=_st($2)._yourself();
  24615. return _st(_st(statements)._last())._replaceWith_($3);
  24616. };
  24617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24618. $4=closure;
  24619. return $4;
  24620. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},smalltalk.IRReturnInliner)})},
  24621. args: ["anIRClosure"],
  24622. 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",
  24623. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "replaceWith:", "add:", "copy", "new", "yourself", "isReturn"],
  24624. referencedClasses: ["IRReturn"]
  24625. }),
  24626. smalltalk.IRReturnInliner);
  24627. smalltalk.addMethod(
  24628. smalltalk.method({
  24629. selector: "inlineReturn:",
  24630. category: 'inlining',
  24631. fn: function (anIRReturn){
  24632. var self=this;
  24633. var return_;
  24634. return smalltalk.withContext(function($ctx1) {
  24635. var $1;
  24636. return_=self._inlinedReturn();
  24637. _st(_st(anIRReturn)._instructions())._do_((function(each){
  24638. return smalltalk.withContext(function($ctx2) {
  24639. return _st(return_)._add_(each);
  24640. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24641. _st(anIRReturn)._replaceWith_(return_);
  24642. self._inlineSend_(_st(_st(return_)._instructions())._last());
  24643. $1=return_;
  24644. return $1;
  24645. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},smalltalk.IRReturnInliner)})},
  24646. args: ["anIRReturn"],
  24647. 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",
  24648. messageSends: ["inlinedReturn", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
  24649. referencedClasses: []
  24650. }),
  24651. smalltalk.IRReturnInliner);
  24652. smalltalk.addMethod(
  24653. smalltalk.method({
  24654. selector: "inlinedReturn",
  24655. category: 'factory',
  24656. fn: function (){
  24657. var self=this;
  24658. function $IRInlinedReturn(){return smalltalk.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  24659. return smalltalk.withContext(function($ctx1) {
  24660. var $1;
  24661. $1=_st($IRInlinedReturn())._new();
  24662. return $1;
  24663. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},smalltalk.IRReturnInliner)})},
  24664. args: [],
  24665. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  24666. messageSends: ["new"],
  24667. referencedClasses: ["IRInlinedReturn"]
  24668. }),
  24669. smalltalk.IRReturnInliner);
  24670. smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
  24671. smalltalk.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  24672. smalltalk.addMethod(
  24673. smalltalk.method({
  24674. selector: "compileNode:",
  24675. category: 'compiling',
  24676. fn: function (aNode){
  24677. var self=this;
  24678. var ir,stream;
  24679. return smalltalk.withContext(function($ctx1) {
  24680. var $2,$3,$1;
  24681. _st(self._semanticAnalyzer())._visit_(aNode);
  24682. ir=_st(self._translator())._visit_(aNode);
  24683. _st(self._inliner())._visit_(ir);
  24684. $2=self._irTranslator();
  24685. _st($2)._visit_(ir);
  24686. $3=_st($2)._contents();
  24687. $1=$3;
  24688. return $1;
  24689. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},smalltalk.InliningCodeGenerator)})},
  24690. args: ["aNode"],
  24691. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  24692. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "irTranslator", "contents"],
  24693. referencedClasses: []
  24694. }),
  24695. smalltalk.InliningCodeGenerator);
  24696. smalltalk.addMethod(
  24697. smalltalk.method({
  24698. selector: "inliner",
  24699. category: 'compiling',
  24700. fn: function (){
  24701. var self=this;
  24702. function $IRInliner(){return smalltalk.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  24703. return smalltalk.withContext(function($ctx1) {
  24704. var $1;
  24705. $1=_st($IRInliner())._new();
  24706. return $1;
  24707. }, function($ctx1) {$ctx1.fill(self,"inliner",{},smalltalk.InliningCodeGenerator)})},
  24708. args: [],
  24709. source: "inliner\x0a\x09^ IRInliner new",
  24710. messageSends: ["new"],
  24711. referencedClasses: ["IRInliner"]
  24712. }),
  24713. smalltalk.InliningCodeGenerator);
  24714. smalltalk.addMethod(
  24715. smalltalk.method({
  24716. selector: "irTranslator",
  24717. category: 'compiling',
  24718. fn: function (){
  24719. var self=this;
  24720. function $IRInliningJSTranslator(){return smalltalk.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  24721. return smalltalk.withContext(function($ctx1) {
  24722. var $1;
  24723. $1=_st($IRInliningJSTranslator())._new();
  24724. return $1;
  24725. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},smalltalk.InliningCodeGenerator)})},
  24726. args: [],
  24727. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  24728. messageSends: ["new"],
  24729. referencedClasses: ["IRInliningJSTranslator"]
  24730. }),
  24731. smalltalk.InliningCodeGenerator);
  24732. smalltalk.addPackage('Compiler-Semantic');
  24733. smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', 'instruction', 'temps', 'args', 'outerScope'], 'Compiler-Semantic');
  24734. 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.";
  24735. smalltalk.addMethod(
  24736. smalltalk.method({
  24737. selector: "addArg:",
  24738. category: 'adding',
  24739. fn: function (aString){
  24740. var self=this;
  24741. function $ArgVar(){return smalltalk.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  24742. return smalltalk.withContext(function($ctx1) {
  24743. _st(self._args())._at_put_(aString,_st($ArgVar())._on_(aString));
  24744. _st(_st(self._args())._at_(aString))._scope_(self);
  24745. return self}, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},smalltalk.LexicalScope)})},
  24746. args: ["aString"],
  24747. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  24748. messageSends: ["at:put:", "on:", "args", "scope:", "at:"],
  24749. referencedClasses: ["ArgVar"]
  24750. }),
  24751. smalltalk.LexicalScope);
  24752. smalltalk.addMethod(
  24753. smalltalk.method({
  24754. selector: "addTemp:",
  24755. category: 'adding',
  24756. fn: function (aString){
  24757. var self=this;
  24758. function $TempVar(){return smalltalk.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  24759. return smalltalk.withContext(function($ctx1) {
  24760. _st(self._temps())._at_put_(aString,_st($TempVar())._on_(aString));
  24761. _st(_st(self._temps())._at_(aString))._scope_(self);
  24762. return self}, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},smalltalk.LexicalScope)})},
  24763. args: ["aString"],
  24764. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  24765. messageSends: ["at:put:", "on:", "temps", "scope:", "at:"],
  24766. referencedClasses: ["TempVar"]
  24767. }),
  24768. smalltalk.LexicalScope);
  24769. smalltalk.addMethod(
  24770. smalltalk.method({
  24771. selector: "alias",
  24772. category: 'accessing',
  24773. fn: function (){
  24774. var self=this;
  24775. return smalltalk.withContext(function($ctx1) {
  24776. var $1;
  24777. $1="$ctx".__comma(_st(self._scopeLevel())._asString());
  24778. return $1;
  24779. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.LexicalScope)})},
  24780. args: [],
  24781. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  24782. messageSends: [",", "asString", "scopeLevel"],
  24783. referencedClasses: []
  24784. }),
  24785. smalltalk.LexicalScope);
  24786. smalltalk.addMethod(
  24787. smalltalk.method({
  24788. selector: "allVariableNames",
  24789. category: 'accessing',
  24790. fn: function (){
  24791. var self=this;
  24792. return smalltalk.withContext(function($ctx1) {
  24793. var $1;
  24794. $1=_st(_st(self._args())._keys()).__comma(_st(self._temps())._keys());
  24795. return $1;
  24796. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},smalltalk.LexicalScope)})},
  24797. args: [],
  24798. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  24799. messageSends: [",", "keys", "temps", "args"],
  24800. referencedClasses: []
  24801. }),
  24802. smalltalk.LexicalScope);
  24803. smalltalk.addMethod(
  24804. smalltalk.method({
  24805. selector: "args",
  24806. category: 'accessing',
  24807. fn: function (){
  24808. var self=this;
  24809. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  24810. return smalltalk.withContext(function($ctx1) {
  24811. var $2,$1;
  24812. $2=self["@args"];
  24813. if(($receiver = $2) == nil || $receiver == undefined){
  24814. self["@args"]=_st($Dictionary())._new();
  24815. $1=self["@args"];
  24816. } else {
  24817. $1=$2;
  24818. };
  24819. return $1;
  24820. }, function($ctx1) {$ctx1.fill(self,"args",{},smalltalk.LexicalScope)})},
  24821. args: [],
  24822. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  24823. messageSends: ["ifNil:", "new"],
  24824. referencedClasses: ["Dictionary"]
  24825. }),
  24826. smalltalk.LexicalScope);
  24827. smalltalk.addMethod(
  24828. smalltalk.method({
  24829. selector: "bindingFor:",
  24830. category: 'accessing',
  24831. fn: function (aStringOrNode){
  24832. var self=this;
  24833. return smalltalk.withContext(function($ctx1) {
  24834. var $1;
  24835. $1=_st(self._pseudoVars())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  24836. return smalltalk.withContext(function($ctx2) {
  24837. return _st(self._args())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  24838. return smalltalk.withContext(function($ctx3) {
  24839. return _st(self._temps())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  24840. return smalltalk.withContext(function($ctx4) {
  24841. return nil;
  24842. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  24843. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  24844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24845. return $1;
  24846. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},smalltalk.LexicalScope)})},
  24847. args: ["aStringOrNode"],
  24848. 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 ]]]",
  24849. messageSends: ["at:ifAbsent:", "value", "temps", "args", "pseudoVars"],
  24850. referencedClasses: []
  24851. }),
  24852. smalltalk.LexicalScope);
  24853. smalltalk.addMethod(
  24854. smalltalk.method({
  24855. selector: "canInlineNonLocalReturns",
  24856. category: 'testing',
  24857. fn: function (){
  24858. var self=this;
  24859. return smalltalk.withContext(function($ctx1) {
  24860. var $1;
  24861. $1=_st(self._isInlined())._and_((function(){
  24862. return smalltalk.withContext(function($ctx2) {
  24863. return _st(self._outerScope())._canInlineNonLocalReturns();
  24864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24865. return $1;
  24866. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},smalltalk.LexicalScope)})},
  24867. args: [],
  24868. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  24869. messageSends: ["and:", "canInlineNonLocalReturns", "outerScope", "isInlined"],
  24870. referencedClasses: []
  24871. }),
  24872. smalltalk.LexicalScope);
  24873. smalltalk.addMethod(
  24874. smalltalk.method({
  24875. selector: "instruction",
  24876. category: 'accessing',
  24877. fn: function (){
  24878. var self=this;
  24879. return smalltalk.withContext(function($ctx1) {
  24880. var $1;
  24881. $1=self["@instruction"];
  24882. return $1;
  24883. }, function($ctx1) {$ctx1.fill(self,"instruction",{},smalltalk.LexicalScope)})},
  24884. args: [],
  24885. source: "instruction\x0a\x09^ instruction",
  24886. messageSends: [],
  24887. referencedClasses: []
  24888. }),
  24889. smalltalk.LexicalScope);
  24890. smalltalk.addMethod(
  24891. smalltalk.method({
  24892. selector: "instruction:",
  24893. category: 'accessing',
  24894. fn: function (anIRInstruction){
  24895. var self=this;
  24896. return smalltalk.withContext(function($ctx1) {
  24897. self["@instruction"]=anIRInstruction;
  24898. return self}, function($ctx1) {$ctx1.fill(self,"instruction:",{anIRInstruction:anIRInstruction},smalltalk.LexicalScope)})},
  24899. args: ["anIRInstruction"],
  24900. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  24901. messageSends: [],
  24902. referencedClasses: []
  24903. }),
  24904. smalltalk.LexicalScope);
  24905. smalltalk.addMethod(
  24906. smalltalk.method({
  24907. selector: "isBlockScope",
  24908. category: 'testing',
  24909. fn: function (){
  24910. var self=this;
  24911. return smalltalk.withContext(function($ctx1) {
  24912. var $1;
  24913. $1=_st(self._isMethodScope())._not();
  24914. return $1;
  24915. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},smalltalk.LexicalScope)})},
  24916. args: [],
  24917. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  24918. messageSends: ["not", "isMethodScope"],
  24919. referencedClasses: []
  24920. }),
  24921. smalltalk.LexicalScope);
  24922. smalltalk.addMethod(
  24923. smalltalk.method({
  24924. selector: "isInlined",
  24925. category: 'testing',
  24926. fn: function (){
  24927. var self=this;
  24928. return smalltalk.withContext(function($ctx1) {
  24929. var $1;
  24930. $1=_st(_st(self._instruction())._notNil())._and_((function(){
  24931. return smalltalk.withContext(function($ctx2) {
  24932. return _st(self._instruction())._isInlined();
  24933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24934. return $1;
  24935. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.LexicalScope)})},
  24936. args: [],
  24937. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  24938. messageSends: ["and:", "isInlined", "instruction", "notNil"],
  24939. referencedClasses: []
  24940. }),
  24941. smalltalk.LexicalScope);
  24942. smalltalk.addMethod(
  24943. smalltalk.method({
  24944. selector: "isMethodScope",
  24945. category: 'testing',
  24946. fn: function (){
  24947. var self=this;
  24948. return smalltalk.withContext(function($ctx1) {
  24949. return false;
  24950. }, function($ctx1) {$ctx1.fill(self,"isMethodScope",{},smalltalk.LexicalScope)})},
  24951. args: [],
  24952. source: "isMethodScope\x0a\x09^ false",
  24953. messageSends: [],
  24954. referencedClasses: []
  24955. }),
  24956. smalltalk.LexicalScope);
  24957. smalltalk.addMethod(
  24958. smalltalk.method({
  24959. selector: "lookupVariable:",
  24960. category: 'accessing',
  24961. fn: function (aNode){
  24962. var self=this;
  24963. var lookup;
  24964. return smalltalk.withContext(function($ctx1) {
  24965. var $1,$2,$3;
  24966. lookup=self._bindingFor_(aNode);
  24967. $1=lookup;
  24968. if(($receiver = $1) == nil || $receiver == undefined){
  24969. $2=self._outerScope();
  24970. if(($receiver = $2) == nil || $receiver == undefined){
  24971. lookup=$2;
  24972. } else {
  24973. lookup=_st(self._outerScope())._lookupVariable_(aNode);
  24974. };
  24975. lookup;
  24976. } else {
  24977. $1;
  24978. };
  24979. $3=lookup;
  24980. return $3;
  24981. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},smalltalk.LexicalScope)})},
  24982. args: ["aNode"],
  24983. 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",
  24984. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "lookupVariable:", "outerScope"],
  24985. referencedClasses: []
  24986. }),
  24987. smalltalk.LexicalScope);
  24988. smalltalk.addMethod(
  24989. smalltalk.method({
  24990. selector: "methodScope",
  24991. category: 'accessing',
  24992. fn: function (){
  24993. var self=this;
  24994. return smalltalk.withContext(function($ctx1) {
  24995. var $2,$1;
  24996. $2=self._outerScope();
  24997. if(($receiver = $2) == nil || $receiver == undefined){
  24998. $1=$2;
  24999. } else {
  25000. $1=_st(self._outerScope())._methodScope();
  25001. };
  25002. return $1;
  25003. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},smalltalk.LexicalScope)})},
  25004. args: [],
  25005. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  25006. messageSends: ["ifNotNil:", "methodScope", "outerScope"],
  25007. referencedClasses: []
  25008. }),
  25009. smalltalk.LexicalScope);
  25010. smalltalk.addMethod(
  25011. smalltalk.method({
  25012. selector: "node",
  25013. category: 'accessing',
  25014. fn: function (){
  25015. var self=this;
  25016. return smalltalk.withContext(function($ctx1) {
  25017. var $1;
  25018. $1=self["@node"];
  25019. return $1;
  25020. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.LexicalScope)})},
  25021. args: [],
  25022. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  25023. messageSends: [],
  25024. referencedClasses: []
  25025. }),
  25026. smalltalk.LexicalScope);
  25027. smalltalk.addMethod(
  25028. smalltalk.method({
  25029. selector: "node:",
  25030. category: 'accessing',
  25031. fn: function (aNode){
  25032. var self=this;
  25033. return smalltalk.withContext(function($ctx1) {
  25034. self["@node"]=aNode;
  25035. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.LexicalScope)})},
  25036. args: ["aNode"],
  25037. source: "node: aNode\x0a\x09node := aNode",
  25038. messageSends: [],
  25039. referencedClasses: []
  25040. }),
  25041. smalltalk.LexicalScope);
  25042. smalltalk.addMethod(
  25043. smalltalk.method({
  25044. selector: "outerScope",
  25045. category: 'accessing',
  25046. fn: function (){
  25047. var self=this;
  25048. return smalltalk.withContext(function($ctx1) {
  25049. var $1;
  25050. $1=self["@outerScope"];
  25051. return $1;
  25052. }, function($ctx1) {$ctx1.fill(self,"outerScope",{},smalltalk.LexicalScope)})},
  25053. args: [],
  25054. source: "outerScope\x0a\x09^ outerScope",
  25055. messageSends: [],
  25056. referencedClasses: []
  25057. }),
  25058. smalltalk.LexicalScope);
  25059. smalltalk.addMethod(
  25060. smalltalk.method({
  25061. selector: "outerScope:",
  25062. category: 'accessing',
  25063. fn: function (aLexicalScope){
  25064. var self=this;
  25065. return smalltalk.withContext(function($ctx1) {
  25066. self["@outerScope"]=aLexicalScope;
  25067. return self}, function($ctx1) {$ctx1.fill(self,"outerScope:",{aLexicalScope:aLexicalScope},smalltalk.LexicalScope)})},
  25068. args: ["aLexicalScope"],
  25069. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  25070. messageSends: [],
  25071. referencedClasses: []
  25072. }),
  25073. smalltalk.LexicalScope);
  25074. smalltalk.addMethod(
  25075. smalltalk.method({
  25076. selector: "pseudoVars",
  25077. category: 'accessing',
  25078. fn: function (){
  25079. var self=this;
  25080. return smalltalk.withContext(function($ctx1) {
  25081. var $1;
  25082. $1=_st(self._methodScope())._pseudoVars();
  25083. return $1;
  25084. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},smalltalk.LexicalScope)})},
  25085. args: [],
  25086. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  25087. messageSends: ["pseudoVars", "methodScope"],
  25088. referencedClasses: []
  25089. }),
  25090. smalltalk.LexicalScope);
  25091. smalltalk.addMethod(
  25092. smalltalk.method({
  25093. selector: "scopeLevel",
  25094. category: 'accessing',
  25095. fn: function (){
  25096. var self=this;
  25097. return smalltalk.withContext(function($ctx1) {
  25098. var $1,$2,$3,$4;
  25099. $1=self._outerScope();
  25100. if(($receiver = $1) == nil || $receiver == undefined){
  25101. return (1);
  25102. } else {
  25103. $1;
  25104. };
  25105. $2=self._isInlined();
  25106. if(smalltalk.assert($2)){
  25107. $3=_st(self._outerScope())._scopeLevel();
  25108. return $3;
  25109. };
  25110. $4=_st(_st(self._outerScope())._scopeLevel()).__plus((1));
  25111. return $4;
  25112. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},smalltalk.LexicalScope)})},
  25113. args: [],
  25114. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  25115. messageSends: ["ifNil:", "outerScope", "ifTrue:", "scopeLevel", "isInlined", "+"],
  25116. referencedClasses: []
  25117. }),
  25118. smalltalk.LexicalScope);
  25119. smalltalk.addMethod(
  25120. smalltalk.method({
  25121. selector: "temps",
  25122. category: 'accessing',
  25123. fn: function (){
  25124. var self=this;
  25125. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  25126. return smalltalk.withContext(function($ctx1) {
  25127. var $2,$1;
  25128. $2=self["@temps"];
  25129. if(($receiver = $2) == nil || $receiver == undefined){
  25130. self["@temps"]=_st($Dictionary())._new();
  25131. $1=self["@temps"];
  25132. } else {
  25133. $1=$2;
  25134. };
  25135. return $1;
  25136. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.LexicalScope)})},
  25137. args: [],
  25138. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  25139. messageSends: ["ifNil:", "new"],
  25140. referencedClasses: ["Dictionary"]
  25141. }),
  25142. smalltalk.LexicalScope);
  25143. smalltalk.addClass('MethodLexicalScope', smalltalk.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  25144. smalltalk.MethodLexicalScope.comment="I represent a method scope.";
  25145. smalltalk.addMethod(
  25146. smalltalk.method({
  25147. selector: "addIVar:",
  25148. category: 'adding',
  25149. fn: function (aString){
  25150. var self=this;
  25151. function $InstanceVar(){return smalltalk.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  25152. return smalltalk.withContext(function($ctx1) {
  25153. _st(self._iVars())._at_put_(aString,_st($InstanceVar())._on_(aString));
  25154. _st(_st(self._iVars())._at_(aString))._scope_(self);
  25155. return self}, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},smalltalk.MethodLexicalScope)})},
  25156. args: ["aString"],
  25157. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  25158. messageSends: ["at:put:", "on:", "iVars", "scope:", "at:"],
  25159. referencedClasses: ["InstanceVar"]
  25160. }),
  25161. smalltalk.MethodLexicalScope);
  25162. smalltalk.addMethod(
  25163. smalltalk.method({
  25164. selector: "addNonLocalReturn:",
  25165. category: 'adding',
  25166. fn: function (aScope){
  25167. var self=this;
  25168. return smalltalk.withContext(function($ctx1) {
  25169. _st(self._nonLocalReturns())._add_(aScope);
  25170. return self}, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},smalltalk.MethodLexicalScope)})},
  25171. args: ["aScope"],
  25172. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  25173. messageSends: ["add:", "nonLocalReturns"],
  25174. referencedClasses: []
  25175. }),
  25176. smalltalk.MethodLexicalScope);
  25177. smalltalk.addMethod(
  25178. smalltalk.method({
  25179. selector: "allVariableNames",
  25180. category: 'accessing',
  25181. fn: function (){
  25182. var self=this;
  25183. return smalltalk.withContext(function($ctx1) {
  25184. var $1;
  25185. $1=_st(smalltalk.LexicalScope.fn.prototype._allVariableNames.apply(_st(self), [])).__comma(_st(self._iVars())._keys());
  25186. return $1;
  25187. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},smalltalk.MethodLexicalScope)})},
  25188. args: [],
  25189. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  25190. messageSends: [",", "keys", "iVars", "allVariableNames"],
  25191. referencedClasses: []
  25192. }),
  25193. smalltalk.MethodLexicalScope);
  25194. smalltalk.addMethod(
  25195. smalltalk.method({
  25196. selector: "bindingFor:",
  25197. category: 'accessing',
  25198. fn: function (aNode){
  25199. var self=this;
  25200. return smalltalk.withContext(function($ctx1) {
  25201. var $2,$1;
  25202. $2=smalltalk.LexicalScope.fn.prototype._bindingFor_.apply(_st(self), [aNode]);
  25203. if(($receiver = $2) == nil || $receiver == undefined){
  25204. $1=_st(self._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
  25205. return smalltalk.withContext(function($ctx2) {
  25206. return nil;
  25207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  25208. } else {
  25209. $1=$2;
  25210. };
  25211. return $1;
  25212. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},smalltalk.MethodLexicalScope)})},
  25213. args: ["aNode"],
  25214. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  25215. messageSends: ["ifNil:", "at:ifAbsent:", "value", "iVars", "bindingFor:"],
  25216. referencedClasses: []
  25217. }),
  25218. smalltalk.MethodLexicalScope);
  25219. smalltalk.addMethod(
  25220. smalltalk.method({
  25221. selector: "canInlineNonLocalReturns",
  25222. category: 'testing',
  25223. fn: function (){
  25224. var self=this;
  25225. return smalltalk.withContext(function($ctx1) {
  25226. return true;
  25227. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},smalltalk.MethodLexicalScope)})},
  25228. args: [],
  25229. source: "canInlineNonLocalReturns\x0a\x09^ true",
  25230. messageSends: [],
  25231. referencedClasses: []
  25232. }),
  25233. smalltalk.MethodLexicalScope);
  25234. smalltalk.addMethod(
  25235. smalltalk.method({
  25236. selector: "hasLocalReturn",
  25237. category: 'testing',
  25238. fn: function (){
  25239. var self=this;
  25240. return smalltalk.withContext(function($ctx1) {
  25241. var $1;
  25242. $1=self._localReturn();
  25243. return $1;
  25244. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},smalltalk.MethodLexicalScope)})},
  25245. args: [],
  25246. source: "hasLocalReturn\x0a\x09^ self localReturn",
  25247. messageSends: ["localReturn"],
  25248. referencedClasses: []
  25249. }),
  25250. smalltalk.MethodLexicalScope);
  25251. smalltalk.addMethod(
  25252. smalltalk.method({
  25253. selector: "hasNonLocalReturn",
  25254. category: 'testing',
  25255. fn: function (){
  25256. var self=this;
  25257. return smalltalk.withContext(function($ctx1) {
  25258. var $1;
  25259. $1=_st(self._nonLocalReturns())._notEmpty();
  25260. return $1;
  25261. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},smalltalk.MethodLexicalScope)})},
  25262. args: [],
  25263. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  25264. messageSends: ["notEmpty", "nonLocalReturns"],
  25265. referencedClasses: []
  25266. }),
  25267. smalltalk.MethodLexicalScope);
  25268. smalltalk.addMethod(
  25269. smalltalk.method({
  25270. selector: "iVars",
  25271. category: 'accessing',
  25272. fn: function (){
  25273. var self=this;
  25274. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  25275. return smalltalk.withContext(function($ctx1) {
  25276. var $2,$1;
  25277. $2=self["@iVars"];
  25278. if(($receiver = $2) == nil || $receiver == undefined){
  25279. self["@iVars"]=_st($Dictionary())._new();
  25280. $1=self["@iVars"];
  25281. } else {
  25282. $1=$2;
  25283. };
  25284. return $1;
  25285. }, function($ctx1) {$ctx1.fill(self,"iVars",{},smalltalk.MethodLexicalScope)})},
  25286. args: [],
  25287. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  25288. messageSends: ["ifNil:", "new"],
  25289. referencedClasses: ["Dictionary"]
  25290. }),
  25291. smalltalk.MethodLexicalScope);
  25292. smalltalk.addMethod(
  25293. smalltalk.method({
  25294. selector: "isMethodScope",
  25295. category: 'testing',
  25296. fn: function (){
  25297. var self=this;
  25298. return smalltalk.withContext(function($ctx1) {
  25299. return true;
  25300. }, function($ctx1) {$ctx1.fill(self,"isMethodScope",{},smalltalk.MethodLexicalScope)})},
  25301. args: [],
  25302. source: "isMethodScope\x0a\x09^ true",
  25303. messageSends: [],
  25304. referencedClasses: []
  25305. }),
  25306. smalltalk.MethodLexicalScope);
  25307. smalltalk.addMethod(
  25308. smalltalk.method({
  25309. selector: "localReturn",
  25310. category: 'accessing',
  25311. fn: function (){
  25312. var self=this;
  25313. return smalltalk.withContext(function($ctx1) {
  25314. var $2,$1;
  25315. $2=self["@localReturn"];
  25316. if(($receiver = $2) == nil || $receiver == undefined){
  25317. $1=false;
  25318. } else {
  25319. $1=$2;
  25320. };
  25321. return $1;
  25322. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},smalltalk.MethodLexicalScope)})},
  25323. args: [],
  25324. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  25325. messageSends: ["ifNil:"],
  25326. referencedClasses: []
  25327. }),
  25328. smalltalk.MethodLexicalScope);
  25329. smalltalk.addMethod(
  25330. smalltalk.method({
  25331. selector: "localReturn:",
  25332. category: 'accessing',
  25333. fn: function (aBoolean){
  25334. var self=this;
  25335. return smalltalk.withContext(function($ctx1) {
  25336. self["@localReturn"]=aBoolean;
  25337. return self}, function($ctx1) {$ctx1.fill(self,"localReturn:",{aBoolean:aBoolean},smalltalk.MethodLexicalScope)})},
  25338. args: ["aBoolean"],
  25339. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  25340. messageSends: [],
  25341. referencedClasses: []
  25342. }),
  25343. smalltalk.MethodLexicalScope);
  25344. smalltalk.addMethod(
  25345. smalltalk.method({
  25346. selector: "methodScope",
  25347. category: 'accessing',
  25348. fn: function (){
  25349. var self=this;
  25350. return smalltalk.withContext(function($ctx1) {
  25351. var $1;
  25352. $1=self;
  25353. return $1;
  25354. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},smalltalk.MethodLexicalScope)})},
  25355. args: [],
  25356. source: "methodScope\x0a\x09^ self",
  25357. messageSends: [],
  25358. referencedClasses: []
  25359. }),
  25360. smalltalk.MethodLexicalScope);
  25361. smalltalk.addMethod(
  25362. smalltalk.method({
  25363. selector: "nonLocalReturns",
  25364. category: 'accessing',
  25365. fn: function (){
  25366. var self=this;
  25367. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  25368. return smalltalk.withContext(function($ctx1) {
  25369. var $2,$1;
  25370. $2=self["@nonLocalReturns"];
  25371. if(($receiver = $2) == nil || $receiver == undefined){
  25372. self["@nonLocalReturns"]=_st($OrderedCollection())._new();
  25373. $1=self["@nonLocalReturns"];
  25374. } else {
  25375. $1=$2;
  25376. };
  25377. return $1;
  25378. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},smalltalk.MethodLexicalScope)})},
  25379. args: [],
  25380. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  25381. messageSends: ["ifNil:", "new"],
  25382. referencedClasses: ["OrderedCollection"]
  25383. }),
  25384. smalltalk.MethodLexicalScope);
  25385. smalltalk.addMethod(
  25386. smalltalk.method({
  25387. selector: "pseudoVars",
  25388. category: 'accessing',
  25389. fn: function (){
  25390. var self=this;
  25391. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  25392. function $PseudoVar(){return smalltalk.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  25393. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  25394. return smalltalk.withContext(function($ctx1) {
  25395. var $1,$2,$3,$4;
  25396. $1=self["@pseudoVars"];
  25397. if(($receiver = $1) == nil || $receiver == undefined){
  25398. self["@pseudoVars"]=_st($Dictionary())._new();
  25399. self["@pseudoVars"];
  25400. _st(_st(_st($Smalltalk())._current())._pseudoVariableNames())._do_((function(each){
  25401. return smalltalk.withContext(function($ctx2) {
  25402. $2=_st($PseudoVar())._on_(each);
  25403. _st($2)._scope_(self._methodScope());
  25404. $3=_st($2)._yourself();
  25405. return _st(self["@pseudoVars"])._at_put_(each,$3);
  25406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  25407. } else {
  25408. $1;
  25409. };
  25410. $4=self["@pseudoVars"];
  25411. return $4;
  25412. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},smalltalk.MethodLexicalScope)})},
  25413. args: [],
  25414. 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",
  25415. messageSends: ["ifNil:", "new", "do:", "at:put:", "scope:", "methodScope", "on:", "yourself", "pseudoVariableNames", "current"],
  25416. referencedClasses: ["Dictionary", "PseudoVar", "Smalltalk"]
  25417. }),
  25418. smalltalk.MethodLexicalScope);
  25419. smalltalk.addMethod(
  25420. smalltalk.method({
  25421. selector: "removeNonLocalReturn:",
  25422. category: 'adding',
  25423. fn: function (aScope){
  25424. var self=this;
  25425. return smalltalk.withContext(function($ctx1) {
  25426. _st(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  25427. return smalltalk.withContext(function($ctx2) {
  25428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  25429. return self}, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},smalltalk.MethodLexicalScope)})},
  25430. args: ["aScope"],
  25431. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  25432. messageSends: ["remove:ifAbsent:", "nonLocalReturns"],
  25433. referencedClasses: []
  25434. }),
  25435. smalltalk.MethodLexicalScope);
  25436. smalltalk.addMethod(
  25437. smalltalk.method({
  25438. selector: "unknownVariables",
  25439. category: 'accessing',
  25440. fn: function (){
  25441. var self=this;
  25442. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  25443. return smalltalk.withContext(function($ctx1) {
  25444. var $2,$1;
  25445. $2=self["@unknownVariables"];
  25446. if(($receiver = $2) == nil || $receiver == undefined){
  25447. self["@unknownVariables"]=_st($OrderedCollection())._new();
  25448. $1=self["@unknownVariables"];
  25449. } else {
  25450. $1=$2;
  25451. };
  25452. return $1;
  25453. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},smalltalk.MethodLexicalScope)})},
  25454. args: [],
  25455. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  25456. messageSends: ["ifNil:", "new"],
  25457. referencedClasses: ["OrderedCollection"]
  25458. }),
  25459. smalltalk.MethodLexicalScope);
  25460. smalltalk.addClass('ScopeVar', smalltalk.Object, ['scope', 'name'], 'Compiler-Semantic');
  25461. 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.";
  25462. smalltalk.addMethod(
  25463. smalltalk.method({
  25464. selector: "alias",
  25465. category: 'accessing',
  25466. fn: function (){
  25467. var self=this;
  25468. return smalltalk.withContext(function($ctx1) {
  25469. var $1;
  25470. $1=_st(self._name())._asVariableName();
  25471. return $1;
  25472. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.ScopeVar)})},
  25473. args: [],
  25474. source: "alias\x0a\x09^ self name asVariableName",
  25475. messageSends: ["asVariableName", "name"],
  25476. referencedClasses: []
  25477. }),
  25478. smalltalk.ScopeVar);
  25479. smalltalk.addMethod(
  25480. smalltalk.method({
  25481. selector: "isArgVar",
  25482. category: 'testing',
  25483. fn: function (){
  25484. var self=this;
  25485. return smalltalk.withContext(function($ctx1) {
  25486. return false;
  25487. }, function($ctx1) {$ctx1.fill(self,"isArgVar",{},smalltalk.ScopeVar)})},
  25488. args: [],
  25489. source: "isArgVar\x0a\x09^ false",
  25490. messageSends: [],
  25491. referencedClasses: []
  25492. }),
  25493. smalltalk.ScopeVar);
  25494. smalltalk.addMethod(
  25495. smalltalk.method({
  25496. selector: "isClassRefVar",
  25497. category: 'testing',
  25498. fn: function (){
  25499. var self=this;
  25500. return smalltalk.withContext(function($ctx1) {
  25501. return false;
  25502. }, function($ctx1) {$ctx1.fill(self,"isClassRefVar",{},smalltalk.ScopeVar)})},
  25503. args: [],
  25504. source: "isClassRefVar\x0a\x09^ false",
  25505. messageSends: [],
  25506. referencedClasses: []
  25507. }),
  25508. smalltalk.ScopeVar);
  25509. smalltalk.addMethod(
  25510. smalltalk.method({
  25511. selector: "isInstanceVar",
  25512. category: 'testing',
  25513. fn: function (){
  25514. var self=this;
  25515. return smalltalk.withContext(function($ctx1) {
  25516. return false;
  25517. }, function($ctx1) {$ctx1.fill(self,"isInstanceVar",{},smalltalk.ScopeVar)})},
  25518. args: [],
  25519. source: "isInstanceVar\x0a\x09^ false",
  25520. messageSends: [],
  25521. referencedClasses: []
  25522. }),
  25523. smalltalk.ScopeVar);
  25524. smalltalk.addMethod(
  25525. smalltalk.method({
  25526. selector: "isPseudoVar",
  25527. category: 'testing',
  25528. fn: function (){
  25529. var self=this;
  25530. return smalltalk.withContext(function($ctx1) {
  25531. return false;
  25532. }, function($ctx1) {$ctx1.fill(self,"isPseudoVar",{},smalltalk.ScopeVar)})},
  25533. args: [],
  25534. source: "isPseudoVar\x0a\x09^ false",
  25535. messageSends: [],
  25536. referencedClasses: []
  25537. }),
  25538. smalltalk.ScopeVar);
  25539. smalltalk.addMethod(
  25540. smalltalk.method({
  25541. selector: "isTempVar",
  25542. category: 'testing',
  25543. fn: function (){
  25544. var self=this;
  25545. return smalltalk.withContext(function($ctx1) {
  25546. return false;
  25547. }, function($ctx1) {$ctx1.fill(self,"isTempVar",{},smalltalk.ScopeVar)})},
  25548. args: [],
  25549. source: "isTempVar\x0a\x09^ false",
  25550. messageSends: [],
  25551. referencedClasses: []
  25552. }),
  25553. smalltalk.ScopeVar);
  25554. smalltalk.addMethod(
  25555. smalltalk.method({
  25556. selector: "isUnknownVar",
  25557. category: 'testing',
  25558. fn: function (){
  25559. var self=this;
  25560. return smalltalk.withContext(function($ctx1) {
  25561. return false;
  25562. }, function($ctx1) {$ctx1.fill(self,"isUnknownVar",{},smalltalk.ScopeVar)})},
  25563. args: [],
  25564. source: "isUnknownVar\x0a\x09^ false",
  25565. messageSends: [],
  25566. referencedClasses: []
  25567. }),
  25568. smalltalk.ScopeVar);
  25569. smalltalk.addMethod(
  25570. smalltalk.method({
  25571. selector: "name",
  25572. category: 'accessing',
  25573. fn: function (){
  25574. var self=this;
  25575. return smalltalk.withContext(function($ctx1) {
  25576. var $1;
  25577. $1=self["@name"];
  25578. return $1;
  25579. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.ScopeVar)})},
  25580. args: [],
  25581. source: "name\x0a\x09^ name",
  25582. messageSends: [],
  25583. referencedClasses: []
  25584. }),
  25585. smalltalk.ScopeVar);
  25586. smalltalk.addMethod(
  25587. smalltalk.method({
  25588. selector: "name:",
  25589. category: 'accessing',
  25590. fn: function (aString){
  25591. var self=this;
  25592. return smalltalk.withContext(function($ctx1) {
  25593. self["@name"]=aString;
  25594. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.ScopeVar)})},
  25595. args: ["aString"],
  25596. source: "name: aString\x0a\x09name := aString",
  25597. messageSends: [],
  25598. referencedClasses: []
  25599. }),
  25600. smalltalk.ScopeVar);
  25601. smalltalk.addMethod(
  25602. smalltalk.method({
  25603. selector: "scope",
  25604. category: 'accessing',
  25605. fn: function (){
  25606. var self=this;
  25607. return smalltalk.withContext(function($ctx1) {
  25608. var $1;
  25609. $1=self["@scope"];
  25610. return $1;
  25611. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.ScopeVar)})},
  25612. args: [],
  25613. source: "scope\x0a\x09^ scope",
  25614. messageSends: [],
  25615. referencedClasses: []
  25616. }),
  25617. smalltalk.ScopeVar);
  25618. smalltalk.addMethod(
  25619. smalltalk.method({
  25620. selector: "scope:",
  25621. category: 'accessing',
  25622. fn: function (aScope){
  25623. var self=this;
  25624. return smalltalk.withContext(function($ctx1) {
  25625. self["@scope"]=aScope;
  25626. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},smalltalk.ScopeVar)})},
  25627. args: ["aScope"],
  25628. source: "scope: aScope\x0a\x09scope := aScope",
  25629. messageSends: [],
  25630. referencedClasses: []
  25631. }),
  25632. smalltalk.ScopeVar);
  25633. smalltalk.addMethod(
  25634. smalltalk.method({
  25635. selector: "validateAssignment",
  25636. category: 'testing',
  25637. fn: function (){
  25638. var self=this;
  25639. function $InvalidAssignmentError(){return smalltalk.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  25640. return smalltalk.withContext(function($ctx1) {
  25641. var $1,$2,$3;
  25642. $1=_st(self._isArgVar())._or_((function(){
  25643. return smalltalk.withContext(function($ctx2) {
  25644. return self._isPseudoVar();
  25645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  25646. if(smalltalk.assert($1)){
  25647. $2=_st($InvalidAssignmentError())._new();
  25648. _st($2)._variableName_(self._name());
  25649. $3=_st($2)._signal();
  25650. $3;
  25651. };
  25652. return self}, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},smalltalk.ScopeVar)})},
  25653. args: [],
  25654. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  25655. messageSends: ["ifTrue:", "variableName:", "name", "new", "signal", "or:", "isPseudoVar", "isArgVar"],
  25656. referencedClasses: ["InvalidAssignmentError"]
  25657. }),
  25658. smalltalk.ScopeVar);
  25659. smalltalk.addMethod(
  25660. smalltalk.method({
  25661. selector: "on:",
  25662. category: 'instance creation',
  25663. fn: function (aString){
  25664. var self=this;
  25665. return smalltalk.withContext(function($ctx1) {
  25666. var $2,$3,$1;
  25667. $2=self._new();
  25668. _st($2)._name_(aString);
  25669. $3=_st($2)._yourself();
  25670. $1=$3;
  25671. return $1;
  25672. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},smalltalk.ScopeVar.klass)})},
  25673. args: ["aString"],
  25674. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  25675. messageSends: ["name:", "new", "yourself"],
  25676. referencedClasses: []
  25677. }),
  25678. smalltalk.ScopeVar.klass);
  25679. smalltalk.addClass('AliasVar', smalltalk.ScopeVar, ['node'], 'Compiler-Semantic');
  25680. smalltalk.AliasVar.comment="I am an internally defined variable by the compiler";
  25681. smalltalk.addMethod(
  25682. smalltalk.method({
  25683. selector: "node",
  25684. category: 'accessing',
  25685. fn: function (){
  25686. var self=this;
  25687. return smalltalk.withContext(function($ctx1) {
  25688. var $1;
  25689. $1=self["@node"];
  25690. return $1;
  25691. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.AliasVar)})},
  25692. args: [],
  25693. source: "node\x0a\x09^ node",
  25694. messageSends: [],
  25695. referencedClasses: []
  25696. }),
  25697. smalltalk.AliasVar);
  25698. smalltalk.addMethod(
  25699. smalltalk.method({
  25700. selector: "node:",
  25701. category: 'accessing',
  25702. fn: function (aNode){
  25703. var self=this;
  25704. return smalltalk.withContext(function($ctx1) {
  25705. self["@node"]=aNode;
  25706. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.AliasVar)})},
  25707. args: ["aNode"],
  25708. source: "node: aNode\x0a\x09node := aNode",
  25709. messageSends: [],
  25710. referencedClasses: []
  25711. }),
  25712. smalltalk.AliasVar);
  25713. smalltalk.addClass('ArgVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25714. smalltalk.ArgVar.comment="I am an argument of a method or block.";
  25715. smalltalk.addMethod(
  25716. smalltalk.method({
  25717. selector: "isArgVar",
  25718. category: 'testing',
  25719. fn: function (){
  25720. var self=this;
  25721. return smalltalk.withContext(function($ctx1) {
  25722. return true;
  25723. }, function($ctx1) {$ctx1.fill(self,"isArgVar",{},smalltalk.ArgVar)})},
  25724. args: [],
  25725. source: "isArgVar\x0a\x09^ true",
  25726. messageSends: [],
  25727. referencedClasses: []
  25728. }),
  25729. smalltalk.ArgVar);
  25730. smalltalk.addClass('ClassRefVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25731. smalltalk.ClassRefVar.comment="I am an class reference variable";
  25732. smalltalk.addMethod(
  25733. smalltalk.method({
  25734. selector: "alias",
  25735. category: 'accessing',
  25736. fn: function (){
  25737. var self=this;
  25738. return smalltalk.withContext(function($ctx1) {
  25739. var $1;
  25740. $1=_st("$".__comma(self._name())).__comma("()");
  25741. return $1;
  25742. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.ClassRefVar)})},
  25743. args: [],
  25744. 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, '()'",
  25745. messageSends: [",", "name"],
  25746. referencedClasses: []
  25747. }),
  25748. smalltalk.ClassRefVar);
  25749. smalltalk.addMethod(
  25750. smalltalk.method({
  25751. selector: "isClassRefVar",
  25752. category: 'testing',
  25753. fn: function (){
  25754. var self=this;
  25755. return smalltalk.withContext(function($ctx1) {
  25756. return true;
  25757. }, function($ctx1) {$ctx1.fill(self,"isClassRefVar",{},smalltalk.ClassRefVar)})},
  25758. args: [],
  25759. source: "isClassRefVar\x0a\x09^ true",
  25760. messageSends: [],
  25761. referencedClasses: []
  25762. }),
  25763. smalltalk.ClassRefVar);
  25764. smalltalk.addClass('InstanceVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25765. smalltalk.InstanceVar.comment="I am an instance variable of a method or block.";
  25766. smalltalk.addMethod(
  25767. smalltalk.method({
  25768. selector: "alias",
  25769. category: 'testing',
  25770. fn: function (){
  25771. var self=this;
  25772. return smalltalk.withContext(function($ctx1) {
  25773. var $1;
  25774. $1=_st("self[\x22@".__comma(self._name())).__comma("\x22]");
  25775. return $1;
  25776. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.InstanceVar)})},
  25777. args: [],
  25778. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  25779. messageSends: [",", "name"],
  25780. referencedClasses: []
  25781. }),
  25782. smalltalk.InstanceVar);
  25783. smalltalk.addMethod(
  25784. smalltalk.method({
  25785. selector: "isInstanceVar",
  25786. category: 'testing',
  25787. fn: function (){
  25788. var self=this;
  25789. return smalltalk.withContext(function($ctx1) {
  25790. return true;
  25791. }, function($ctx1) {$ctx1.fill(self,"isInstanceVar",{},smalltalk.InstanceVar)})},
  25792. args: [],
  25793. source: "isInstanceVar\x0a\x09^ true",
  25794. messageSends: [],
  25795. referencedClasses: []
  25796. }),
  25797. smalltalk.InstanceVar);
  25798. smalltalk.addClass('PseudoVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25799. smalltalk.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  25800. smalltalk.addMethod(
  25801. smalltalk.method({
  25802. selector: "alias",
  25803. category: 'accessing',
  25804. fn: function (){
  25805. var self=this;
  25806. return smalltalk.withContext(function($ctx1) {
  25807. var $1;
  25808. $1=self._name();
  25809. return $1;
  25810. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.PseudoVar)})},
  25811. args: [],
  25812. source: "alias\x0a\x09^ self name",
  25813. messageSends: ["name"],
  25814. referencedClasses: []
  25815. }),
  25816. smalltalk.PseudoVar);
  25817. smalltalk.addMethod(
  25818. smalltalk.method({
  25819. selector: "isPseudoVar",
  25820. category: 'testing',
  25821. fn: function (){
  25822. var self=this;
  25823. return smalltalk.withContext(function($ctx1) {
  25824. return true;
  25825. }, function($ctx1) {$ctx1.fill(self,"isPseudoVar",{},smalltalk.PseudoVar)})},
  25826. args: [],
  25827. source: "isPseudoVar\x0a\x09^ true",
  25828. messageSends: [],
  25829. referencedClasses: []
  25830. }),
  25831. smalltalk.PseudoVar);
  25832. smalltalk.addClass('TempVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25833. smalltalk.TempVar.comment="I am an temporary variable of a method or block.";
  25834. smalltalk.addMethod(
  25835. smalltalk.method({
  25836. selector: "isTempVar",
  25837. category: 'testing',
  25838. fn: function (){
  25839. var self=this;
  25840. return smalltalk.withContext(function($ctx1) {
  25841. return true;
  25842. }, function($ctx1) {$ctx1.fill(self,"isTempVar",{},smalltalk.TempVar)})},
  25843. args: [],
  25844. source: "isTempVar\x0a\x09^ true",
  25845. messageSends: [],
  25846. referencedClasses: []
  25847. }),
  25848. smalltalk.TempVar);
  25849. smalltalk.addClass('UnknownVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25850. smalltalk.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  25851. smalltalk.addMethod(
  25852. smalltalk.method({
  25853. selector: "isUnknownVar",
  25854. category: 'testing',
  25855. fn: function (){
  25856. var self=this;
  25857. return smalltalk.withContext(function($ctx1) {
  25858. return true;
  25859. }, function($ctx1) {$ctx1.fill(self,"isUnknownVar",{},smalltalk.UnknownVar)})},
  25860. args: [],
  25861. source: "isUnknownVar\x0a\x09^ true",
  25862. messageSends: [],
  25863. referencedClasses: []
  25864. }),
  25865. smalltalk.UnknownVar);
  25866. smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  25867. smalltalk.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  25868. smalltalk.addMethod(
  25869. smalltalk.method({
  25870. selector: "classReferences",
  25871. category: 'accessing',
  25872. fn: function (){
  25873. var self=this;
  25874. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  25875. return smalltalk.withContext(function($ctx1) {
  25876. var $2,$1;
  25877. $2=self["@classReferences"];
  25878. if(($receiver = $2) == nil || $receiver == undefined){
  25879. self["@classReferences"]=_st($Set())._new();
  25880. $1=self["@classReferences"];
  25881. } else {
  25882. $1=$2;
  25883. };
  25884. return $1;
  25885. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},smalltalk.SemanticAnalyzer)})},
  25886. args: [],
  25887. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  25888. messageSends: ["ifNil:", "new"],
  25889. referencedClasses: ["Set"]
  25890. }),
  25891. smalltalk.SemanticAnalyzer);
  25892. smalltalk.addMethod(
  25893. smalltalk.method({
  25894. selector: "errorShadowingVariable:",
  25895. category: 'error handling',
  25896. fn: function (aString){
  25897. var self=this;
  25898. function $ShadowingVariableError(){return smalltalk.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  25899. return smalltalk.withContext(function($ctx1) {
  25900. var $1,$2;
  25901. $1=_st($ShadowingVariableError())._new();
  25902. _st($1)._variableName_(aString);
  25903. $2=_st($1)._signal();
  25904. return self}, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  25905. args: ["aString"],
  25906. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  25907. messageSends: ["variableName:", "new", "signal"],
  25908. referencedClasses: ["ShadowingVariableError"]
  25909. }),
  25910. smalltalk.SemanticAnalyzer);
  25911. smalltalk.addMethod(
  25912. smalltalk.method({
  25913. selector: "errorUnknownVariable:",
  25914. category: 'error handling',
  25915. fn: function (aNode){
  25916. var self=this;
  25917. var identifier;
  25918. function $UnknownVariableError(){return smalltalk.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  25919. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  25920. return smalltalk.withContext(function($ctx1) {
  25921. var $1,$2,$3;
  25922. identifier=_st(aNode)._value();
  25923. $1=_st(_st(_st(_st(_st($Smalltalk())._current())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  25924. return smalltalk.withContext(function($ctx2) {
  25925. return self._isVariableGloballyUndefined_(identifier);
  25926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  25927. if(smalltalk.assert($1)){
  25928. $2=_st($UnknownVariableError())._new();
  25929. _st($2)._variableName_(_st(aNode)._value());
  25930. $3=_st($2)._signal();
  25931. $3;
  25932. } else {
  25933. _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
  25934. };
  25935. return self}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},smalltalk.SemanticAnalyzer)})},
  25936. args: ["aNode"],
  25937. 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 ]",
  25938. messageSends: ["value", "ifTrue:ifFalse:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope", "and:", "isVariableGloballyUndefined:", "not", "includes:", "globalJsVariables", "current"],
  25939. referencedClasses: ["UnknownVariableError", "Smalltalk"]
  25940. }),
  25941. smalltalk.SemanticAnalyzer);
  25942. smalltalk.addMethod(
  25943. smalltalk.method({
  25944. selector: "isVariableGloballyUndefined:",
  25945. category: 'testing',
  25946. fn: function (aString){
  25947. var self=this;
  25948. return smalltalk.withContext(function($ctx1) {
  25949. return eval('typeof ' + aString + ' == "undefined"');
  25950. return self}, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  25951. args: ["aString"],
  25952. source: "isVariableGloballyUndefined: aString\x0a\x09<return eval('typeof ' + aString + ' == \x22undefined\x22')>",
  25953. messageSends: [],
  25954. referencedClasses: []
  25955. }),
  25956. smalltalk.SemanticAnalyzer);
  25957. smalltalk.addMethod(
  25958. smalltalk.method({
  25959. selector: "messageSends",
  25960. category: 'accessing',
  25961. fn: function (){
  25962. var self=this;
  25963. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  25964. return smalltalk.withContext(function($ctx1) {
  25965. var $2,$1;
  25966. $2=self["@messageSends"];
  25967. if(($receiver = $2) == nil || $receiver == undefined){
  25968. self["@messageSends"]=_st($Dictionary())._new();
  25969. $1=self["@messageSends"];
  25970. } else {
  25971. $1=$2;
  25972. };
  25973. return $1;
  25974. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.SemanticAnalyzer)})},
  25975. args: [],
  25976. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  25977. messageSends: ["ifNil:", "new"],
  25978. referencedClasses: ["Dictionary"]
  25979. }),
  25980. smalltalk.SemanticAnalyzer);
  25981. smalltalk.addMethod(
  25982. smalltalk.method({
  25983. selector: "newBlockScope",
  25984. category: 'factory',
  25985. fn: function (){
  25986. var self=this;
  25987. function $LexicalScope(){return smalltalk.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  25988. return smalltalk.withContext(function($ctx1) {
  25989. var $1;
  25990. $1=self._newScopeOfClass_($LexicalScope());
  25991. return $1;
  25992. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},smalltalk.SemanticAnalyzer)})},
  25993. args: [],
  25994. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  25995. messageSends: ["newScopeOfClass:"],
  25996. referencedClasses: ["LexicalScope"]
  25997. }),
  25998. smalltalk.SemanticAnalyzer);
  25999. smalltalk.addMethod(
  26000. smalltalk.method({
  26001. selector: "newMethodScope",
  26002. category: 'factory',
  26003. fn: function (){
  26004. var self=this;
  26005. function $MethodLexicalScope(){return smalltalk.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  26006. return smalltalk.withContext(function($ctx1) {
  26007. var $1;
  26008. $1=self._newScopeOfClass_($MethodLexicalScope());
  26009. return $1;
  26010. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},smalltalk.SemanticAnalyzer)})},
  26011. args: [],
  26012. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  26013. messageSends: ["newScopeOfClass:"],
  26014. referencedClasses: ["MethodLexicalScope"]
  26015. }),
  26016. smalltalk.SemanticAnalyzer);
  26017. smalltalk.addMethod(
  26018. smalltalk.method({
  26019. selector: "newScopeOfClass:",
  26020. category: 'factory',
  26021. fn: function (aLexicalScopeClass){
  26022. var self=this;
  26023. return smalltalk.withContext(function($ctx1) {
  26024. var $2,$3,$1;
  26025. $2=_st(aLexicalScopeClass)._new();
  26026. _st($2)._outerScope_(self["@currentScope"]);
  26027. $3=_st($2)._yourself();
  26028. $1=$3;
  26029. return $1;
  26030. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},smalltalk.SemanticAnalyzer)})},
  26031. args: ["aLexicalScopeClass"],
  26032. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  26033. messageSends: ["outerScope:", "new", "yourself"],
  26034. referencedClasses: []
  26035. }),
  26036. smalltalk.SemanticAnalyzer);
  26037. smalltalk.addMethod(
  26038. smalltalk.method({
  26039. selector: "popScope",
  26040. category: 'scope',
  26041. fn: function (){
  26042. var self=this;
  26043. return smalltalk.withContext(function($ctx1) {
  26044. var $1;
  26045. $1=self["@currentScope"];
  26046. if(($receiver = $1) == nil || $receiver == undefined){
  26047. $1;
  26048. } else {
  26049. self["@currentScope"]=_st(self["@currentScope"])._outerScope();
  26050. self["@currentScope"];
  26051. };
  26052. return self}, function($ctx1) {$ctx1.fill(self,"popScope",{},smalltalk.SemanticAnalyzer)})},
  26053. args: [],
  26054. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  26055. messageSends: ["ifNotNil:", "outerScope"],
  26056. referencedClasses: []
  26057. }),
  26058. smalltalk.SemanticAnalyzer);
  26059. smalltalk.addMethod(
  26060. smalltalk.method({
  26061. selector: "pushScope:",
  26062. category: 'scope',
  26063. fn: function (aScope){
  26064. var self=this;
  26065. return smalltalk.withContext(function($ctx1) {
  26066. _st(aScope)._outerScope_(self["@currentScope"]);
  26067. self["@currentScope"]=aScope;
  26068. return self}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},smalltalk.SemanticAnalyzer)})},
  26069. args: ["aScope"],
  26070. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  26071. messageSends: ["outerScope:"],
  26072. referencedClasses: []
  26073. }),
  26074. smalltalk.SemanticAnalyzer);
  26075. smalltalk.addMethod(
  26076. smalltalk.method({
  26077. selector: "superSends",
  26078. category: 'accessing',
  26079. fn: function (){
  26080. var self=this;
  26081. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  26082. return smalltalk.withContext(function($ctx1) {
  26083. var $2,$1;
  26084. $2=self["@superSends"];
  26085. if(($receiver = $2) == nil || $receiver == undefined){
  26086. self["@superSends"]=_st($Dictionary())._new();
  26087. $1=self["@superSends"];
  26088. } else {
  26089. $1=$2;
  26090. };
  26091. return $1;
  26092. }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.SemanticAnalyzer)})},
  26093. args: [],
  26094. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  26095. messageSends: ["ifNil:", "new"],
  26096. referencedClasses: ["Dictionary"]
  26097. }),
  26098. smalltalk.SemanticAnalyzer);
  26099. smalltalk.addMethod(
  26100. smalltalk.method({
  26101. selector: "theClass",
  26102. category: 'accessing',
  26103. fn: function (){
  26104. var self=this;
  26105. return smalltalk.withContext(function($ctx1) {
  26106. var $1;
  26107. $1=self["@theClass"];
  26108. return $1;
  26109. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SemanticAnalyzer)})},
  26110. args: [],
  26111. source: "theClass\x0a\x09^ theClass",
  26112. messageSends: [],
  26113. referencedClasses: []
  26114. }),
  26115. smalltalk.SemanticAnalyzer);
  26116. smalltalk.addMethod(
  26117. smalltalk.method({
  26118. selector: "theClass:",
  26119. category: 'accessing',
  26120. fn: function (aClass){
  26121. var self=this;
  26122. return smalltalk.withContext(function($ctx1) {
  26123. self["@theClass"]=aClass;
  26124. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SemanticAnalyzer)})},
  26125. args: ["aClass"],
  26126. source: "theClass: aClass\x0a\x09theClass := aClass",
  26127. messageSends: [],
  26128. referencedClasses: []
  26129. }),
  26130. smalltalk.SemanticAnalyzer);
  26131. smalltalk.addMethod(
  26132. smalltalk.method({
  26133. selector: "validateVariableScope:",
  26134. category: 'scope',
  26135. fn: function (aString){
  26136. var self=this;
  26137. return smalltalk.withContext(function($ctx1) {
  26138. var $1;
  26139. $1=_st(self["@currentScope"])._lookupVariable_(aString);
  26140. if(($receiver = $1) == nil || $receiver == undefined){
  26141. $1;
  26142. } else {
  26143. self._errorShadowingVariable_(aString);
  26144. };
  26145. return self}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  26146. args: ["aString"],
  26147. 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 ]",
  26148. messageSends: ["ifNotNil:", "errorShadowingVariable:", "lookupVariable:"],
  26149. referencedClasses: []
  26150. }),
  26151. smalltalk.SemanticAnalyzer);
  26152. smalltalk.addMethod(
  26153. smalltalk.method({
  26154. selector: "visitAssignmentNode:",
  26155. category: 'visiting',
  26156. fn: function (aNode){
  26157. var self=this;
  26158. return smalltalk.withContext(function($ctx1) {
  26159. smalltalk.NodeVisitor.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]);
  26160. _st(_st(aNode)._left())._beAssigned();
  26161. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26162. args: ["aNode"],
  26163. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  26164. messageSends: ["visitAssignmentNode:", "beAssigned", "left"],
  26165. referencedClasses: []
  26166. }),
  26167. smalltalk.SemanticAnalyzer);
  26168. smalltalk.addMethod(
  26169. smalltalk.method({
  26170. selector: "visitBlockNode:",
  26171. category: 'visiting',
  26172. fn: function (aNode){
  26173. var self=this;
  26174. return smalltalk.withContext(function($ctx1) {
  26175. self._pushScope_(self._newBlockScope());
  26176. _st(aNode)._scope_(self["@currentScope"]);
  26177. _st(self["@currentScope"])._node_(aNode);
  26178. _st(_st(aNode)._parameters())._do_((function(each){
  26179. return smalltalk.withContext(function($ctx2) {
  26180. self._validateVariableScope_(each);
  26181. return _st(self["@currentScope"])._addArg_(each);
  26182. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26183. smalltalk.NodeVisitor.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  26184. self._popScope();
  26185. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26186. args: ["aNode"],
  26187. source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
  26188. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "do:", "validateVariableScope:", "addArg:", "parameters", "visitBlockNode:", "popScope"],
  26189. referencedClasses: []
  26190. }),
  26191. smalltalk.SemanticAnalyzer);
  26192. smalltalk.addMethod(
  26193. smalltalk.method({
  26194. selector: "visitCascadeNode:",
  26195. category: 'visiting',
  26196. fn: function (aNode){
  26197. var self=this;
  26198. return smalltalk.withContext(function($ctx1) {
  26199. var $1;
  26200. _st(_st(aNode)._nodes())._do_((function(each){
  26201. return smalltalk.withContext(function($ctx2) {
  26202. return _st(each)._receiver_(_st(aNode)._receiver());
  26203. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26204. smalltalk.NodeVisitor.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]);
  26205. $1=_st(_st(_st(aNode)._nodes())._first())._superSend();
  26206. if(smalltalk.assert($1)){
  26207. _st(_st(aNode)._nodes())._do_((function(each){
  26208. return smalltalk.withContext(function($ctx2) {
  26209. return _st(each)._superSend_(true);
  26210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26211. };
  26212. return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26213. args: ["aNode"],
  26214. source: "visitCascadeNode: aNode\x0a\x09\x22Populate the receiver into all children\x22\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09each receiver: aNode receiver ].\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ]]",
  26215. messageSends: ["do:", "receiver:", "receiver", "nodes", "visitCascadeNode:", "ifTrue:", "superSend:", "superSend", "first"],
  26216. referencedClasses: []
  26217. }),
  26218. smalltalk.SemanticAnalyzer);
  26219. smalltalk.addMethod(
  26220. smalltalk.method({
  26221. selector: "visitClassReferenceNode:",
  26222. category: 'visiting',
  26223. fn: function (aNode){
  26224. var self=this;
  26225. function $ClassRefVar(){return smalltalk.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  26226. return smalltalk.withContext(function($ctx1) {
  26227. var $1,$2;
  26228. _st(self._classReferences())._add_(_st(aNode)._value());
  26229. $1=_st($ClassRefVar())._new();
  26230. _st($1)._name_(_st(aNode)._value());
  26231. $2=_st($1)._yourself();
  26232. _st(aNode)._binding_($2);
  26233. return self}, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26234. args: ["aNode"],
  26235. source: "visitClassReferenceNode: aNode\x0a\x09self classReferences add: aNode value.\x0a\x09aNode binding: (ClassRefVar new name: aNode value; yourself)",
  26236. messageSends: ["add:", "value", "classReferences", "binding:", "name:", "new", "yourself"],
  26237. referencedClasses: ["ClassRefVar"]
  26238. }),
  26239. smalltalk.SemanticAnalyzer);
  26240. smalltalk.addMethod(
  26241. smalltalk.method({
  26242. selector: "visitMethodNode:",
  26243. category: 'visiting',
  26244. fn: function (aNode){
  26245. var self=this;
  26246. return smalltalk.withContext(function($ctx1) {
  26247. var $1,$2;
  26248. self._pushScope_(self._newMethodScope());
  26249. _st(aNode)._scope_(self["@currentScope"]);
  26250. _st(self["@currentScope"])._node_(aNode);
  26251. _st(_st(self._theClass())._allInstanceVariableNames())._do_((function(each){
  26252. return smalltalk.withContext(function($ctx2) {
  26253. return _st(self["@currentScope"])._addIVar_(each);
  26254. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26255. _st(_st(aNode)._arguments())._do_((function(each){
  26256. return smalltalk.withContext(function($ctx2) {
  26257. self._validateVariableScope_(each);
  26258. return _st(self["@currentScope"])._addArg_(each);
  26259. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26260. smalltalk.NodeVisitor.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]);
  26261. $1=aNode;
  26262. _st($1)._classReferences_(self._classReferences());
  26263. _st($1)._messageSends_(_st(self._messageSends())._keys());
  26264. $2=_st($1)._superSends_(_st(self._superSends())._keys());
  26265. self._popScope();
  26266. return self}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26267. args: ["aNode"],
  26268. 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",
  26269. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "addIVar:", "allInstanceVariableNames", "theClass", "validateVariableScope:", "addArg:", "arguments", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "superSends:", "superSends", "popScope"],
  26270. referencedClasses: []
  26271. }),
  26272. smalltalk.SemanticAnalyzer);
  26273. smalltalk.addMethod(
  26274. smalltalk.method({
  26275. selector: "visitReturnNode:",
  26276. category: 'visiting',
  26277. fn: function (aNode){
  26278. var self=this;
  26279. return smalltalk.withContext(function($ctx1) {
  26280. var $1;
  26281. _st(aNode)._scope_(self["@currentScope"]);
  26282. $1=_st(self["@currentScope"])._isMethodScope();
  26283. if(smalltalk.assert($1)){
  26284. _st(self["@currentScope"])._localReturn_(true);
  26285. } else {
  26286. _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  26287. };
  26288. smalltalk.NodeVisitor.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]);
  26289. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26290. args: ["aNode"],
  26291. 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",
  26292. messageSends: ["scope:", "ifTrue:ifFalse:", "localReturn:", "addNonLocalReturn:", "methodScope", "isMethodScope", "visitReturnNode:"],
  26293. referencedClasses: []
  26294. }),
  26295. smalltalk.SemanticAnalyzer);
  26296. smalltalk.addMethod(
  26297. smalltalk.method({
  26298. selector: "visitSendNode:",
  26299. category: 'visiting',
  26300. fn: function (aNode){
  26301. var self=this;
  26302. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  26303. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  26304. return smalltalk.withContext(function($ctx1) {
  26305. var $1,$2;
  26306. $1=_st(_st(_st(aNode)._receiver())._value()).__eq("super");
  26307. if(smalltalk.assert($1)){
  26308. _st(aNode)._superSend_(true);
  26309. _st(_st(aNode)._receiver())._value_("self");
  26310. _st(self._superSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  26311. return smalltalk.withContext(function($ctx2) {
  26312. return _st($Set())._new();
  26313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  26314. _st(_st(self._superSends())._at_(_st(aNode)._selector()))._add_(aNode);
  26315. } else {
  26316. $2=_st(_st($IRSendInliner())._inlinedSelectors())._includes_(_st(aNode)._selector());
  26317. if(smalltalk.assert($2)){
  26318. _st(aNode)._shouldBeInlined_(true);
  26319. _st(_st(aNode)._receiver())._shouldBeAliased_(true);
  26320. };
  26321. };
  26322. _st(self._messageSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  26323. return smalltalk.withContext(function($ctx2) {
  26324. return _st($Set())._new();
  26325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  26326. _st(_st(self._messageSends())._at_(_st(aNode)._selector()))._add_(aNode);
  26327. _st(aNode)._index_(_st(_st(self._messageSends())._at_(_st(aNode)._selector()))._size());
  26328. smalltalk.NodeVisitor.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  26329. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26330. args: ["aNode"],
  26331. 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",
  26332. messageSends: ["ifTrue:ifFalse:", "superSend:", "value:", "receiver", "at:ifAbsentPut:", "selector", "new", "superSends", "add:", "at:", "ifTrue:", "shouldBeInlined:", "shouldBeAliased:", "includes:", "inlinedSelectors", "=", "value", "messageSends", "index:", "size", "visitSendNode:"],
  26333. referencedClasses: ["Set", "IRSendInliner"]
  26334. }),
  26335. smalltalk.SemanticAnalyzer);
  26336. smalltalk.addMethod(
  26337. smalltalk.method({
  26338. selector: "visitSequenceNode:",
  26339. category: 'visiting',
  26340. fn: function (aNode){
  26341. var self=this;
  26342. return smalltalk.withContext(function($ctx1) {
  26343. _st(_st(aNode)._temps())._do_((function(each){
  26344. return smalltalk.withContext(function($ctx2) {
  26345. self._validateVariableScope_(each);
  26346. return _st(self["@currentScope"])._addTemp_(each);
  26347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26348. smalltalk.NodeVisitor.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]);
  26349. return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26350. args: ["aNode"],
  26351. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  26352. messageSends: ["do:", "validateVariableScope:", "addTemp:", "temps", "visitSequenceNode:"],
  26353. referencedClasses: []
  26354. }),
  26355. smalltalk.SemanticAnalyzer);
  26356. smalltalk.addMethod(
  26357. smalltalk.method({
  26358. selector: "visitVariableNode:",
  26359. category: 'visiting',
  26360. fn: function (aNode){
  26361. var self=this;
  26362. function $UnknownVar(){return smalltalk.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  26363. return smalltalk.withContext(function($ctx1) {
  26364. var $1,$3,$4,$5,$2;
  26365. $1=aNode;
  26366. $3=_st(self["@currentScope"])._lookupVariable_(aNode);
  26367. if(($receiver = $3) == nil || $receiver == undefined){
  26368. self._errorUnknownVariable_(aNode);
  26369. $4=_st($UnknownVar())._new();
  26370. _st($4)._name_(_st(aNode)._value());
  26371. $5=_st($4)._yourself();
  26372. $2=$5;
  26373. } else {
  26374. $2=$3;
  26375. };
  26376. _st($1)._binding_($2);
  26377. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26378. args: ["aNode"],
  26379. source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error\x22\x0a\x0a\x09aNode binding: ((currentScope lookupVariable: aNode) ifNil: [\x0a\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09UnknownVar new name: aNode value; yourself ])",
  26380. messageSends: ["binding:", "ifNil:", "errorUnknownVariable:", "name:", "value", "new", "yourself", "lookupVariable:"],
  26381. referencedClasses: ["UnknownVar"]
  26382. }),
  26383. smalltalk.SemanticAnalyzer);
  26384. smalltalk.addMethod(
  26385. smalltalk.method({
  26386. selector: "on:",
  26387. category: 'instance creation',
  26388. fn: function (aClass){
  26389. var self=this;
  26390. return smalltalk.withContext(function($ctx1) {
  26391. var $2,$3,$1;
  26392. $2=self._new();
  26393. _st($2)._theClass_(aClass);
  26394. $3=_st($2)._yourself();
  26395. $1=$3;
  26396. return $1;
  26397. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},smalltalk.SemanticAnalyzer.klass)})},
  26398. args: ["aClass"],
  26399. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  26400. messageSends: ["theClass:", "new", "yourself"],
  26401. referencedClasses: []
  26402. }),
  26403. smalltalk.SemanticAnalyzer.klass);
  26404. smalltalk.addPackage('Compiler-Interpreter');
  26405. smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['methodContext', 'outerContext', 'pc', 'locals', 'method'], 'Compiler-Interpreter');
  26406. 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)";
  26407. smalltalk.addMethod(
  26408. smalltalk.method({
  26409. selector: "asString",
  26410. category: 'converting',
  26411. fn: function (){
  26412. var self=this;
  26413. return smalltalk.withContext(function($ctx1) {
  26414. var $1;
  26415. $1=_st(self["@methodContext"])._asString();
  26416. return $1;
  26417. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.AIContext)})},
  26418. args: [],
  26419. source: "asString\x0a\x09^ methodContext asString",
  26420. messageSends: ["asString"],
  26421. referencedClasses: []
  26422. }),
  26423. smalltalk.AIContext);
  26424. smalltalk.addMethod(
  26425. smalltalk.method({
  26426. selector: "home",
  26427. category: 'accessing',
  26428. fn: function (){
  26429. var self=this;
  26430. return smalltalk.withContext(function($ctx1) {
  26431. var $2,$1;
  26432. $2=self._isBlockContext();
  26433. if(smalltalk.assert($2)){
  26434. $1=_st(self._outerContext())._methodContext();
  26435. } else {
  26436. $1=self;
  26437. };
  26438. return $1;
  26439. }, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.AIContext)})},
  26440. args: [],
  26441. source: "home\x0a\x09^ self isBlockContext \x0a\x09\x09ifTrue: [ self outerContext methodContext ]\x0a\x09\x09ifFalse: [ self ]",
  26442. messageSends: ["ifTrue:ifFalse:", "methodContext", "outerContext", "isBlockContext"],
  26443. referencedClasses: []
  26444. }),
  26445. smalltalk.AIContext);
  26446. smalltalk.addMethod(
  26447. smalltalk.method({
  26448. selector: "initializeFromMethodContext:",
  26449. category: 'initialization',
  26450. fn: function (aMethodContext){
  26451. var self=this;
  26452. return smalltalk.withContext(function($ctx1) {
  26453. var $1,$2;
  26454. self["@methodContext"]=aMethodContext;
  26455. self._pc_(_st(aMethodContext)._pc());
  26456. self._receiver_(_st(aMethodContext)._receiver());
  26457. self._method_(_st(aMethodContext)._method());
  26458. $1=_st(aMethodContext)._outerContext();
  26459. if(($receiver = $1) == nil || $receiver == undefined){
  26460. $1;
  26461. } else {
  26462. var outer;
  26463. outer=$receiver;
  26464. $2=_st(outer)._methodContext();
  26465. if(($receiver = $2) == nil || $receiver == undefined){
  26466. $2;
  26467. } else {
  26468. self._outerContext_(_st(self._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  26469. };
  26470. _st(_st(aMethodContext)._locals())._keysAndValuesDo_((function(key,value){
  26471. return smalltalk.withContext(function($ctx2) {
  26472. return _st(self._locals())._at_put_(key,value);
  26473. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  26474. };
  26475. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext)})},
  26476. args: ["aMethodContext"],
  26477. source: "initializeFromMethodContext: aMethodContext\x0a\x09methodContext := aMethodContext.\x0a\x09\x0a\x09self pc: aMethodContext pc.\x0a\x09self receiver: aMethodContext receiver.\x0a\x09self method: aMethodContext method.\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
  26478. messageSends: ["pc:", "pc", "receiver:", "receiver", "method:", "method", "ifNotNil:", "outerContext:", "fromMethodContext:", "outerContext", "class", "methodContext", "keysAndValuesDo:", "at:put:", "locals"],
  26479. referencedClasses: []
  26480. }),
  26481. smalltalk.AIContext);
  26482. smalltalk.addMethod(
  26483. smalltalk.method({
  26484. selector: "initializeLocals",
  26485. category: 'initialization',
  26486. fn: function (){
  26487. var self=this;
  26488. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  26489. return smalltalk.withContext(function($ctx1) {
  26490. self["@locals"]=_st($Dictionary())._new();
  26491. _st(self["@locals"])._at_put_("thisContext",self);
  26492. return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},smalltalk.AIContext)})},
  26493. args: [],
  26494. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  26495. messageSends: ["new", "at:put:"],
  26496. referencedClasses: ["Dictionary"]
  26497. }),
  26498. smalltalk.AIContext);
  26499. smalltalk.addMethod(
  26500. smalltalk.method({
  26501. selector: "isBlockContext",
  26502. category: 'testing',
  26503. fn: function (){
  26504. var self=this;
  26505. return smalltalk.withContext(function($ctx1) {
  26506. var $1;
  26507. $1=_st(self["@methodContext"])._isBlockContext();
  26508. return $1;
  26509. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.AIContext)})},
  26510. args: [],
  26511. source: "isBlockContext\x0a\x09^ methodContext isBlockContext",
  26512. messageSends: ["isBlockContext"],
  26513. referencedClasses: []
  26514. }),
  26515. smalltalk.AIContext);
  26516. smalltalk.addMethod(
  26517. smalltalk.method({
  26518. selector: "localAt:",
  26519. category: 'accessing',
  26520. fn: function (aString){
  26521. var self=this;
  26522. return smalltalk.withContext(function($ctx1) {
  26523. var $1;
  26524. $1=_st(self._locals())._at_ifAbsent_(aString,(function(){
  26525. return smalltalk.withContext(function($ctx2) {
  26526. return nil;
  26527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  26528. return $1;
  26529. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString},smalltalk.AIContext)})},
  26530. args: ["aString"],
  26531. source: "localAt: aString\x0a\x09^ self locals at: aString ifAbsent: [ nil ]",
  26532. messageSends: ["at:ifAbsent:", "locals"],
  26533. referencedClasses: []
  26534. }),
  26535. smalltalk.AIContext);
  26536. smalltalk.addMethod(
  26537. smalltalk.method({
  26538. selector: "localAt:put:",
  26539. category: 'accessing',
  26540. fn: function (aString,anObject){
  26541. var self=this;
  26542. return smalltalk.withContext(function($ctx1) {
  26543. _st(self._locals())._at_put_(aString,anObject);
  26544. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject},smalltalk.AIContext)})},
  26545. args: ["aString", "anObject"],
  26546. source: "localAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  26547. messageSends: ["at:put:", "locals"],
  26548. referencedClasses: []
  26549. }),
  26550. smalltalk.AIContext);
  26551. smalltalk.addMethod(
  26552. smalltalk.method({
  26553. selector: "locals",
  26554. category: 'accessing',
  26555. fn: function (){
  26556. var self=this;
  26557. return smalltalk.withContext(function($ctx1) {
  26558. var $1,$2;
  26559. $1=self["@locals"];
  26560. if(($receiver = $1) == nil || $receiver == undefined){
  26561. self._initializeLocals();
  26562. } else {
  26563. $1;
  26564. };
  26565. $2=self["@locals"];
  26566. return $2;
  26567. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.AIContext)})},
  26568. args: [],
  26569. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  26570. messageSends: ["ifNil:", "initializeLocals"],
  26571. referencedClasses: []
  26572. }),
  26573. smalltalk.AIContext);
  26574. smalltalk.addMethod(
  26575. smalltalk.method({
  26576. selector: "method",
  26577. category: 'accessing',
  26578. fn: function (){
  26579. var self=this;
  26580. return smalltalk.withContext(function($ctx1) {
  26581. var $1;
  26582. $1=self["@method"];
  26583. return $1;
  26584. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.AIContext)})},
  26585. args: [],
  26586. source: "method\x0a\x09^ method",
  26587. messageSends: [],
  26588. referencedClasses: []
  26589. }),
  26590. smalltalk.AIContext);
  26591. smalltalk.addMethod(
  26592. smalltalk.method({
  26593. selector: "method:",
  26594. category: 'accessing',
  26595. fn: function (aCompiledMethod){
  26596. var self=this;
  26597. return smalltalk.withContext(function($ctx1) {
  26598. self["@method"]=aCompiledMethod;
  26599. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.AIContext)})},
  26600. args: ["aCompiledMethod"],
  26601. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  26602. messageSends: [],
  26603. referencedClasses: []
  26604. }),
  26605. smalltalk.AIContext);
  26606. smalltalk.addMethod(
  26607. smalltalk.method({
  26608. selector: "outerContext",
  26609. category: 'accessing',
  26610. fn: function (){
  26611. var self=this;
  26612. return smalltalk.withContext(function($ctx1) {
  26613. var $1;
  26614. $1=self["@outerContext"];
  26615. return $1;
  26616. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.AIContext)})},
  26617. args: [],
  26618. source: "outerContext\x0a\x09^ outerContext",
  26619. messageSends: [],
  26620. referencedClasses: []
  26621. }),
  26622. smalltalk.AIContext);
  26623. smalltalk.addMethod(
  26624. smalltalk.method({
  26625. selector: "outerContext:",
  26626. category: 'accessing',
  26627. fn: function (anAIContext){
  26628. var self=this;
  26629. return smalltalk.withContext(function($ctx1) {
  26630. self["@outerContext"]=anAIContext;
  26631. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  26632. args: ["anAIContext"],
  26633. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext",
  26634. messageSends: [],
  26635. referencedClasses: []
  26636. }),
  26637. smalltalk.AIContext);
  26638. smalltalk.addMethod(
  26639. smalltalk.method({
  26640. selector: "pc",
  26641. category: 'accessing',
  26642. fn: function (){
  26643. var self=this;
  26644. return smalltalk.withContext(function($ctx1) {
  26645. var $2,$1;
  26646. $2=self["@pc"];
  26647. if(($receiver = $2) == nil || $receiver == undefined){
  26648. self["@pc"]=(0);
  26649. $1=self["@pc"];
  26650. } else {
  26651. $1=$2;
  26652. };
  26653. return $1;
  26654. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.AIContext)})},
  26655. args: [],
  26656. source: "pc\x0a\x09^ pc ifNil: [ pc := 0 ]",
  26657. messageSends: ["ifNil:"],
  26658. referencedClasses: []
  26659. }),
  26660. smalltalk.AIContext);
  26661. smalltalk.addMethod(
  26662. smalltalk.method({
  26663. selector: "pc:",
  26664. category: 'accessing',
  26665. fn: function (anInteger){
  26666. var self=this;
  26667. return smalltalk.withContext(function($ctx1) {
  26668. self["@pc"]=anInteger;
  26669. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.AIContext)})},
  26670. args: ["anInteger"],
  26671. source: "pc: anInteger\x0a\x09pc := anInteger",
  26672. messageSends: [],
  26673. referencedClasses: []
  26674. }),
  26675. smalltalk.AIContext);
  26676. smalltalk.addMethod(
  26677. smalltalk.method({
  26678. selector: "receiver",
  26679. category: 'accessing',
  26680. fn: function (){
  26681. var self=this;
  26682. return smalltalk.withContext(function($ctx1) {
  26683. var $1;
  26684. $1=self._localAt_("self");
  26685. return $1;
  26686. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AIContext)})},
  26687. args: [],
  26688. source: "receiver\x0a\x09^ self localAt: 'self'",
  26689. messageSends: ["localAt:"],
  26690. referencedClasses: []
  26691. }),
  26692. smalltalk.AIContext);
  26693. smalltalk.addMethod(
  26694. smalltalk.method({
  26695. selector: "receiver:",
  26696. category: 'accessing',
  26697. fn: function (anObject){
  26698. var self=this;
  26699. return smalltalk.withContext(function($ctx1) {
  26700. self._localAt_put_("self",anObject);
  26701. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.AIContext)})},
  26702. args: ["anObject"],
  26703. source: "receiver: anObject\x0a\x09self localAt: 'self' put: anObject",
  26704. messageSends: ["localAt:put:"],
  26705. referencedClasses: []
  26706. }),
  26707. smalltalk.AIContext);
  26708. smalltalk.addMethod(
  26709. smalltalk.method({
  26710. selector: "selector",
  26711. category: 'accessing',
  26712. fn: function (){
  26713. var self=this;
  26714. return smalltalk.withContext(function($ctx1) {
  26715. var $2,$1;
  26716. $2=self._method();
  26717. if(($receiver = $2) == nil || $receiver == undefined){
  26718. $1=$2;
  26719. } else {
  26720. $1=_st(self._method())._selector();
  26721. };
  26722. return $1;
  26723. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.AIContext)})},
  26724. args: [],
  26725. source: "selector\x0a\x09^ self method\x0a\x09\x09ifNotNil: [ self method selector ]",
  26726. messageSends: ["ifNotNil:", "selector", "method"],
  26727. referencedClasses: []
  26728. }),
  26729. smalltalk.AIContext);
  26730. smalltalk.addMethod(
  26731. smalltalk.method({
  26732. selector: "fromMethodContext:",
  26733. category: 'instance creation',
  26734. fn: function (aMethodContext){
  26735. var self=this;
  26736. return smalltalk.withContext(function($ctx1) {
  26737. var $2,$3,$1;
  26738. $2=self._new();
  26739. _st($2)._initializeFromMethodContext_(aMethodContext);
  26740. $3=_st($2)._yourself();
  26741. $1=$3;
  26742. return $1;
  26743. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext.klass)})},
  26744. args: ["aMethodContext"],
  26745. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  26746. messageSends: ["initializeFromMethodContext:", "new", "yourself"],
  26747. referencedClasses: []
  26748. }),
  26749. smalltalk.AIContext.klass);
  26750. smalltalk.addClass('ASTDebugger', smalltalk.Object, ['interpreter', 'context'], 'Compiler-Interpreter');
  26751. 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.";
  26752. smalltalk.addMethod(
  26753. smalltalk.method({
  26754. selector: "atEnd",
  26755. category: 'testing',
  26756. fn: function (){
  26757. var self=this;
  26758. return smalltalk.withContext(function($ctx1) {
  26759. var $1;
  26760. $1=_st(self._interpreter())._atEnd();
  26761. return $1;
  26762. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTDebugger)})},
  26763. args: [],
  26764. source: "atEnd\x0a\x09^ self interpreter atEnd",
  26765. messageSends: ["atEnd", "interpreter"],
  26766. referencedClasses: []
  26767. }),
  26768. smalltalk.ASTDebugger);
  26769. smalltalk.addMethod(
  26770. smalltalk.method({
  26771. selector: "buildAST",
  26772. category: 'initialization',
  26773. fn: function (){
  26774. var self=this;
  26775. var ast;
  26776. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  26777. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  26778. return smalltalk.withContext(function($ctx1) {
  26779. var $1;
  26780. ast=_st(_st($Smalltalk())._current())._parse_(_st(self._method())._source());
  26781. _st(_st($SemanticAnalyzer())._on_(_st(_st(self._context())._receiver())._class()))._visit_(ast);
  26782. $1=ast;
  26783. return $1;
  26784. }, function($ctx1) {$ctx1.fill(self,"buildAST",{ast:ast},smalltalk.ASTDebugger)})},
  26785. args: [],
  26786. 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",
  26787. messageSends: ["parse:", "source", "method", "current", "visit:", "on:", "class", "receiver", "context"],
  26788. referencedClasses: ["Smalltalk", "SemanticAnalyzer"]
  26789. }),
  26790. smalltalk.ASTDebugger);
  26791. smalltalk.addMethod(
  26792. smalltalk.method({
  26793. selector: "context",
  26794. category: 'accessing',
  26795. fn: function (){
  26796. var self=this;
  26797. return smalltalk.withContext(function($ctx1) {
  26798. var $1;
  26799. $1=self["@context"];
  26800. return $1;
  26801. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTDebugger)})},
  26802. args: [],
  26803. source: "context\x0a\x09^ context",
  26804. messageSends: [],
  26805. referencedClasses: []
  26806. }),
  26807. smalltalk.ASTDebugger);
  26808. smalltalk.addMethod(
  26809. smalltalk.method({
  26810. selector: "context:",
  26811. category: 'accessing',
  26812. fn: function (aContext){
  26813. var self=this;
  26814. return smalltalk.withContext(function($ctx1) {
  26815. self["@context"]=aContext;
  26816. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger)})},
  26817. args: ["aContext"],
  26818. source: "context: aContext\x0a\x09context := aContext",
  26819. messageSends: [],
  26820. referencedClasses: []
  26821. }),
  26822. smalltalk.ASTDebugger);
  26823. smalltalk.addMethod(
  26824. smalltalk.method({
  26825. selector: "defaultInterpreterClass",
  26826. category: 'defaults',
  26827. fn: function (){
  26828. var self=this;
  26829. function $ASTSteppingInterpreter(){return smalltalk.ASTSteppingInterpreter||(typeof ASTSteppingInterpreter=="undefined"?nil:ASTSteppingInterpreter)}
  26830. return smalltalk.withContext(function($ctx1) {
  26831. var $1;
  26832. $1=$ASTSteppingInterpreter();
  26833. return $1;
  26834. }, function($ctx1) {$ctx1.fill(self,"defaultInterpreterClass",{},smalltalk.ASTDebugger)})},
  26835. args: [],
  26836. source: "defaultInterpreterClass\x0a\x09^ ASTSteppingInterpreter",
  26837. messageSends: [],
  26838. referencedClasses: ["ASTSteppingInterpreter"]
  26839. }),
  26840. smalltalk.ASTDebugger);
  26841. smalltalk.addMethod(
  26842. smalltalk.method({
  26843. selector: "initializeInterpreter",
  26844. category: 'initialization',
  26845. fn: function (){
  26846. var self=this;
  26847. var ast,next;
  26848. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  26849. return smalltalk.withContext(function($ctx1) {
  26850. var $1,$2;
  26851. ast=self._buildAST();
  26852. $1=_st($ASTPCNodeVisitor())._new();
  26853. _st($1)._context_(self._context());
  26854. _st($1)._visit_(ast);
  26855. $2=_st($1)._currentNode();
  26856. next=$2;
  26857. _st(self._interpreter())._interpret_(next);
  26858. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{ast:ast,next:next},smalltalk.ASTDebugger)})},
  26859. args: [],
  26860. source: "initializeInterpreter\x0a\x09| ast next |\x0a\x09ast := self buildAST.\x0a\x09next := ASTPCNodeVisitor new\x0a\x09\x09context: self context;\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode.\x0a\x09self interpreter interpret: next",
  26861. messageSends: ["buildAST", "context:", "context", "new", "visit:", "currentNode", "interpret:", "interpreter"],
  26862. referencedClasses: ["ASTPCNodeVisitor"]
  26863. }),
  26864. smalltalk.ASTDebugger);
  26865. smalltalk.addMethod(
  26866. smalltalk.method({
  26867. selector: "initializeWithContext:",
  26868. category: 'initialization',
  26869. fn: function (aContext){
  26870. var self=this;
  26871. return smalltalk.withContext(function($ctx1) {
  26872. self._context_(aContext);
  26873. self._initializeInterpreter();
  26874. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:",{aContext:aContext},smalltalk.ASTDebugger)})},
  26875. args: ["aContext"],
  26876. source: "initializeWithContext: aContext\x0a\x09\x22TODO: do we need to handle block contexts?\x22\x0a\x09\x0a\x09self context: aContext.\x0a\x09self initializeInterpreter",
  26877. messageSends: ["context:", "initializeInterpreter"],
  26878. referencedClasses: []
  26879. }),
  26880. smalltalk.ASTDebugger);
  26881. smalltalk.addMethod(
  26882. smalltalk.method({
  26883. selector: "interpreter",
  26884. category: 'accessing',
  26885. fn: function (){
  26886. var self=this;
  26887. return smalltalk.withContext(function($ctx1) {
  26888. var $2,$1;
  26889. $2=self["@interpreter"];
  26890. if(($receiver = $2) == nil || $receiver == undefined){
  26891. self["@interpreter"]=_st(self._defaultInterpreterClass())._new();
  26892. $1=self["@interpreter"];
  26893. } else {
  26894. $1=$2;
  26895. };
  26896. return $1;
  26897. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTDebugger)})},
  26898. args: [],
  26899. source: "interpreter\x0a\x09^ interpreter ifNil: [ interpreter := self defaultInterpreterClass new ]",
  26900. messageSends: ["ifNil:", "new", "defaultInterpreterClass"],
  26901. referencedClasses: []
  26902. }),
  26903. smalltalk.ASTDebugger);
  26904. smalltalk.addMethod(
  26905. smalltalk.method({
  26906. selector: "interpreter:",
  26907. category: 'accessing',
  26908. fn: function (anInterpreter){
  26909. var self=this;
  26910. return smalltalk.withContext(function($ctx1) {
  26911. self["@interpreter"]=anInterpreter;
  26912. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.ASTDebugger)})},
  26913. args: ["anInterpreter"],
  26914. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  26915. messageSends: [],
  26916. referencedClasses: []
  26917. }),
  26918. smalltalk.ASTDebugger);
  26919. smalltalk.addMethod(
  26920. smalltalk.method({
  26921. selector: "method",
  26922. category: 'accessing',
  26923. fn: function (){
  26924. var self=this;
  26925. return smalltalk.withContext(function($ctx1) {
  26926. var $1;
  26927. $1=_st(self._context())._method();
  26928. return $1;
  26929. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.ASTDebugger)})},
  26930. args: [],
  26931. source: "method\x0a\x09^ self context method",
  26932. messageSends: ["method", "context"],
  26933. referencedClasses: []
  26934. }),
  26935. smalltalk.ASTDebugger);
  26936. smalltalk.addMethod(
  26937. smalltalk.method({
  26938. selector: "nextNode",
  26939. category: 'accessing',
  26940. fn: function (){
  26941. var self=this;
  26942. return smalltalk.withContext(function($ctx1) {
  26943. var $1;
  26944. $1=_st(self._interpreter())._nextNode();
  26945. return $1;
  26946. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTDebugger)})},
  26947. args: [],
  26948. source: "nextNode\x0a\x09^ self interpreter nextNode",
  26949. messageSends: ["nextNode", "interpreter"],
  26950. referencedClasses: []
  26951. }),
  26952. smalltalk.ASTDebugger);
  26953. smalltalk.addMethod(
  26954. smalltalk.method({
  26955. selector: "proceed",
  26956. category: 'stepping',
  26957. fn: function (){
  26958. var self=this;
  26959. return smalltalk.withContext(function($ctx1) {
  26960. self._shouldBeImplemented();
  26961. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTDebugger)})},
  26962. args: [],
  26963. source: "proceed\x0a\x09self shouldBeImplemented",
  26964. messageSends: ["shouldBeImplemented"],
  26965. referencedClasses: []
  26966. }),
  26967. smalltalk.ASTDebugger);
  26968. smalltalk.addMethod(
  26969. smalltalk.method({
  26970. selector: "restart",
  26971. category: 'stepping',
  26972. fn: function (){
  26973. var self=this;
  26974. return smalltalk.withContext(function($ctx1) {
  26975. self._shouldBeImplemented();
  26976. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTDebugger)})},
  26977. args: [],
  26978. source: "restart\x0a\x09self shouldBeImplemented",
  26979. messageSends: ["shouldBeImplemented"],
  26980. referencedClasses: []
  26981. }),
  26982. smalltalk.ASTDebugger);
  26983. smalltalk.addMethod(
  26984. smalltalk.method({
  26985. selector: "step",
  26986. category: 'stepping',
  26987. fn: function (){
  26988. var self=this;
  26989. return smalltalk.withContext(function($ctx1) {
  26990. _st((function(){
  26991. return smalltalk.withContext(function($ctx2) {
  26992. return _st(_st(_st(_st(self._interpreter())._nextNode())._notNil())._and_((function(){
  26993. return smalltalk.withContext(function($ctx3) {
  26994. return _st(_st(self._interpreter())._nextNode())._stopOnStepping();
  26995. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})})))._or_((function(){
  26996. return smalltalk.withContext(function($ctx3) {
  26997. return _st(_st(self._interpreter())._atEnd())._not();
  26998. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  26999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  27000. return smalltalk.withContext(function($ctx2) {
  27001. _st(self._interpreter())._step();
  27002. return self._step();
  27003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  27004. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTDebugger)})},
  27005. args: [],
  27006. source: "step\x0a\x09\x22The ASTSteppingInterpreter stops at each node interpretation.\x0a\x09One step will interpret nodes until:\x0a\x09- we get at the end\x0a\x09- the next node is a stepping node (send, assignment, etc.)\x22\x0a\x09\x0a\x09[ (self interpreter nextNode notNil and: [ self interpreter nextNode stopOnStepping ])\x0a\x09\x09or: [ self interpreter atEnd not ] ]\x0a\x09\x09\x09whileFalse: [\x0a\x09\x09\x09\x09self interpreter step.\x0a\x09\x09\x09\x09self step ]",
  27007. messageSends: ["whileFalse:", "step", "interpreter", "or:", "not", "atEnd", "and:", "stopOnStepping", "nextNode", "notNil"],
  27008. referencedClasses: []
  27009. }),
  27010. smalltalk.ASTDebugger);
  27011. smalltalk.addMethod(
  27012. smalltalk.method({
  27013. selector: "stepInto",
  27014. category: 'stepping',
  27015. fn: function (){
  27016. var self=this;
  27017. return smalltalk.withContext(function($ctx1) {
  27018. self._shouldBeImplemented();
  27019. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},smalltalk.ASTDebugger)})},
  27020. args: [],
  27021. source: "stepInto\x0a\x09self shouldBeImplemented",
  27022. messageSends: ["shouldBeImplemented"],
  27023. referencedClasses: []
  27024. }),
  27025. smalltalk.ASTDebugger);
  27026. smalltalk.addMethod(
  27027. smalltalk.method({
  27028. selector: "stepOver",
  27029. category: 'stepping',
  27030. fn: function (){
  27031. var self=this;
  27032. return smalltalk.withContext(function($ctx1) {
  27033. self._step();
  27034. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTDebugger)})},
  27035. args: [],
  27036. source: "stepOver\x0a\x09self step",
  27037. messageSends: ["step"],
  27038. referencedClasses: []
  27039. }),
  27040. smalltalk.ASTDebugger);
  27041. smalltalk.addMethod(
  27042. smalltalk.method({
  27043. selector: "context:",
  27044. category: 'instance creation',
  27045. fn: function (aContext){
  27046. var self=this;
  27047. return smalltalk.withContext(function($ctx1) {
  27048. var $2,$3,$1;
  27049. $2=self._new();
  27050. _st($2)._initializeWithContext_(aContext);
  27051. $3=_st($2)._yourself();
  27052. $1=$3;
  27053. return $1;
  27054. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger.klass)})},
  27055. args: ["aContext"],
  27056. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext;\x0a\x09\x09yourself",
  27057. messageSends: ["initializeWithContext:", "new", "yourself"],
  27058. referencedClasses: []
  27059. }),
  27060. smalltalk.ASTDebugger.klass);
  27061. smalltalk.addClass('ASTInterpreter', smalltalk.Object, ['currentNode', 'context', 'shouldReturn', 'result'], 'Compiler-Interpreter');
  27062. smalltalk.ASTInterpreter.comment="I am like a `NodeVisitor`, interpreting nodes one after each other.\x0aI am built using Continuation Passing Style for stepping purposes.\x0a\x0a## Usage example:\x0a\x0a\x09| ast interpreter |\x0a\x09ast := Smalltalk current parse: 'foo 1+2+4'.\x0a\x09(SemanticAnalyzer on: Object) visit: ast.\x0a\x0a\x09ASTInterpreter new\x0a\x09\x09interpret: ast nodes first;\x0a\x09\x09result \x22Answers 7\x22";
  27063. smalltalk.addMethod(
  27064. smalltalk.method({
  27065. selector: "assign:to:",
  27066. category: 'private',
  27067. fn: function (aNode,anObject){
  27068. var self=this;
  27069. return smalltalk.withContext(function($ctx1) {
  27070. var $2,$1;
  27071. $2=_st(_st(aNode)._binding())._isInstanceVar();
  27072. if(smalltalk.assert($2)){
  27073. $1=_st(_st(self._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  27074. } else {
  27075. $1=_st(self._context())._localAt_put_(_st(aNode)._value(),anObject);
  27076. };
  27077. return $1;
  27078. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.ASTInterpreter)})},
  27079. args: ["aNode", "anObject"],
  27080. source: "assign: aNode to: anObject\x0a\x09^ aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  27081. messageSends: ["ifTrue:ifFalse:", "instVarAt:put:", "value", "receiver", "context", "localAt:put:", "isInstanceVar", "binding"],
  27082. referencedClasses: []
  27083. }),
  27084. smalltalk.ASTInterpreter);
  27085. smalltalk.addMethod(
  27086. smalltalk.method({
  27087. selector: "context",
  27088. category: 'accessing',
  27089. fn: function (){
  27090. var self=this;
  27091. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  27092. return smalltalk.withContext(function($ctx1) {
  27093. var $2,$1;
  27094. $2=self["@context"];
  27095. if(($receiver = $2) == nil || $receiver == undefined){
  27096. self["@context"]=_st($AIContext())._new();
  27097. $1=self["@context"];
  27098. } else {
  27099. $1=$2;
  27100. };
  27101. return $1;
  27102. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTInterpreter)})},
  27103. args: [],
  27104. source: "context\x0a\x09^ context ifNil: [ context := AIContext new ]",
  27105. messageSends: ["ifNil:", "new"],
  27106. referencedClasses: ["AIContext"]
  27107. }),
  27108. smalltalk.ASTInterpreter);
  27109. smalltalk.addMethod(
  27110. smalltalk.method({
  27111. selector: "context:",
  27112. category: 'accessing',
  27113. fn: function (anAIContext){
  27114. var self=this;
  27115. return smalltalk.withContext(function($ctx1) {
  27116. self["@context"]=anAIContext;
  27117. return self}, function($ctx1) {$ctx1.fill(self,"context:",{anAIContext:anAIContext},smalltalk.ASTInterpreter)})},
  27118. args: ["anAIContext"],
  27119. source: "context: anAIContext\x0a\x09context := anAIContext",
  27120. messageSends: [],
  27121. referencedClasses: []
  27122. }),
  27123. smalltalk.ASTInterpreter);
  27124. smalltalk.addMethod(
  27125. smalltalk.method({
  27126. selector: "continue:value:",
  27127. category: 'private',
  27128. fn: function (aBlock,anObject){
  27129. var self=this;
  27130. return smalltalk.withContext(function($ctx1) {
  27131. self["@result"]=anObject;
  27132. _st(aBlock)._value_(anObject);
  27133. return self}, function($ctx1) {$ctx1.fill(self,"continue:value:",{aBlock:aBlock,anObject:anObject},smalltalk.ASTInterpreter)})},
  27134. args: ["aBlock", "anObject"],
  27135. source: "continue: aBlock value: anObject\x0a\x09result := anObject.\x0a\x09aBlock value: anObject",
  27136. messageSends: ["value:"],
  27137. referencedClasses: []
  27138. }),
  27139. smalltalk.ASTInterpreter);
  27140. smalltalk.addMethod(
  27141. smalltalk.method({
  27142. selector: "currentNode",
  27143. category: 'accessing',
  27144. fn: function (){
  27145. var self=this;
  27146. return smalltalk.withContext(function($ctx1) {
  27147. var $1;
  27148. $1=self["@currentNode"];
  27149. return $1;
  27150. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTInterpreter)})},
  27151. args: [],
  27152. source: "currentNode\x0a\x09^ currentNode",
  27153. messageSends: [],
  27154. referencedClasses: []
  27155. }),
  27156. smalltalk.ASTInterpreter);
  27157. smalltalk.addMethod(
  27158. smalltalk.method({
  27159. selector: "eval:",
  27160. category: 'private',
  27161. fn: function (aString){
  27162. var self=this;
  27163. var source,function_;
  27164. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  27165. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  27166. return smalltalk.withContext(function($ctx1) {
  27167. var $1,$2,$3;
  27168. source=_st($String())._streamContents_((function(str){
  27169. return smalltalk.withContext(function($ctx2) {
  27170. _st(str)._nextPutAll_("(function(");
  27171. _st(_st(_st(self._context())._locals())._keys())._do_separatedBy_((function(each){
  27172. return smalltalk.withContext(function($ctx3) {
  27173. return _st(str)._nextPutAll_(each);
  27174. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}),(function(){
  27175. return smalltalk.withContext(function($ctx3) {
  27176. return _st(str)._nextPutAll_(",");
  27177. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  27178. $1=str;
  27179. _st($1)._nextPutAll_("){ return (function() {");
  27180. _st($1)._nextPutAll_(aString);
  27181. $2=_st($1)._nextPutAll_("})() })");
  27182. return $2;
  27183. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  27184. function_=_st(_st($Compiler())._new())._eval_(source);
  27185. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(self._context())._locals())._values());
  27186. return $3;
  27187. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.ASTInterpreter)})},
  27188. args: ["aString"],
  27189. 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",
  27190. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  27191. referencedClasses: ["String", "Compiler"]
  27192. }),
  27193. smalltalk.ASTInterpreter);
  27194. smalltalk.addMethod(
  27195. smalltalk.method({
  27196. selector: "initialize",
  27197. category: 'initialization',
  27198. fn: function (){
  27199. var self=this;
  27200. return smalltalk.withContext(function($ctx1) {
  27201. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  27202. self["@shouldReturn"]=false;
  27203. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTInterpreter)})},
  27204. args: [],
  27205. source: "initialize\x0a\x09super initialize.\x0a\x09shouldReturn := false",
  27206. messageSends: ["initialize"],
  27207. referencedClasses: []
  27208. }),
  27209. smalltalk.ASTInterpreter);
  27210. smalltalk.addMethod(
  27211. smalltalk.method({
  27212. selector: "interpret:",
  27213. category: 'interpreting',
  27214. fn: function (aNode){
  27215. var self=this;
  27216. return smalltalk.withContext(function($ctx1) {
  27217. self["@shouldReturn"]=false;
  27218. self._interpret_continue_(aNode,(function(value){
  27219. return smalltalk.withContext(function($ctx2) {
  27220. self["@result"]=value;
  27221. return self["@result"];
  27222. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  27223. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  27224. args: ["aNode"],
  27225. source: "interpret: aNode\x0a\x09shouldReturn := false.\x0a\x09self interpret: aNode continue: [ :value |\x0a\x09\x09result := value ]",
  27226. messageSends: ["interpret:continue:"],
  27227. referencedClasses: []
  27228. }),
  27229. smalltalk.ASTInterpreter);
  27230. smalltalk.addMethod(
  27231. smalltalk.method({
  27232. selector: "interpret:continue:",
  27233. category: 'interpreting',
  27234. fn: function (aNode,aBlock){
  27235. var self=this;
  27236. return smalltalk.withContext(function($ctx1) {
  27237. var $1,$2,$3;
  27238. $1=self["@shouldReturn"];
  27239. if(smalltalk.assert($1)){
  27240. $2=self;
  27241. return $2;
  27242. };
  27243. $3=_st(aNode)._isNode();
  27244. if(smalltalk.assert($3)){
  27245. self["@currentNode"]=aNode;
  27246. self["@currentNode"];
  27247. self._interpretNode_continue_(aNode,(function(value){
  27248. return smalltalk.withContext(function($ctx2) {
  27249. return self._continue_value_(aBlock,value);
  27250. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  27251. } else {
  27252. self._continue_value_(aBlock,aNode);
  27253. };
  27254. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27255. args: ["aNode", "aBlock"],
  27256. source: "interpret: aNode continue: aBlock\x0a\x09shouldReturn ifTrue: [ ^ self ].\x0a\x0a\x09aNode isNode\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09currentNode := aNode.\x0a\x09\x09\x09self interpretNode: aNode continue: [ :value |\x0a\x09\x09\x09\x09self continue: aBlock value: value ] ]\x0a\x09\x09ifFalse: [ self continue: aBlock value: aNode ]",
  27257. messageSends: ["ifTrue:", "ifTrue:ifFalse:", "interpretNode:continue:", "continue:value:", "isNode"],
  27258. referencedClasses: []
  27259. }),
  27260. smalltalk.ASTInterpreter);
  27261. smalltalk.addMethod(
  27262. smalltalk.method({
  27263. selector: "interpretAll:continue:",
  27264. category: 'private',
  27265. fn: function (aCollection,aBlock){
  27266. var self=this;
  27267. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27268. return smalltalk.withContext(function($ctx1) {
  27269. self._interpretAll_continue_result_(aCollection,aBlock,_st($OrderedCollection())._new());
  27270. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27271. args: ["aCollection", "aBlock"],
  27272. source: "interpretAll: aCollection continue: aBlock\x0a\x09self\x0a\x09\x09interpretAll: aCollection\x0a\x09\x09continue: aBlock\x0a\x09\x09result: OrderedCollection new",
  27273. messageSends: ["interpretAll:continue:result:", "new"],
  27274. referencedClasses: ["OrderedCollection"]
  27275. }),
  27276. smalltalk.ASTInterpreter);
  27277. smalltalk.addMethod(
  27278. smalltalk.method({
  27279. selector: "interpretAll:continue:result:",
  27280. category: 'private',
  27281. fn: function (nodes,aBlock,aCollection){
  27282. var self=this;
  27283. return smalltalk.withContext(function($ctx1) {
  27284. var $1;
  27285. $1=_st(nodes)._isEmpty();
  27286. if(smalltalk.assert($1)){
  27287. self._continue_value_(aBlock,aCollection);
  27288. } else {
  27289. self._interpret_continue_(_st(nodes)._first(),(function(value){
  27290. return smalltalk.withContext(function($ctx2) {
  27291. return self._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  27292. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  27293. };
  27294. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection},smalltalk.ASTInterpreter)})},
  27295. args: ["nodes", "aBlock", "aCollection"],
  27296. source: "interpretAll: nodes continue: aBlock result: aCollection\x0a\x09nodes isEmpty\x0a\x09\x09ifTrue: [ self continue: aBlock value: aCollection ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self interpret: nodes first continue: [:value |\x0a\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09interpretAll: nodes allButFirst\x0a\x09\x09\x09\x09\x09continue: aBlock\x0a\x09\x09\x09\x09\x09result: aCollection, { value } ] ]",
  27297. messageSends: ["ifTrue:ifFalse:", "continue:value:", "interpret:continue:", "first", "interpretAll:continue:result:", "allButFirst", ",", "isEmpty"],
  27298. referencedClasses: []
  27299. }),
  27300. smalltalk.ASTInterpreter);
  27301. smalltalk.addMethod(
  27302. smalltalk.method({
  27303. selector: "interpretAssignmentNode:continue:",
  27304. category: 'interpreting',
  27305. fn: function (aNode,aBlock){
  27306. var self=this;
  27307. return smalltalk.withContext(function($ctx1) {
  27308. self._interpret_continue_(_st(aNode)._right(),(function(value){
  27309. return smalltalk.withContext(function($ctx2) {
  27310. return self._continue_value_(aBlock,self._assign_to_(_st(aNode)._left(),value));
  27311. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  27312. return self}, function($ctx1) {$ctx1.fill(self,"interpretAssignmentNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27313. args: ["aNode", "aBlock"],
  27314. source: "interpretAssignmentNode: aNode continue: aBlock\x0a\x09self interpret: aNode right continue: [ :value |\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: (self assign: aNode left to: value) ]",
  27315. messageSends: ["interpret:continue:", "right", "continue:value:", "assign:to:", "left"],
  27316. referencedClasses: []
  27317. }),
  27318. smalltalk.ASTInterpreter);
  27319. smalltalk.addMethod(
  27320. smalltalk.method({
  27321. selector: "interpretBlockNode:continue:",
  27322. category: 'interpreting',
  27323. fn: function (aNode,aBlock){
  27324. var self=this;
  27325. return smalltalk.withContext(function($ctx1) {
  27326. var $1,$2;
  27327. self._continue_value_(aBlock,(function(){
  27328. return smalltalk.withContext(function($ctx2) {
  27329. return self._withBlockContext_((function(){
  27330. return smalltalk.withContext(function($ctx3) {
  27331. $1=self;
  27332. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  27333. $2=_st($1)._result();
  27334. return $2;
  27335. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  27336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  27337. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27338. args: ["aNode", "aBlock"],
  27339. source: "interpretBlockNode: aNode continue: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: [ \x0a\x09\x09\x09self withBlockContext: [ \x0a\x09\x09\x09\x09self interpret: aNode nodes first; result ] ]",
  27340. messageSends: ["continue:value:", "withBlockContext:", "interpret:", "first", "nodes", "result"],
  27341. referencedClasses: []
  27342. }),
  27343. smalltalk.ASTInterpreter);
  27344. smalltalk.addMethod(
  27345. smalltalk.method({
  27346. selector: "interpretBlockSequenceNode:continue:",
  27347. category: 'interpreting',
  27348. fn: function (aNode,aBlock){
  27349. var self=this;
  27350. return smalltalk.withContext(function($ctx1) {
  27351. self._interpretSequenceNode_continue_(aNode,aBlock);
  27352. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27353. args: ["aNode", "aBlock"],
  27354. source: "interpretBlockSequenceNode: aNode continue: aBlock\x0a\x09self interpretSequenceNode: aNode continue: aBlock",
  27355. messageSends: ["interpretSequenceNode:continue:"],
  27356. referencedClasses: []
  27357. }),
  27358. smalltalk.ASTInterpreter);
  27359. smalltalk.addMethod(
  27360. smalltalk.method({
  27361. selector: "interpretCascadeNode:continue:",
  27362. category: 'interpreting',
  27363. fn: function (aNode,aBlock){
  27364. var self=this;
  27365. return smalltalk.withContext(function($ctx1) {
  27366. self._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  27367. return smalltalk.withContext(function($ctx2) {
  27368. _st(_st(aNode)._nodes())._do_((function(each){
  27369. return smalltalk.withContext(function($ctx3) {
  27370. return _st(each)._receiver_(receiver);
  27371. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  27372. return self._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  27373. return smalltalk.withContext(function($ctx3) {
  27374. return self._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  27375. return smalltalk.withContext(function($ctx4) {
  27376. return self._continue_value_(aBlock,val);
  27377. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx3)})}));
  27378. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  27379. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  27380. return self}, function($ctx1) {$ctx1.fill(self,"interpretCascadeNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27381. args: ["aNode", "aBlock"],
  27382. source: "interpretCascadeNode: aNode continue: aBlock\x0a\x09\x22TODO: Handle super sends\x22\x0a\x09\x0a\x09self interpret: aNode receiver continue: [ :receiver |\x0a\x09\x09\x22Only interpret the receiver once\x22\x0a\x09\x09aNode nodes do: [ :each | each receiver: receiver ].\x0a\x0a\x09\x09self\x0a\x09\x09\x09interpretAll: aNode nodes allButLast\x0a\x09\x09\x09continue: [\x0a\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09interpret: aNode nodes last\x0a\x09\x09\x09\x09\x09continue: [ :val | self continue: aBlock value: val ] ] ]",
  27383. messageSends: ["interpret:continue:", "receiver", "do:", "receiver:", "nodes", "interpretAll:continue:", "allButLast", "last", "continue:value:"],
  27384. referencedClasses: []
  27385. }),
  27386. smalltalk.ASTInterpreter);
  27387. smalltalk.addMethod(
  27388. smalltalk.method({
  27389. selector: "interpretClassReferenceNode:continue:",
  27390. category: 'interpreting',
  27391. fn: function (aNode,aBlock){
  27392. var self=this;
  27393. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27394. return smalltalk.withContext(function($ctx1) {
  27395. self._continue_value_(aBlock,_st(_st($Smalltalk())._current())._at_(_st(aNode)._value()));
  27396. return self}, function($ctx1) {$ctx1.fill(self,"interpretClassReferenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27397. args: ["aNode", "aBlock"],
  27398. source: "interpretClassReferenceNode: aNode continue: aBlock\x0a\x09self continue: aBlock value: (Smalltalk current at: aNode value)",
  27399. messageSends: ["continue:value:", "at:", "value", "current"],
  27400. referencedClasses: ["Smalltalk"]
  27401. }),
  27402. smalltalk.ASTInterpreter);
  27403. smalltalk.addMethod(
  27404. smalltalk.method({
  27405. selector: "interpretDynamicArrayNode:continue:",
  27406. category: 'interpreting',
  27407. fn: function (aNode,aBlock){
  27408. var self=this;
  27409. return smalltalk.withContext(function($ctx1) {
  27410. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  27411. return smalltalk.withContext(function($ctx2) {
  27412. return self._continue_value_(aBlock,array);
  27413. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  27414. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicArrayNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27415. args: ["aNode", "aBlock"],
  27416. source: "interpretDynamicArrayNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: array ]",
  27417. messageSends: ["interpretAll:continue:", "nodes", "continue:value:"],
  27418. referencedClasses: []
  27419. }),
  27420. smalltalk.ASTInterpreter);
  27421. smalltalk.addMethod(
  27422. smalltalk.method({
  27423. selector: "interpretDynamicDictionaryNode:continue:",
  27424. category: 'interpreting',
  27425. fn: function (aNode,aBlock){
  27426. var self=this;
  27427. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  27428. return smalltalk.withContext(function($ctx1) {
  27429. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  27430. var hashedCollection;
  27431. return smalltalk.withContext(function($ctx2) {
  27432. hashedCollection=_st($HashedCollection())._new();
  27433. hashedCollection;
  27434. _st(array)._do_((function(each){
  27435. return smalltalk.withContext(function($ctx3) {
  27436. return _st(hashedCollection)._add_(each);
  27437. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  27438. return self._continue_value_(aBlock,hashedCollection);
  27439. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1)})}));
  27440. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicDictionaryNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27441. args: ["aNode", "aBlock"],
  27442. source: "interpretDynamicDictionaryNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array | | hashedCollection |\x0a\x09\x09hashedCollection := HashedCollection new.\x0a\x09\x09array do: [ :each | hashedCollection add: each ].\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: hashedCollection ]",
  27443. messageSends: ["interpretAll:continue:", "nodes", "new", "do:", "add:", "continue:value:"],
  27444. referencedClasses: ["HashedCollection"]
  27445. }),
  27446. smalltalk.ASTInterpreter);
  27447. smalltalk.addMethod(
  27448. smalltalk.method({
  27449. selector: "interpretJSStatementNode:continue:",
  27450. category: 'interpreting',
  27451. fn: function (aNode,aBlock){
  27452. var self=this;
  27453. return smalltalk.withContext(function($ctx1) {
  27454. self["@shouldReturn"]=true;
  27455. self._continue_value_(aBlock,self._eval_(_st(aNode)._source()));
  27456. return self}, function($ctx1) {$ctx1.fill(self,"interpretJSStatementNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27457. args: ["aNode", "aBlock"],
  27458. source: "interpretJSStatementNode: aNode continue: aBlock\x0a\x09shouldReturn := true.\x0a\x09self continue: aBlock value: (self eval: aNode source)",
  27459. messageSends: ["continue:value:", "eval:", "source"],
  27460. referencedClasses: []
  27461. }),
  27462. smalltalk.ASTInterpreter);
  27463. smalltalk.addMethod(
  27464. smalltalk.method({
  27465. selector: "interpretMethodNode:continue:",
  27466. category: 'interpreting',
  27467. fn: function (aNode,aBlock){
  27468. var self=this;
  27469. return smalltalk.withContext(function($ctx1) {
  27470. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  27471. return smalltalk.withContext(function($ctx2) {
  27472. return self._continue_value_(aBlock,_st(array)._first());
  27473. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  27474. return self}, function($ctx1) {$ctx1.fill(self,"interpretMethodNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27475. args: ["aNode", "aBlock"],
  27476. source: "interpretMethodNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self continue: aBlock value: array first ]",
  27477. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "first"],
  27478. referencedClasses: []
  27479. }),
  27480. smalltalk.ASTInterpreter);
  27481. smalltalk.addMethod(
  27482. smalltalk.method({
  27483. selector: "interpretNode:continue:",
  27484. category: 'interpreting',
  27485. fn: function (aNode,aBlock){
  27486. var self=this;
  27487. return smalltalk.withContext(function($ctx1) {
  27488. _st(aNode)._interpreter_continue_(self,aBlock);
  27489. return self}, function($ctx1) {$ctx1.fill(self,"interpretNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27490. args: ["aNode", "aBlock"],
  27491. source: "interpretNode: aNode continue: aBlock\x0a\x09aNode interpreter: self continue: aBlock",
  27492. messageSends: ["interpreter:continue:"],
  27493. referencedClasses: []
  27494. }),
  27495. smalltalk.ASTInterpreter);
  27496. smalltalk.addMethod(
  27497. smalltalk.method({
  27498. selector: "interpretReturnNode:continue:",
  27499. category: 'interpreting',
  27500. fn: function (aNode,aBlock){
  27501. var self=this;
  27502. return smalltalk.withContext(function($ctx1) {
  27503. self._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  27504. return smalltalk.withContext(function($ctx2) {
  27505. self["@shouldReturn"]=true;
  27506. self["@shouldReturn"];
  27507. return self._continue_value_(aBlock,value);
  27508. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  27509. return self}, function($ctx1) {$ctx1.fill(self,"interpretReturnNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27510. args: ["aNode", "aBlock"],
  27511. source: "interpretReturnNode: aNode continue: aBlock\x0a\x09self interpret: aNode nodes first continue: [ :value |\x0a\x09\x09shouldReturn := true.\x0a\x09\x09self continue: aBlock value: value ]",
  27512. messageSends: ["interpret:continue:", "first", "nodes", "continue:value:"],
  27513. referencedClasses: []
  27514. }),
  27515. smalltalk.ASTInterpreter);
  27516. smalltalk.addMethod(
  27517. smalltalk.method({
  27518. selector: "interpretSendNode:continue:",
  27519. category: 'interpreting',
  27520. fn: function (aNode,aBlock){
  27521. var self=this;
  27522. return smalltalk.withContext(function($ctx1) {
  27523. self._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  27524. return smalltalk.withContext(function($ctx2) {
  27525. return self._interpretAll_continue_(_st(aNode)._arguments(),(function(args){
  27526. return smalltalk.withContext(function($ctx3) {
  27527. return self._messageFromSendNode_arguments_do_(aNode,args,(function(message){
  27528. return smalltalk.withContext(function($ctx4) {
  27529. _st(self._context())._pc_(_st(_st(self._context())._pc()).__plus((1)));
  27530. return self._continue_value_(aBlock,self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend()));
  27531. }, function($ctx4) {$ctx4.fillBlock({message:message},$ctx3)})}));
  27532. }, function($ctx3) {$ctx3.fillBlock({args:args},$ctx2)})}));
  27533. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  27534. return self}, function($ctx1) {$ctx1.fill(self,"interpretSendNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27535. args: ["aNode", "aBlock"],
  27536. source: "interpretSendNode: aNode continue: aBlock\x0a\x09self interpret: aNode receiver continue: [ :receiver |\x0a\x09\x09self interpretAll: aNode arguments continue: [ :args |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09messageFromSendNode: aNode\x0a\x09\x09\x09\x09arguments: args\x0a\x09\x09\x09\x09do: [ :message |\x0a\x09\x09\x09\x09\x09self context pc: self context pc + 1.\x0a\x09\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09\x09continue: aBlock\x0a\x09\x09\x09\x09\x09\x09value: (self sendMessage: message to: receiver superSend: aNode superSend) ] ] ]",
  27537. messageSends: ["interpret:continue:", "receiver", "interpretAll:continue:", "arguments", "messageFromSendNode:arguments:do:", "pc:", "+", "pc", "context", "continue:value:", "sendMessage:to:superSend:", "superSend"],
  27538. referencedClasses: []
  27539. }),
  27540. smalltalk.ASTInterpreter);
  27541. smalltalk.addMethod(
  27542. smalltalk.method({
  27543. selector: "interpretSequenceNode:continue:",
  27544. category: 'interpreting',
  27545. fn: function (aNode,aBlock){
  27546. var self=this;
  27547. return smalltalk.withContext(function($ctx1) {
  27548. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  27549. return smalltalk.withContext(function($ctx2) {
  27550. return self._continue_value_(aBlock,_st(array)._last());
  27551. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  27552. return self}, function($ctx1) {$ctx1.fill(self,"interpretSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27553. args: ["aNode", "aBlock"],
  27554. source: "interpretSequenceNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self continue: aBlock value: array last ]",
  27555. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "last"],
  27556. referencedClasses: []
  27557. }),
  27558. smalltalk.ASTInterpreter);
  27559. smalltalk.addMethod(
  27560. smalltalk.method({
  27561. selector: "interpretValueNode:continue:",
  27562. category: 'interpreting',
  27563. fn: function (aNode,aBlock){
  27564. var self=this;
  27565. return smalltalk.withContext(function($ctx1) {
  27566. self._continue_value_(aBlock,_st(aNode)._value());
  27567. return self}, function($ctx1) {$ctx1.fill(self,"interpretValueNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27568. args: ["aNode", "aBlock"],
  27569. source: "interpretValueNode: aNode continue: aBlock\x0a\x09self continue: aBlock value: aNode value",
  27570. messageSends: ["continue:value:", "value"],
  27571. referencedClasses: []
  27572. }),
  27573. smalltalk.ASTInterpreter);
  27574. smalltalk.addMethod(
  27575. smalltalk.method({
  27576. selector: "interpretVariableNode:continue:",
  27577. category: 'interpreting',
  27578. fn: function (aNode,aBlock){
  27579. var self=this;
  27580. return smalltalk.withContext(function($ctx1) {
  27581. var $1,$2,$4,$3;
  27582. $1=self;
  27583. $2=aBlock;
  27584. $4=_st(_st(aNode)._binding())._isInstanceVar();
  27585. if(smalltalk.assert($4)){
  27586. $3=_st(_st(self._context())._receiver())._instVarAt_(_st(aNode)._value());
  27587. } else {
  27588. $3=_st(self._context())._localAt_(_st(aNode)._value());
  27589. };
  27590. _st($1)._continue_value_($2,$3);
  27591. return self}, function($ctx1) {$ctx1.fill(self,"interpretVariableNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27592. args: ["aNode", "aBlock"],
  27593. source: "interpretVariableNode: aNode continue: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: (aNode binding isInstanceVar\x0a\x09\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09\x09ifFalse: [ self context localAt: aNode value ])",
  27594. messageSends: ["continue:value:", "ifTrue:ifFalse:", "instVarAt:", "value", "receiver", "context", "localAt:", "isInstanceVar", "binding"],
  27595. referencedClasses: []
  27596. }),
  27597. smalltalk.ASTInterpreter);
  27598. smalltalk.addMethod(
  27599. smalltalk.method({
  27600. selector: "messageFromSendNode:arguments:do:",
  27601. category: 'private',
  27602. fn: function (aSendNode,aCollection,aBlock){
  27603. var self=this;
  27604. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  27605. return smalltalk.withContext(function($ctx1) {
  27606. var $1,$2;
  27607. $1=_st($Message())._new();
  27608. _st($1)._selector_(_st(aSendNode)._selector());
  27609. _st($1)._arguments_(aCollection);
  27610. $2=_st($1)._yourself();
  27611. self._continue_value_(aBlock,$2);
  27612. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:do:",{aSendNode:aSendNode,aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27613. args: ["aSendNode", "aCollection", "aBlock"],
  27614. source: "messageFromSendNode: aSendNode arguments: aCollection do: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: (Message new\x0a\x09\x09\x09selector: aSendNode selector;\x0a\x09\x09\x09arguments: aCollection;\x0a\x09\x09\x09yourself)",
  27615. messageSends: ["continue:value:", "selector:", "selector", "new", "arguments:", "yourself"],
  27616. referencedClasses: ["Message"]
  27617. }),
  27618. smalltalk.ASTInterpreter);
  27619. smalltalk.addMethod(
  27620. smalltalk.method({
  27621. selector: "result",
  27622. category: 'accessing',
  27623. fn: function (){
  27624. var self=this;
  27625. return smalltalk.withContext(function($ctx1) {
  27626. var $1;
  27627. $1=self["@result"];
  27628. return $1;
  27629. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.ASTInterpreter)})},
  27630. args: [],
  27631. source: "result\x0a\x09^ result",
  27632. messageSends: [],
  27633. referencedClasses: []
  27634. }),
  27635. smalltalk.ASTInterpreter);
  27636. smalltalk.addMethod(
  27637. smalltalk.method({
  27638. selector: "sendMessage:to:superSend:",
  27639. category: 'private',
  27640. fn: function (aMessage,anObject,aBoolean){
  27641. var self=this;
  27642. var method;
  27643. return smalltalk.withContext(function($ctx1) {
  27644. var $1,$2,$3,$4,$5,$6;
  27645. var $early={};
  27646. try {
  27647. $1=aBoolean;
  27648. if(! smalltalk.assert($1)){
  27649. $2=_st(aMessage)._sendTo_(anObject);
  27650. return $2;
  27651. };
  27652. $3=_st(_st(anObject)._class())._superclass();
  27653. if(($receiver = $3) == nil || $receiver == undefined){
  27654. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  27655. return $4;
  27656. } else {
  27657. $3;
  27658. };
  27659. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  27660. return smalltalk.withContext(function($ctx2) {
  27661. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  27662. throw $early=[$5];
  27663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  27664. $6=_st(_st(method)._fn())._applyTo_arguments_(anObject,_st(aMessage)._arguments());
  27665. return $6;
  27666. }
  27667. catch(e) {if(e===$early)return e[0]; throw e}
  27668. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},smalltalk.ASTInterpreter)})},
  27669. args: ["aMessage", "anObject", "aBoolean"],
  27670. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method fn applyTo: anObject arguments: aMessage arguments\x0a\x09\x09\x0a\x09\x0a\x09",
  27671. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "messageNotUnderstood:receiver:", "superclass", "class", "at:ifAbsent:", "selector", "methodDictionary", "applyTo:arguments:", "arguments", "fn"],
  27672. referencedClasses: []
  27673. }),
  27674. smalltalk.ASTInterpreter);
  27675. smalltalk.addMethod(
  27676. smalltalk.method({
  27677. selector: "shouldReturn",
  27678. category: 'testing',
  27679. fn: function (){
  27680. var self=this;
  27681. return smalltalk.withContext(function($ctx1) {
  27682. var $2,$1;
  27683. $2=self["@shouldReturn"];
  27684. if(($receiver = $2) == nil || $receiver == undefined){
  27685. $1=false;
  27686. } else {
  27687. $1=$2;
  27688. };
  27689. return $1;
  27690. }, function($ctx1) {$ctx1.fill(self,"shouldReturn",{},smalltalk.ASTInterpreter)})},
  27691. args: [],
  27692. source: "shouldReturn\x0a\x09^ shouldReturn ifNil: [ false ]",
  27693. messageSends: ["ifNil:"],
  27694. referencedClasses: []
  27695. }),
  27696. smalltalk.ASTInterpreter);
  27697. smalltalk.addMethod(
  27698. smalltalk.method({
  27699. selector: "withBlockContext:",
  27700. category: 'private',
  27701. fn: function (aBlock){
  27702. var self=this;
  27703. var blockResult;
  27704. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  27705. return smalltalk.withContext(function($ctx1) {
  27706. var $1,$2,$3;
  27707. $1=_st($AIContext())._new();
  27708. _st($1)._outerContext_(self._context());
  27709. $2=_st($1)._yourself();
  27710. self._context_($2);
  27711. blockResult=_st(aBlock)._value();
  27712. self._context_(_st(self._context())._outerContext());
  27713. $3=blockResult;
  27714. return $3;
  27715. }, function($ctx1) {$ctx1.fill(self,"withBlockContext:",{aBlock:aBlock,blockResult:blockResult},smalltalk.ASTInterpreter)})},
  27716. args: ["aBlock"],
  27717. source: "withBlockContext: aBlock\x0a\x09\x22Evaluate aBlock with a BlockContext:\x0a\x09- a context is pushed before aBlock evaluation.\x0a\x09- the context is poped after aBlock evaluation\x0a\x09- the result of aBlock evaluation is answered\x22\x0a\x09\x0a\x09| blockResult |\x0a\x09\x09\x09\x0a\x09self context: (AIContext new\x0a\x09\x09outerContext: self context;\x0a\x09\x09yourself).\x0a\x09\x0a\x09blockResult := aBlock value.\x0a\x09\x0a\x09self context: self context outerContext.\x0a\x09^ blockResult",
  27718. messageSends: ["context:", "outerContext:", "context", "new", "yourself", "value", "outerContext"],
  27719. referencedClasses: ["AIContext"]
  27720. }),
  27721. smalltalk.ASTInterpreter);
  27722. smalltalk.addClass('ASTSteppingInterpreter', smalltalk.ASTInterpreter, ['continuation', 'nextNode'], 'Compiler-Interpreter');
  27723. smalltalk.ASTSteppingInterpreter.comment="I am an interpreter with stepping capabilities. The higher level `ASTDebugger` class should be used as a debugger model, as it provides convenience methods for debugging.\x0a\x0a## API\x0a\x0aUse `#step` to actually interpret the next node. Interpretation stops at each node evaluation, weither it's a message node or not.\x0a\x0a\x0a## Usage example:\x0a\x0a\x09| ast interpreter |\x0a\x09ast := Smalltalk current parse: 'foo 1+2+4'.\x0a\x09(SemanticAnalyzer on: Object) visit: ast.\x0a\x0a\x09interpreter := ASTSteppingInterpreter new\x0a\x09\x09interpret: ast nodes first;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09interpreter step; step.\x0a\x09interpreter step; step.\x0a\x09interpreter result.\x22Answers 1\x22\x0a\x09interpreter step.\x0a\x09interpreter result. \x22Answers 3\x22\x0a\x09interpreter step.\x0a\x09interpreter result. \x22Answers 7\x22";
  27724. smalltalk.addMethod(
  27725. smalltalk.method({
  27726. selector: "atEnd",
  27727. category: 'testing',
  27728. fn: function (){
  27729. var self=this;
  27730. return smalltalk.withContext(function($ctx1) {
  27731. var $1;
  27732. $1=_st(self._shouldReturn())._or_((function(){
  27733. return smalltalk.withContext(function($ctx2) {
  27734. return _st(self._nextNode()).__eq_eq(self._currentNode());
  27735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  27736. return $1;
  27737. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTSteppingInterpreter)})},
  27738. args: [],
  27739. source: "atEnd\x0a\x09^ self shouldReturn or: [ self nextNode == self currentNode ]",
  27740. messageSends: ["or:", "==", "currentNode", "nextNode", "shouldReturn"],
  27741. referencedClasses: []
  27742. }),
  27743. smalltalk.ASTSteppingInterpreter);
  27744. smalltalk.addMethod(
  27745. smalltalk.method({
  27746. selector: "initialize",
  27747. category: 'initialization',
  27748. fn: function (){
  27749. var self=this;
  27750. return smalltalk.withContext(function($ctx1) {
  27751. smalltalk.ASTInterpreter.fn.prototype._initialize.apply(_st(self), []);
  27752. self["@continuation"]=(function(){
  27753. return smalltalk.withContext(function($ctx2) {
  27754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  27755. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTSteppingInterpreter)})},
  27756. args: [],
  27757. source: "initialize\x0a\x09super initialize.\x0a\x09continuation := []",
  27758. messageSends: ["initialize"],
  27759. referencedClasses: []
  27760. }),
  27761. smalltalk.ASTSteppingInterpreter);
  27762. smalltalk.addMethod(
  27763. smalltalk.method({
  27764. selector: "interpret:continue:",
  27765. category: 'interpreting',
  27766. fn: function (aNode,aBlock){
  27767. var self=this;
  27768. return smalltalk.withContext(function($ctx1) {
  27769. self["@nextNode"]=aNode;
  27770. self["@continuation"]=(function(){
  27771. return smalltalk.withContext(function($ctx2) {
  27772. return smalltalk.ASTInterpreter.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  27773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  27774. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTSteppingInterpreter)})},
  27775. args: ["aNode", "aBlock"],
  27776. source: "interpret: aNode continue: aBlock\x0a\x09nextNode := aNode.\x0a\x09continuation := [\x0a\x09\x09super interpret: aNode continue: aBlock ]",
  27777. messageSends: ["interpret:continue:"],
  27778. referencedClasses: []
  27779. }),
  27780. smalltalk.ASTSteppingInterpreter);
  27781. smalltalk.addMethod(
  27782. smalltalk.method({
  27783. selector: "nextNode",
  27784. category: 'accessing',
  27785. fn: function (){
  27786. var self=this;
  27787. return smalltalk.withContext(function($ctx1) {
  27788. var $1;
  27789. $1=self["@nextNode"];
  27790. return $1;
  27791. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTSteppingInterpreter)})},
  27792. args: [],
  27793. source: "nextNode\x0a\x09^ nextNode",
  27794. messageSends: [],
  27795. referencedClasses: []
  27796. }),
  27797. smalltalk.ASTSteppingInterpreter);
  27798. smalltalk.addMethod(
  27799. smalltalk.method({
  27800. selector: "step",
  27801. category: 'stepping',
  27802. fn: function (){
  27803. var self=this;
  27804. return smalltalk.withContext(function($ctx1) {
  27805. _st(self["@continuation"])._value();
  27806. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTSteppingInterpreter)})},
  27807. args: [],
  27808. source: "step\x0a\x09continuation value",
  27809. messageSends: ["value"],
  27810. referencedClasses: []
  27811. }),
  27812. smalltalk.ASTSteppingInterpreter);
  27813. smalltalk.addClass('ASTPCNodeVisitor', smalltalk.NodeVisitor, ['useInlinings', 'pc', 'context', 'currentNode'], 'Compiler-Interpreter');
  27814. 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`";
  27815. smalltalk.addMethod(
  27816. smalltalk.method({
  27817. selector: "context",
  27818. category: 'accessing',
  27819. fn: function (){
  27820. var self=this;
  27821. return smalltalk.withContext(function($ctx1) {
  27822. var $1;
  27823. $1=self["@context"];
  27824. return $1;
  27825. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTPCNodeVisitor)})},
  27826. args: [],
  27827. source: "context\x0a\x09^ context",
  27828. messageSends: [],
  27829. referencedClasses: []
  27830. }),
  27831. smalltalk.ASTPCNodeVisitor);
  27832. smalltalk.addMethod(
  27833. smalltalk.method({
  27834. selector: "context:",
  27835. category: 'accessing',
  27836. fn: function (aContext){
  27837. var self=this;
  27838. return smalltalk.withContext(function($ctx1) {
  27839. self["@context"]=aContext;
  27840. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTPCNodeVisitor)})},
  27841. args: ["aContext"],
  27842. source: "context: aContext\x0a\x09context := aContext",
  27843. messageSends: [],
  27844. referencedClasses: []
  27845. }),
  27846. smalltalk.ASTPCNodeVisitor);
  27847. smalltalk.addMethod(
  27848. smalltalk.method({
  27849. selector: "currentNode",
  27850. category: 'accessing',
  27851. fn: function (){
  27852. var self=this;
  27853. return smalltalk.withContext(function($ctx1) {
  27854. var $1;
  27855. $1=self["@currentNode"];
  27856. return $1;
  27857. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTPCNodeVisitor)})},
  27858. args: [],
  27859. source: "currentNode\x0a\x09^ currentNode",
  27860. messageSends: [],
  27861. referencedClasses: []
  27862. }),
  27863. smalltalk.ASTPCNodeVisitor);
  27864. smalltalk.addMethod(
  27865. smalltalk.method({
  27866. selector: "pc",
  27867. category: 'accessing',
  27868. fn: function (){
  27869. var self=this;
  27870. return smalltalk.withContext(function($ctx1) {
  27871. var $2,$1;
  27872. $2=self["@pc"];
  27873. if(($receiver = $2) == nil || $receiver == undefined){
  27874. $1=(0);
  27875. } else {
  27876. $1=$2;
  27877. };
  27878. return $1;
  27879. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.ASTPCNodeVisitor)})},
  27880. args: [],
  27881. source: "pc\x0a\x09^ pc ifNil: [ 0 ]",
  27882. messageSends: ["ifNil:"],
  27883. referencedClasses: []
  27884. }),
  27885. smalltalk.ASTPCNodeVisitor);
  27886. smalltalk.addMethod(
  27887. smalltalk.method({
  27888. selector: "pc:",
  27889. category: 'accessing',
  27890. fn: function (anInteger){
  27891. var self=this;
  27892. return smalltalk.withContext(function($ctx1) {
  27893. self["@pc"]=anInteger;
  27894. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.ASTPCNodeVisitor)})},
  27895. args: ["anInteger"],
  27896. source: "pc: anInteger\x0a\x09pc := anInteger",
  27897. messageSends: [],
  27898. referencedClasses: []
  27899. }),
  27900. smalltalk.ASTPCNodeVisitor);
  27901. smalltalk.addMethod(
  27902. smalltalk.method({
  27903. selector: "useInlinings",
  27904. category: 'accessing',
  27905. fn: function (){
  27906. var self=this;
  27907. return smalltalk.withContext(function($ctx1) {
  27908. var $2,$1;
  27909. $2=self["@useInlinings"];
  27910. if(($receiver = $2) == nil || $receiver == undefined){
  27911. $1=true;
  27912. } else {
  27913. $1=$2;
  27914. };
  27915. return $1;
  27916. }, function($ctx1) {$ctx1.fill(self,"useInlinings",{},smalltalk.ASTPCNodeVisitor)})},
  27917. args: [],
  27918. source: "useInlinings\x0a\x09^ useInlinings ifNil: [ true ]",
  27919. messageSends: ["ifNil:"],
  27920. referencedClasses: []
  27921. }),
  27922. smalltalk.ASTPCNodeVisitor);
  27923. smalltalk.addMethod(
  27924. smalltalk.method({
  27925. selector: "useInlinings:",
  27926. category: 'accessing',
  27927. fn: function (aBoolean){
  27928. var self=this;
  27929. return smalltalk.withContext(function($ctx1) {
  27930. self["@useInlinings"]=aBoolean;
  27931. return self}, function($ctx1) {$ctx1.fill(self,"useInlinings:",{aBoolean:aBoolean},smalltalk.ASTPCNodeVisitor)})},
  27932. args: ["aBoolean"],
  27933. source: "useInlinings: aBoolean\x0a\x09useInlinings := aBoolean",
  27934. messageSends: [],
  27935. referencedClasses: []
  27936. }),
  27937. smalltalk.ASTPCNodeVisitor);
  27938. smalltalk.addMethod(
  27939. smalltalk.method({
  27940. selector: "visitJSStatementNode:",
  27941. category: 'visiting',
  27942. fn: function (aNode){
  27943. var self=this;
  27944. return smalltalk.withContext(function($ctx1) {
  27945. self["@currentNode"]=aNode;
  27946. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  27947. args: ["aNode"],
  27948. source: "visitJSStatementNode: aNode\x0a\x09currentNode := aNode",
  27949. messageSends: [],
  27950. referencedClasses: []
  27951. }),
  27952. smalltalk.ASTPCNodeVisitor);
  27953. smalltalk.addMethod(
  27954. smalltalk.method({
  27955. selector: "visitSendNode:",
  27956. category: 'visiting',
  27957. fn: function (aNode){
  27958. var self=this;
  27959. return smalltalk.withContext(function($ctx1) {
  27960. var $1,$2;
  27961. smalltalk.NodeVisitor.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  27962. $1=_st(self._pc()).__eq(_st(self._context())._pc());
  27963. if(! smalltalk.assert($1)){
  27964. $2=_st(aNode)._shouldBeInlined();
  27965. if(! smalltalk.assert($2)){
  27966. self._pc_(_st(self._pc()).__plus((1)));
  27967. self["@currentNode"]=aNode;
  27968. self["@currentNode"];
  27969. };
  27970. };
  27971. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  27972. args: ["aNode"],
  27973. source: "visitSendNode: aNode\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self pc = self context pc ifFalse: [\x0a\x09\x09aNode shouldBeInlined ifFalse: [ \x0a\x09\x09\x09self pc: self pc + 1.\x0a\x09\x09\x09currentNode := aNode ] ]",
  27974. messageSends: ["visitSendNode:", "ifFalse:", "pc:", "+", "pc", "shouldBeInlined", "=", "context"],
  27975. referencedClasses: []
  27976. }),
  27977. smalltalk.ASTPCNodeVisitor);
  27978. smalltalk.addMethod(
  27979. smalltalk.method({
  27980. selector: "interpreter:continue:",
  27981. category: '*Compiler-Interpreter',
  27982. fn: function (anInterpreter,aBlock){
  27983. var self=this;
  27984. return smalltalk.withContext(function($ctx1) {
  27985. var $1;
  27986. $1=_st(anInterpreter)._interpretNode_continue_(self,aBlock);
  27987. return $1;
  27988. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.Node)})},
  27989. args: ["anInterpreter", "aBlock"],
  27990. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretNode: self continue: aBlock",
  27991. messageSends: ["interpretNode:continue:"],
  27992. referencedClasses: []
  27993. }),
  27994. smalltalk.Node);
  27995. smalltalk.addMethod(
  27996. smalltalk.method({
  27997. selector: "isSteppingNode",
  27998. category: '*Compiler-Interpreter',
  27999. fn: function (){
  28000. var self=this;
  28001. return smalltalk.withContext(function($ctx1) {
  28002. return false;
  28003. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.Node)})},
  28004. args: [],
  28005. source: "isSteppingNode\x0a\x09^ false",
  28006. messageSends: [],
  28007. referencedClasses: []
  28008. }),
  28009. smalltalk.Node);
  28010. smalltalk.addMethod(
  28011. smalltalk.method({
  28012. selector: "interpreter:continue:",
  28013. category: '*Compiler-Interpreter',
  28014. fn: function (anInterpreter,aBlock){
  28015. var self=this;
  28016. return smalltalk.withContext(function($ctx1) {
  28017. var $1;
  28018. $1=_st(anInterpreter)._interpretAssignmentNode_continue_(self,aBlock);
  28019. return $1;
  28020. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.AssignmentNode)})},
  28021. args: ["anInterpreter", "aBlock"],
  28022. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretAssignmentNode: self continue: aBlock",
  28023. messageSends: ["interpretAssignmentNode:continue:"],
  28024. referencedClasses: []
  28025. }),
  28026. smalltalk.AssignmentNode);
  28027. smalltalk.addMethod(
  28028. smalltalk.method({
  28029. selector: "isSteppingNode",
  28030. category: '*Compiler-Interpreter',
  28031. fn: function (){
  28032. var self=this;
  28033. return smalltalk.withContext(function($ctx1) {
  28034. return true;
  28035. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.AssignmentNode)})},
  28036. args: [],
  28037. source: "isSteppingNode\x0a\x09^ true",
  28038. messageSends: [],
  28039. referencedClasses: []
  28040. }),
  28041. smalltalk.AssignmentNode);
  28042. smalltalk.addMethod(
  28043. smalltalk.method({
  28044. selector: "interpreter:continue:",
  28045. category: '*Compiler-Interpreter',
  28046. fn: function (anInterpreter,aBlock){
  28047. var self=this;
  28048. return smalltalk.withContext(function($ctx1) {
  28049. var $1;
  28050. $1=_st(anInterpreter)._interpretBlockNode_continue_(self,aBlock);
  28051. return $1;
  28052. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockNode)})},
  28053. args: ["anInterpreter", "aBlock"],
  28054. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretBlockNode: self continue: aBlock",
  28055. messageSends: ["interpretBlockNode:continue:"],
  28056. referencedClasses: []
  28057. }),
  28058. smalltalk.BlockNode);
  28059. smalltalk.addMethod(
  28060. smalltalk.method({
  28061. selector: "isSteppingNode",
  28062. category: '*Compiler-Interpreter',
  28063. fn: function (){
  28064. var self=this;
  28065. return smalltalk.withContext(function($ctx1) {
  28066. return true;
  28067. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.BlockNode)})},
  28068. args: [],
  28069. source: "isSteppingNode\x0a\x09^ true",
  28070. messageSends: [],
  28071. referencedClasses: []
  28072. }),
  28073. smalltalk.BlockNode);
  28074. smalltalk.addMethod(
  28075. smalltalk.method({
  28076. selector: "interpreter:continue:",
  28077. category: '*Compiler-Interpreter',
  28078. fn: function (anInterpreter,aBlock){
  28079. var self=this;
  28080. return smalltalk.withContext(function($ctx1) {
  28081. var $1;
  28082. $1=_st(anInterpreter)._interpretCascadeNode_continue_(self,aBlock);
  28083. return $1;
  28084. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.CascadeNode)})},
  28085. args: ["anInterpreter", "aBlock"],
  28086. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretCascadeNode: self continue: aBlock",
  28087. messageSends: ["interpretCascadeNode:continue:"],
  28088. referencedClasses: []
  28089. }),
  28090. smalltalk.CascadeNode);
  28091. smalltalk.addMethod(
  28092. smalltalk.method({
  28093. selector: "interpreter:continue:",
  28094. category: '*Compiler-Interpreter',
  28095. fn: function (anInterpreter,aBlock){
  28096. var self=this;
  28097. return smalltalk.withContext(function($ctx1) {
  28098. var $1;
  28099. $1=_st(anInterpreter)._interpretDynamicArrayNode_continue_(self,aBlock);
  28100. return $1;
  28101. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicArrayNode)})},
  28102. args: ["anInterpreter", "aBlock"],
  28103. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretDynamicArrayNode: self continue: aBlock",
  28104. messageSends: ["interpretDynamicArrayNode:continue:"],
  28105. referencedClasses: []
  28106. }),
  28107. smalltalk.DynamicArrayNode);
  28108. smalltalk.addMethod(
  28109. smalltalk.method({
  28110. selector: "isSteppingNode",
  28111. category: '*Compiler-Interpreter',
  28112. fn: function (){
  28113. var self=this;
  28114. return smalltalk.withContext(function($ctx1) {
  28115. return true;
  28116. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicArrayNode)})},
  28117. args: [],
  28118. source: "isSteppingNode\x0a\x09^ true",
  28119. messageSends: [],
  28120. referencedClasses: []
  28121. }),
  28122. smalltalk.DynamicArrayNode);
  28123. smalltalk.addMethod(
  28124. smalltalk.method({
  28125. selector: "interpreter:continue:",
  28126. category: '*Compiler-Interpreter',
  28127. fn: function (anInterpreter,aBlock){
  28128. var self=this;
  28129. return smalltalk.withContext(function($ctx1) {
  28130. var $1;
  28131. $1=_st(anInterpreter)._interpretDynamicDictionaryNode_continue_(self,aBlock);
  28132. return $1;
  28133. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicDictionaryNode)})},
  28134. args: ["anInterpreter", "aBlock"],
  28135. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretDynamicDictionaryNode: self continue: aBlock",
  28136. messageSends: ["interpretDynamicDictionaryNode:continue:"],
  28137. referencedClasses: []
  28138. }),
  28139. smalltalk.DynamicDictionaryNode);
  28140. smalltalk.addMethod(
  28141. smalltalk.method({
  28142. selector: "isSteppingNode",
  28143. category: '*Compiler-Interpreter',
  28144. fn: function (){
  28145. var self=this;
  28146. return smalltalk.withContext(function($ctx1) {
  28147. return true;
  28148. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicDictionaryNode)})},
  28149. args: [],
  28150. source: "isSteppingNode\x0a\x09^ true",
  28151. messageSends: [],
  28152. referencedClasses: []
  28153. }),
  28154. smalltalk.DynamicDictionaryNode);
  28155. smalltalk.addMethod(
  28156. smalltalk.method({
  28157. selector: "interpreter:continue:",
  28158. category: '*Compiler-Interpreter',
  28159. fn: function (anInterpreter,aBlock){
  28160. var self=this;
  28161. return smalltalk.withContext(function($ctx1) {
  28162. var $1;
  28163. $1=_st(anInterpreter)._interpretJSStatementNode_continue_(self,aBlock);
  28164. return $1;
  28165. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.JSStatementNode)})},
  28166. args: ["anInterpreter", "aBlock"],
  28167. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretJSStatementNode: self continue: aBlock",
  28168. messageSends: ["interpretJSStatementNode:continue:"],
  28169. referencedClasses: []
  28170. }),
  28171. smalltalk.JSStatementNode);
  28172. smalltalk.addMethod(
  28173. smalltalk.method({
  28174. selector: "isSteppingNode",
  28175. category: '*Compiler-Interpreter',
  28176. fn: function (){
  28177. var self=this;
  28178. return smalltalk.withContext(function($ctx1) {
  28179. return true;
  28180. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.JSStatementNode)})},
  28181. args: [],
  28182. source: "isSteppingNode\x0a\x09^ true",
  28183. messageSends: [],
  28184. referencedClasses: []
  28185. }),
  28186. smalltalk.JSStatementNode);
  28187. smalltalk.addMethod(
  28188. smalltalk.method({
  28189. selector: "interpreter:continue:",
  28190. category: '*Compiler-Interpreter',
  28191. fn: function (anInterpreter,aBlock){
  28192. var self=this;
  28193. return smalltalk.withContext(function($ctx1) {
  28194. var $1;
  28195. $1=_st(anInterpreter)._interpretMethodNode_continue_(self,aBlock);
  28196. return $1;
  28197. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.MethodNode)})},
  28198. args: ["anInterpreter", "aBlock"],
  28199. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretMethodNode: self continue: aBlock",
  28200. messageSends: ["interpretMethodNode:continue:"],
  28201. referencedClasses: []
  28202. }),
  28203. smalltalk.MethodNode);
  28204. smalltalk.addMethod(
  28205. smalltalk.method({
  28206. selector: "interpreter:continue:",
  28207. category: '*Compiler-Interpreter',
  28208. fn: function (anInterpreter,aBlock){
  28209. var self=this;
  28210. return smalltalk.withContext(function($ctx1) {
  28211. var $1;
  28212. $1=_st(anInterpreter)._interpretReturnNode_continue_(self,aBlock);
  28213. return $1;
  28214. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ReturnNode)})},
  28215. args: ["anInterpreter", "aBlock"],
  28216. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretReturnNode: self continue: aBlock",
  28217. messageSends: ["interpretReturnNode:continue:"],
  28218. referencedClasses: []
  28219. }),
  28220. smalltalk.ReturnNode);
  28221. smalltalk.addMethod(
  28222. smalltalk.method({
  28223. selector: "interpreter:continue:",
  28224. category: '*Compiler-Interpreter',
  28225. fn: function (anInterpreter,aBlock){
  28226. var self=this;
  28227. return smalltalk.withContext(function($ctx1) {
  28228. var $1;
  28229. $1=_st(anInterpreter)._interpretSendNode_continue_(self,aBlock);
  28230. return $1;
  28231. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SendNode)})},
  28232. args: ["anInterpreter", "aBlock"],
  28233. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretSendNode: self continue: aBlock",
  28234. messageSends: ["interpretSendNode:continue:"],
  28235. referencedClasses: []
  28236. }),
  28237. smalltalk.SendNode);
  28238. smalltalk.addMethod(
  28239. smalltalk.method({
  28240. selector: "isSteppingNode",
  28241. category: '*Compiler-Interpreter',
  28242. fn: function (){
  28243. var self=this;
  28244. return smalltalk.withContext(function($ctx1) {
  28245. return true;
  28246. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.SendNode)})},
  28247. args: [],
  28248. source: "isSteppingNode\x0a\x09^ true",
  28249. messageSends: [],
  28250. referencedClasses: []
  28251. }),
  28252. smalltalk.SendNode);
  28253. smalltalk.addMethod(
  28254. smalltalk.method({
  28255. selector: "interpreter:continue:",
  28256. category: '*Compiler-Interpreter',
  28257. fn: function (anInterpreter,aBlock){
  28258. var self=this;
  28259. return smalltalk.withContext(function($ctx1) {
  28260. var $1;
  28261. $1=_st(anInterpreter)._interpretSequenceNode_continue_(self,aBlock);
  28262. return $1;
  28263. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SequenceNode)})},
  28264. args: ["anInterpreter", "aBlock"],
  28265. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretSequenceNode: self continue: aBlock",
  28266. messageSends: ["interpretSequenceNode:continue:"],
  28267. referencedClasses: []
  28268. }),
  28269. smalltalk.SequenceNode);
  28270. smalltalk.addMethod(
  28271. smalltalk.method({
  28272. selector: "interpreter:continue:",
  28273. category: '*Compiler-Interpreter',
  28274. fn: function (anInterpreter,aBlock){
  28275. var self=this;
  28276. return smalltalk.withContext(function($ctx1) {
  28277. var $1;
  28278. $1=_st(anInterpreter)._interpretBlockSequenceNode_continue_(self,aBlock);
  28279. return $1;
  28280. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockSequenceNode)})},
  28281. args: ["anInterpreter", "aBlock"],
  28282. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretBlockSequenceNode: self continue: aBlock",
  28283. messageSends: ["interpretBlockSequenceNode:continue:"],
  28284. referencedClasses: []
  28285. }),
  28286. smalltalk.BlockSequenceNode);
  28287. smalltalk.addMethod(
  28288. smalltalk.method({
  28289. selector: "interpreter:continue:",
  28290. category: '*Compiler-Interpreter',
  28291. fn: function (anInterpreter,aBlock){
  28292. var self=this;
  28293. return smalltalk.withContext(function($ctx1) {
  28294. var $1;
  28295. $1=_st(anInterpreter)._interpretValueNode_continue_(self,aBlock);
  28296. return $1;
  28297. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ValueNode)})},
  28298. args: ["anInterpreter", "aBlock"],
  28299. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretValueNode: self continue: aBlock",
  28300. messageSends: ["interpretValueNode:continue:"],
  28301. referencedClasses: []
  28302. }),
  28303. smalltalk.ValueNode);
  28304. smalltalk.addMethod(
  28305. smalltalk.method({
  28306. selector: "interpreter:continue:",
  28307. category: '*Compiler-Interpreter',
  28308. fn: function (anInterpreter,aBlock){
  28309. var self=this;
  28310. return smalltalk.withContext(function($ctx1) {
  28311. var $1;
  28312. $1=_st(anInterpreter)._interpretVariableNode_continue_(self,aBlock);
  28313. return $1;
  28314. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.VariableNode)})},
  28315. args: ["anInterpreter", "aBlock"],
  28316. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretVariableNode: self continue: aBlock",
  28317. messageSends: ["interpretVariableNode:continue:"],
  28318. referencedClasses: []
  28319. }),
  28320. smalltalk.VariableNode);
  28321. smalltalk.addMethod(
  28322. smalltalk.method({
  28323. selector: "interpreter:continue:",
  28324. category: '*Compiler-Interpreter',
  28325. fn: function (anInterpreter,aBlock){
  28326. var self=this;
  28327. return smalltalk.withContext(function($ctx1) {
  28328. var $1;
  28329. $1=_st(anInterpreter)._interpretClassReferenceNode_continue_(self,aBlock);
  28330. return $1;
  28331. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ClassReferenceNode)})},
  28332. args: ["anInterpreter", "aBlock"],
  28333. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretClassReferenceNode: self continue: aBlock",
  28334. messageSends: ["interpretClassReferenceNode:continue:"],
  28335. referencedClasses: []
  28336. }),
  28337. smalltalk.ClassReferenceNode);
  28338. smalltalk.parser = (function(){
  28339. /*
  28340. * Generated by PEG.js 0.7.0.
  28341. *
  28342. * http://pegjs.majda.cz/
  28343. */
  28344. function quote(s) {
  28345. /*
  28346. * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
  28347. * string literal except for the closing quote character, backslash,
  28348. * carriage return, line separator, paragraph separator, and line feed.
  28349. * Any character may appear in the form of an escape sequence.
  28350. *
  28351. * For portability, we also escape escape all control and non-ASCII
  28352. * characters. Note that "\0" and "\v" escape sequences are not used
  28353. * because JSHint does not like the first and IE the second.
  28354. */
  28355. return '"' + s
  28356. .replace(/\\/g, '\\\\') // backslash
  28357. .replace(/"/g, '\\"') // closing quote character
  28358. .replace(/\x08/g, '\\b') // backspace
  28359. .replace(/\t/g, '\\t') // horizontal tab
  28360. .replace(/\n/g, '\\n') // line feed
  28361. .replace(/\f/g, '\\f') // form feed
  28362. .replace(/\r/g, '\\r') // carriage return
  28363. .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
  28364. + '"';
  28365. }
  28366. var result = {
  28367. /*
  28368. * Parses the input with a generated parser. If the parsing is successfull,
  28369. * returns a value explicitly or implicitly specified by the grammar from
  28370. * which the parser was generated (see |PEG.buildParser|). If the parsing is
  28371. * unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
  28372. */
  28373. parse: function(input, startRule) {
  28374. var parseFunctions = {
  28375. "separator": parse_separator,
  28376. "comments": parse_comments,
  28377. "ws": parse_ws,
  28378. "identifier": parse_identifier,
  28379. "varIdentifier": parse_varIdentifier,
  28380. "keyword": parse_keyword,
  28381. "selector": parse_selector,
  28382. "className": parse_className,
  28383. "string": parse_string,
  28384. "symbol": parse_symbol,
  28385. "bareSymbol": parse_bareSymbol,
  28386. "number": parse_number,
  28387. "hex": parse_hex,
  28388. "float": parse_float,
  28389. "integer": parse_integer,
  28390. "literalArray": parse_literalArray,
  28391. "bareLiteralArray": parse_bareLiteralArray,
  28392. "literalArrayRest": parse_literalArrayRest,
  28393. "dynamicArray": parse_dynamicArray,
  28394. "dynamicDictionary": parse_dynamicDictionary,
  28395. "pseudoVariable": parse_pseudoVariable,
  28396. "parseTimeLiteral": parse_parseTimeLiteral,
  28397. "runtimeLiteral": parse_runtimeLiteral,
  28398. "literal": parse_literal,
  28399. "variable": parse_variable,
  28400. "classReference": parse_classReference,
  28401. "reference": parse_reference,
  28402. "keywordPair": parse_keywordPair,
  28403. "binarySelector": parse_binarySelector,
  28404. "keywordPattern": parse_keywordPattern,
  28405. "binaryPattern": parse_binaryPattern,
  28406. "unaryPattern": parse_unaryPattern,
  28407. "expression": parse_expression,
  28408. "expressionList": parse_expressionList,
  28409. "expressions": parse_expressions,
  28410. "assignment": parse_assignment,
  28411. "ret": parse_ret,
  28412. "temps": parse_temps,
  28413. "blockParamList": parse_blockParamList,
  28414. "subexpression": parse_subexpression,
  28415. "statements": parse_statements,
  28416. "sequence": parse_sequence,
  28417. "stSequence": parse_stSequence,
  28418. "block": parse_block,
  28419. "operand": parse_operand,
  28420. "unaryMessage": parse_unaryMessage,
  28421. "unaryTail": parse_unaryTail,
  28422. "unarySend": parse_unarySend,
  28423. "binaryMessage": parse_binaryMessage,
  28424. "binaryTail": parse_binaryTail,
  28425. "binarySend": parse_binarySend,
  28426. "keywordMessage": parse_keywordMessage,
  28427. "keywordSend": parse_keywordSend,
  28428. "message": parse_message,
  28429. "cascade": parse_cascade,
  28430. "jsStatement": parse_jsStatement,
  28431. "method": parse_method
  28432. };
  28433. if (startRule !== undefined) {
  28434. if (parseFunctions[startRule] === undefined) {
  28435. throw new Error("Invalid rule name: " + quote(startRule) + ".");
  28436. }
  28437. } else {
  28438. startRule = "method";
  28439. }
  28440. var pos = { offset: 0, line: 1, column: 1, seenCR: false };
  28441. var reportFailures = 0;
  28442. var rightmostFailuresPos = { offset: 0, line: 1, column: 1, seenCR: false };
  28443. var rightmostFailuresExpected = [];
  28444. var cache = {};
  28445. function padLeft(input, padding, length) {
  28446. var result = input;
  28447. var padLength = length - input.length;
  28448. for (var i = 0; i < padLength; i++) {
  28449. result = padding + result;
  28450. }
  28451. return result;
  28452. }
  28453. function escape(ch) {
  28454. var charCode = ch.charCodeAt(0);
  28455. var escapeChar;
  28456. var length;
  28457. if (charCode <= 0xFF) {
  28458. escapeChar = 'x';
  28459. length = 2;
  28460. } else {
  28461. escapeChar = 'u';
  28462. length = 4;
  28463. }
  28464. return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
  28465. }
  28466. function clone(object) {
  28467. var result = {};
  28468. for (var key in object) {
  28469. result[key] = object[key];
  28470. }
  28471. return result;
  28472. }
  28473. function advance(pos, n) {
  28474. var endOffset = pos.offset + n;
  28475. for (var offset = pos.offset; offset < endOffset; offset++) {
  28476. var ch = input.charAt(offset);
  28477. if (ch === "\n") {
  28478. if (!pos.seenCR) { pos.line++; }
  28479. pos.column = 1;
  28480. pos.seenCR = false;
  28481. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  28482. pos.line++;
  28483. pos.column = 1;
  28484. pos.seenCR = true;
  28485. } else {
  28486. pos.column++;
  28487. pos.seenCR = false;
  28488. }
  28489. }
  28490. pos.offset += n;
  28491. }
  28492. function matchFailed(failure) {
  28493. if (pos.offset < rightmostFailuresPos.offset) {
  28494. return;
  28495. }
  28496. if (pos.offset > rightmostFailuresPos.offset) {
  28497. rightmostFailuresPos = clone(pos);
  28498. rightmostFailuresExpected = [];
  28499. }
  28500. rightmostFailuresExpected.push(failure);
  28501. }
  28502. function parse_separator() {
  28503. var cacheKey = "separator@" + pos.offset;
  28504. var cachedResult = cache[cacheKey];
  28505. if (cachedResult) {
  28506. pos = clone(cachedResult.nextPos);
  28507. return cachedResult.result;
  28508. }
  28509. var result0, result1;
  28510. if (/^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/.test(input.charAt(pos.offset))) {
  28511. result1 = input.charAt(pos.offset);
  28512. advance(pos, 1);
  28513. } else {
  28514. result1 = null;
  28515. if (reportFailures === 0) {
  28516. matchFailed("[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  28517. }
  28518. }
  28519. if (result1 !== null) {
  28520. result0 = [];
  28521. while (result1 !== null) {
  28522. result0.push(result1);
  28523. if (/^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/.test(input.charAt(pos.offset))) {
  28524. result1 = input.charAt(pos.offset);
  28525. advance(pos, 1);
  28526. } else {
  28527. result1 = null;
  28528. if (reportFailures === 0) {
  28529. matchFailed("[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  28530. }
  28531. }
  28532. }
  28533. } else {
  28534. result0 = null;
  28535. }
  28536. cache[cacheKey] = {
  28537. nextPos: clone(pos),
  28538. result: result0
  28539. };
  28540. return result0;
  28541. }
  28542. function parse_comments() {
  28543. var cacheKey = "comments@" + pos.offset;
  28544. var cachedResult = cache[cacheKey];
  28545. if (cachedResult) {
  28546. pos = clone(cachedResult.nextPos);
  28547. return cachedResult.result;
  28548. }
  28549. var result0, result1, result2, result3;
  28550. var pos0;
  28551. pos0 = clone(pos);
  28552. if (/^["]/.test(input.charAt(pos.offset))) {
  28553. result1 = input.charAt(pos.offset);
  28554. advance(pos, 1);
  28555. } else {
  28556. result1 = null;
  28557. if (reportFailures === 0) {
  28558. matchFailed("[\"]");
  28559. }
  28560. }
  28561. if (result1 !== null) {
  28562. result2 = [];
  28563. if (/^[^"]/.test(input.charAt(pos.offset))) {
  28564. result3 = input.charAt(pos.offset);
  28565. advance(pos, 1);
  28566. } else {
  28567. result3 = null;
  28568. if (reportFailures === 0) {
  28569. matchFailed("[^\"]");
  28570. }
  28571. }
  28572. while (result3 !== null) {
  28573. result2.push(result3);
  28574. if (/^[^"]/.test(input.charAt(pos.offset))) {
  28575. result3 = input.charAt(pos.offset);
  28576. advance(pos, 1);
  28577. } else {
  28578. result3 = null;
  28579. if (reportFailures === 0) {
  28580. matchFailed("[^\"]");
  28581. }
  28582. }
  28583. }
  28584. if (result2 !== null) {
  28585. if (/^["]/.test(input.charAt(pos.offset))) {
  28586. result3 = input.charAt(pos.offset);
  28587. advance(pos, 1);
  28588. } else {
  28589. result3 = null;
  28590. if (reportFailures === 0) {
  28591. matchFailed("[\"]");
  28592. }
  28593. }
  28594. if (result3 !== null) {
  28595. result1 = [result1, result2, result3];
  28596. } else {
  28597. result1 = null;
  28598. pos = clone(pos0);
  28599. }
  28600. } else {
  28601. result1 = null;
  28602. pos = clone(pos0);
  28603. }
  28604. } else {
  28605. result1 = null;
  28606. pos = clone(pos0);
  28607. }
  28608. if (result1 !== null) {
  28609. result0 = [];
  28610. while (result1 !== null) {
  28611. result0.push(result1);
  28612. pos0 = clone(pos);
  28613. if (/^["]/.test(input.charAt(pos.offset))) {
  28614. result1 = input.charAt(pos.offset);
  28615. advance(pos, 1);
  28616. } else {
  28617. result1 = null;
  28618. if (reportFailures === 0) {
  28619. matchFailed("[\"]");
  28620. }
  28621. }
  28622. if (result1 !== null) {
  28623. result2 = [];
  28624. if (/^[^"]/.test(input.charAt(pos.offset))) {
  28625. result3 = input.charAt(pos.offset);
  28626. advance(pos, 1);
  28627. } else {
  28628. result3 = null;
  28629. if (reportFailures === 0) {
  28630. matchFailed("[^\"]");
  28631. }
  28632. }
  28633. while (result3 !== null) {
  28634. result2.push(result3);
  28635. if (/^[^"]/.test(input.charAt(pos.offset))) {
  28636. result3 = input.charAt(pos.offset);
  28637. advance(pos, 1);
  28638. } else {
  28639. result3 = null;
  28640. if (reportFailures === 0) {
  28641. matchFailed("[^\"]");
  28642. }
  28643. }
  28644. }
  28645. if (result2 !== null) {
  28646. if (/^["]/.test(input.charAt(pos.offset))) {
  28647. result3 = input.charAt(pos.offset);
  28648. advance(pos, 1);
  28649. } else {
  28650. result3 = null;
  28651. if (reportFailures === 0) {
  28652. matchFailed("[\"]");
  28653. }
  28654. }
  28655. if (result3 !== null) {
  28656. result1 = [result1, result2, result3];
  28657. } else {
  28658. result1 = null;
  28659. pos = clone(pos0);
  28660. }
  28661. } else {
  28662. result1 = null;
  28663. pos = clone(pos0);
  28664. }
  28665. } else {
  28666. result1 = null;
  28667. pos = clone(pos0);
  28668. }
  28669. }
  28670. } else {
  28671. result0 = null;
  28672. }
  28673. cache[cacheKey] = {
  28674. nextPos: clone(pos),
  28675. result: result0
  28676. };
  28677. return result0;
  28678. }
  28679. function parse_ws() {
  28680. var cacheKey = "ws@" + pos.offset;
  28681. var cachedResult = cache[cacheKey];
  28682. if (cachedResult) {
  28683. pos = clone(cachedResult.nextPos);
  28684. return cachedResult.result;
  28685. }
  28686. var result0, result1;
  28687. result0 = [];
  28688. result1 = parse_separator();
  28689. if (result1 === null) {
  28690. result1 = parse_comments();
  28691. }
  28692. while (result1 !== null) {
  28693. result0.push(result1);
  28694. result1 = parse_separator();
  28695. if (result1 === null) {
  28696. result1 = parse_comments();
  28697. }
  28698. }
  28699. cache[cacheKey] = {
  28700. nextPos: clone(pos),
  28701. result: result0
  28702. };
  28703. return result0;
  28704. }
  28705. function parse_identifier() {
  28706. var cacheKey = "identifier@" + pos.offset;
  28707. var cachedResult = cache[cacheKey];
  28708. if (cachedResult) {
  28709. pos = clone(cachedResult.nextPos);
  28710. return cachedResult.result;
  28711. }
  28712. var result0, result1, result2;
  28713. var pos0, pos1;
  28714. pos0 = clone(pos);
  28715. pos1 = clone(pos);
  28716. if (/^[a-zA-Z]/.test(input.charAt(pos.offset))) {
  28717. result0 = input.charAt(pos.offset);
  28718. advance(pos, 1);
  28719. } else {
  28720. result0 = null;
  28721. if (reportFailures === 0) {
  28722. matchFailed("[a-zA-Z]");
  28723. }
  28724. }
  28725. if (result0 !== null) {
  28726. result1 = [];
  28727. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28728. result2 = input.charAt(pos.offset);
  28729. advance(pos, 1);
  28730. } else {
  28731. result2 = null;
  28732. if (reportFailures === 0) {
  28733. matchFailed("[a-zA-Z0-9]");
  28734. }
  28735. }
  28736. while (result2 !== null) {
  28737. result1.push(result2);
  28738. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28739. result2 = input.charAt(pos.offset);
  28740. advance(pos, 1);
  28741. } else {
  28742. result2 = null;
  28743. if (reportFailures === 0) {
  28744. matchFailed("[a-zA-Z0-9]");
  28745. }
  28746. }
  28747. }
  28748. if (result1 !== null) {
  28749. result0 = [result0, result1];
  28750. } else {
  28751. result0 = null;
  28752. pos = clone(pos1);
  28753. }
  28754. } else {
  28755. result0 = null;
  28756. pos = clone(pos1);
  28757. }
  28758. if (result0 !== null) {
  28759. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  28760. }
  28761. if (result0 === null) {
  28762. pos = clone(pos0);
  28763. }
  28764. cache[cacheKey] = {
  28765. nextPos: clone(pos),
  28766. result: result0
  28767. };
  28768. return result0;
  28769. }
  28770. function parse_varIdentifier() {
  28771. var cacheKey = "varIdentifier@" + pos.offset;
  28772. var cachedResult = cache[cacheKey];
  28773. if (cachedResult) {
  28774. pos = clone(cachedResult.nextPos);
  28775. return cachedResult.result;
  28776. }
  28777. var result0, result1, result2;
  28778. var pos0, pos1;
  28779. pos0 = clone(pos);
  28780. pos1 = clone(pos);
  28781. if (/^[a-z]/.test(input.charAt(pos.offset))) {
  28782. result0 = input.charAt(pos.offset);
  28783. advance(pos, 1);
  28784. } else {
  28785. result0 = null;
  28786. if (reportFailures === 0) {
  28787. matchFailed("[a-z]");
  28788. }
  28789. }
  28790. if (result0 !== null) {
  28791. result1 = [];
  28792. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28793. result2 = input.charAt(pos.offset);
  28794. advance(pos, 1);
  28795. } else {
  28796. result2 = null;
  28797. if (reportFailures === 0) {
  28798. matchFailed("[a-zA-Z0-9]");
  28799. }
  28800. }
  28801. while (result2 !== null) {
  28802. result1.push(result2);
  28803. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28804. result2 = input.charAt(pos.offset);
  28805. advance(pos, 1);
  28806. } else {
  28807. result2 = null;
  28808. if (reportFailures === 0) {
  28809. matchFailed("[a-zA-Z0-9]");
  28810. }
  28811. }
  28812. }
  28813. if (result1 !== null) {
  28814. result0 = [result0, result1];
  28815. } else {
  28816. result0 = null;
  28817. pos = clone(pos1);
  28818. }
  28819. } else {
  28820. result0 = null;
  28821. pos = clone(pos1);
  28822. }
  28823. if (result0 !== null) {
  28824. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  28825. }
  28826. if (result0 === null) {
  28827. pos = clone(pos0);
  28828. }
  28829. cache[cacheKey] = {
  28830. nextPos: clone(pos),
  28831. result: result0
  28832. };
  28833. return result0;
  28834. }
  28835. function parse_keyword() {
  28836. var cacheKey = "keyword@" + pos.offset;
  28837. var cachedResult = cache[cacheKey];
  28838. if (cachedResult) {
  28839. pos = clone(cachedResult.nextPos);
  28840. return cachedResult.result;
  28841. }
  28842. var result0, result1;
  28843. var pos0, pos1;
  28844. pos0 = clone(pos);
  28845. pos1 = clone(pos);
  28846. result0 = parse_identifier();
  28847. if (result0 !== null) {
  28848. if (/^[:]/.test(input.charAt(pos.offset))) {
  28849. result1 = input.charAt(pos.offset);
  28850. advance(pos, 1);
  28851. } else {
  28852. result1 = null;
  28853. if (reportFailures === 0) {
  28854. matchFailed("[:]");
  28855. }
  28856. }
  28857. if (result1 !== null) {
  28858. result0 = [result0, result1];
  28859. } else {
  28860. result0 = null;
  28861. pos = clone(pos1);
  28862. }
  28863. } else {
  28864. result0 = null;
  28865. pos = clone(pos1);
  28866. }
  28867. if (result0 !== null) {
  28868. result0 = (function(offset, line, column, first, last) {return first + last;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  28869. }
  28870. if (result0 === null) {
  28871. pos = clone(pos0);
  28872. }
  28873. cache[cacheKey] = {
  28874. nextPos: clone(pos),
  28875. result: result0
  28876. };
  28877. return result0;
  28878. }
  28879. function parse_selector() {
  28880. var cacheKey = "selector@" + pos.offset;
  28881. var cachedResult = cache[cacheKey];
  28882. if (cachedResult) {
  28883. pos = clone(cachedResult.nextPos);
  28884. return cachedResult.result;
  28885. }
  28886. var result0, result1, result2;
  28887. var pos0, pos1;
  28888. pos0 = clone(pos);
  28889. pos1 = clone(pos);
  28890. if (/^[a-zA-Z]/.test(input.charAt(pos.offset))) {
  28891. result0 = input.charAt(pos.offset);
  28892. advance(pos, 1);
  28893. } else {
  28894. result0 = null;
  28895. if (reportFailures === 0) {
  28896. matchFailed("[a-zA-Z]");
  28897. }
  28898. }
  28899. if (result0 !== null) {
  28900. result1 = [];
  28901. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos.offset))) {
  28902. result2 = input.charAt(pos.offset);
  28903. advance(pos, 1);
  28904. } else {
  28905. result2 = null;
  28906. if (reportFailures === 0) {
  28907. matchFailed("[a-zA-Z0-9:]");
  28908. }
  28909. }
  28910. while (result2 !== null) {
  28911. result1.push(result2);
  28912. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos.offset))) {
  28913. result2 = input.charAt(pos.offset);
  28914. advance(pos, 1);
  28915. } else {
  28916. result2 = null;
  28917. if (reportFailures === 0) {
  28918. matchFailed("[a-zA-Z0-9:]");
  28919. }
  28920. }
  28921. }
  28922. if (result1 !== null) {
  28923. result0 = [result0, result1];
  28924. } else {
  28925. result0 = null;
  28926. pos = clone(pos1);
  28927. }
  28928. } else {
  28929. result0 = null;
  28930. pos = clone(pos1);
  28931. }
  28932. if (result0 !== null) {
  28933. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  28934. }
  28935. if (result0 === null) {
  28936. pos = clone(pos0);
  28937. }
  28938. cache[cacheKey] = {
  28939. nextPos: clone(pos),
  28940. result: result0
  28941. };
  28942. return result0;
  28943. }
  28944. function parse_className() {
  28945. var cacheKey = "className@" + pos.offset;
  28946. var cachedResult = cache[cacheKey];
  28947. if (cachedResult) {
  28948. pos = clone(cachedResult.nextPos);
  28949. return cachedResult.result;
  28950. }
  28951. var result0, result1, result2;
  28952. var pos0, pos1;
  28953. pos0 = clone(pos);
  28954. pos1 = clone(pos);
  28955. if (/^[A-Z]/.test(input.charAt(pos.offset))) {
  28956. result0 = input.charAt(pos.offset);
  28957. advance(pos, 1);
  28958. } else {
  28959. result0 = null;
  28960. if (reportFailures === 0) {
  28961. matchFailed("[A-Z]");
  28962. }
  28963. }
  28964. if (result0 !== null) {
  28965. result1 = [];
  28966. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28967. result2 = input.charAt(pos.offset);
  28968. advance(pos, 1);
  28969. } else {
  28970. result2 = null;
  28971. if (reportFailures === 0) {
  28972. matchFailed("[a-zA-Z0-9]");
  28973. }
  28974. }
  28975. while (result2 !== null) {
  28976. result1.push(result2);
  28977. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28978. result2 = input.charAt(pos.offset);
  28979. advance(pos, 1);
  28980. } else {
  28981. result2 = null;
  28982. if (reportFailures === 0) {
  28983. matchFailed("[a-zA-Z0-9]");
  28984. }
  28985. }
  28986. }
  28987. if (result1 !== null) {
  28988. result0 = [result0, result1];
  28989. } else {
  28990. result0 = null;
  28991. pos = clone(pos1);
  28992. }
  28993. } else {
  28994. result0 = null;
  28995. pos = clone(pos1);
  28996. }
  28997. if (result0 !== null) {
  28998. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  28999. }
  29000. if (result0 === null) {
  29001. pos = clone(pos0);
  29002. }
  29003. cache[cacheKey] = {
  29004. nextPos: clone(pos),
  29005. result: result0
  29006. };
  29007. return result0;
  29008. }
  29009. function parse_string() {
  29010. var cacheKey = "string@" + pos.offset;
  29011. var cachedResult = cache[cacheKey];
  29012. if (cachedResult) {
  29013. pos = clone(cachedResult.nextPos);
  29014. return cachedResult.result;
  29015. }
  29016. var result0, result1, result2;
  29017. var pos0, pos1, pos2;
  29018. pos0 = clone(pos);
  29019. pos1 = clone(pos);
  29020. if (/^[']/.test(input.charAt(pos.offset))) {
  29021. result0 = input.charAt(pos.offset);
  29022. advance(pos, 1);
  29023. } else {
  29024. result0 = null;
  29025. if (reportFailures === 0) {
  29026. matchFailed("[']");
  29027. }
  29028. }
  29029. if (result0 !== null) {
  29030. result1 = [];
  29031. pos2 = clone(pos);
  29032. if (input.substr(pos.offset, 2) === "''") {
  29033. result2 = "''";
  29034. advance(pos, 2);
  29035. } else {
  29036. result2 = null;
  29037. if (reportFailures === 0) {
  29038. matchFailed("\"''\"");
  29039. }
  29040. }
  29041. if (result2 !== null) {
  29042. result2 = (function(offset, line, column) {return "'";})(pos2.offset, pos2.line, pos2.column);
  29043. }
  29044. if (result2 === null) {
  29045. pos = clone(pos2);
  29046. }
  29047. if (result2 === null) {
  29048. if (/^[^']/.test(input.charAt(pos.offset))) {
  29049. result2 = input.charAt(pos.offset);
  29050. advance(pos, 1);
  29051. } else {
  29052. result2 = null;
  29053. if (reportFailures === 0) {
  29054. matchFailed("[^']");
  29055. }
  29056. }
  29057. }
  29058. while (result2 !== null) {
  29059. result1.push(result2);
  29060. pos2 = clone(pos);
  29061. if (input.substr(pos.offset, 2) === "''") {
  29062. result2 = "''";
  29063. advance(pos, 2);
  29064. } else {
  29065. result2 = null;
  29066. if (reportFailures === 0) {
  29067. matchFailed("\"''\"");
  29068. }
  29069. }
  29070. if (result2 !== null) {
  29071. result2 = (function(offset, line, column) {return "'";})(pos2.offset, pos2.line, pos2.column);
  29072. }
  29073. if (result2 === null) {
  29074. pos = clone(pos2);
  29075. }
  29076. if (result2 === null) {
  29077. if (/^[^']/.test(input.charAt(pos.offset))) {
  29078. result2 = input.charAt(pos.offset);
  29079. advance(pos, 1);
  29080. } else {
  29081. result2 = null;
  29082. if (reportFailures === 0) {
  29083. matchFailed("[^']");
  29084. }
  29085. }
  29086. }
  29087. }
  29088. if (result1 !== null) {
  29089. if (/^[']/.test(input.charAt(pos.offset))) {
  29090. result2 = input.charAt(pos.offset);
  29091. advance(pos, 1);
  29092. } else {
  29093. result2 = null;
  29094. if (reportFailures === 0) {
  29095. matchFailed("[']");
  29096. }
  29097. }
  29098. if (result2 !== null) {
  29099. result0 = [result0, result1, result2];
  29100. } else {
  29101. result0 = null;
  29102. pos = clone(pos1);
  29103. }
  29104. } else {
  29105. result0 = null;
  29106. pos = clone(pos1);
  29107. }
  29108. } else {
  29109. result0 = null;
  29110. pos = clone(pos1);
  29111. }
  29112. if (result0 !== null) {
  29113. result0 = (function(offset, line, column, val) {
  29114. return smalltalk.ValueNode._new()
  29115. ._position_((line).__at(column))
  29116. ._value_(val.join("").replace(/\"/ig, '"'));
  29117. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  29118. }
  29119. if (result0 === null) {
  29120. pos = clone(pos0);
  29121. }
  29122. cache[cacheKey] = {
  29123. nextPos: clone(pos),
  29124. result: result0
  29125. };
  29126. return result0;
  29127. }
  29128. function parse_symbol() {
  29129. var cacheKey = "symbol@" + pos.offset;
  29130. var cachedResult = cache[cacheKey];
  29131. if (cachedResult) {
  29132. pos = clone(cachedResult.nextPos);
  29133. return cachedResult.result;
  29134. }
  29135. var result0, result1;
  29136. var pos0, pos1;
  29137. pos0 = clone(pos);
  29138. pos1 = clone(pos);
  29139. if (input.charCodeAt(pos.offset) === 35) {
  29140. result0 = "#";
  29141. advance(pos, 1);
  29142. } else {
  29143. result0 = null;
  29144. if (reportFailures === 0) {
  29145. matchFailed("\"#\"");
  29146. }
  29147. }
  29148. if (result0 !== null) {
  29149. result1 = parse_bareSymbol();
  29150. if (result1 !== null) {
  29151. result0 = [result0, result1];
  29152. } else {
  29153. result0 = null;
  29154. pos = clone(pos1);
  29155. }
  29156. } else {
  29157. result0 = null;
  29158. pos = clone(pos1);
  29159. }
  29160. if (result0 !== null) {
  29161. result0 = (function(offset, line, column, rest) {return rest;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  29162. }
  29163. if (result0 === null) {
  29164. pos = clone(pos0);
  29165. }
  29166. cache[cacheKey] = {
  29167. nextPos: clone(pos),
  29168. result: result0
  29169. };
  29170. return result0;
  29171. }
  29172. function parse_bareSymbol() {
  29173. var cacheKey = "bareSymbol@" + pos.offset;
  29174. var cachedResult = cache[cacheKey];
  29175. if (cachedResult) {
  29176. pos = clone(cachedResult.nextPos);
  29177. return cachedResult.result;
  29178. }
  29179. var result0;
  29180. var pos0, pos1;
  29181. pos0 = clone(pos);
  29182. result0 = parse_selector();
  29183. if (result0 === null) {
  29184. result0 = parse_binarySelector();
  29185. if (result0 === null) {
  29186. pos1 = clone(pos);
  29187. result0 = parse_string();
  29188. if (result0 !== null) {
  29189. result0 = (function(offset, line, column, node) {return node._value();})(pos1.offset, pos1.line, pos1.column, result0);
  29190. }
  29191. if (result0 === null) {
  29192. pos = clone(pos1);
  29193. }
  29194. }
  29195. }
  29196. if (result0 !== null) {
  29197. result0 = (function(offset, line, column, val) {
  29198. return smalltalk.ValueNode._new()
  29199. ._position_((line).__at(column))
  29200. ._value_(val);
  29201. })(pos0.offset, pos0.line, pos0.column, result0);
  29202. }
  29203. if (result0 === null) {
  29204. pos = clone(pos0);
  29205. }
  29206. cache[cacheKey] = {
  29207. nextPos: clone(pos),
  29208. result: result0
  29209. };
  29210. return result0;
  29211. }
  29212. function parse_number() {
  29213. var cacheKey = "number@" + pos.offset;
  29214. var cachedResult = cache[cacheKey];
  29215. if (cachedResult) {
  29216. pos = clone(cachedResult.nextPos);
  29217. return cachedResult.result;
  29218. }
  29219. var result0;
  29220. var pos0;
  29221. pos0 = clone(pos);
  29222. result0 = parse_hex();
  29223. if (result0 === null) {
  29224. result0 = parse_float();
  29225. if (result0 === null) {
  29226. result0 = parse_integer();
  29227. }
  29228. }
  29229. if (result0 !== null) {
  29230. result0 = (function(offset, line, column, n) {
  29231. return smalltalk.ValueNode._new()
  29232. ._position_((line).__at(column))
  29233. ._value_(n);
  29234. })(pos0.offset, pos0.line, pos0.column, result0);
  29235. }
  29236. if (result0 === null) {
  29237. pos = clone(pos0);
  29238. }
  29239. cache[cacheKey] = {
  29240. nextPos: clone(pos),
  29241. result: result0
  29242. };
  29243. return result0;
  29244. }
  29245. function parse_hex() {
  29246. var cacheKey = "hex@" + pos.offset;
  29247. var cachedResult = cache[cacheKey];
  29248. if (cachedResult) {
  29249. pos = clone(cachedResult.nextPos);
  29250. return cachedResult.result;
  29251. }
  29252. var result0, result1, result2, result3;
  29253. var pos0, pos1;
  29254. pos0 = clone(pos);
  29255. pos1 = clone(pos);
  29256. if (/^[\-]/.test(input.charAt(pos.offset))) {
  29257. result0 = input.charAt(pos.offset);
  29258. advance(pos, 1);
  29259. } else {
  29260. result0 = null;
  29261. if (reportFailures === 0) {
  29262. matchFailed("[\\-]");
  29263. }
  29264. }
  29265. result0 = result0 !== null ? result0 : "";
  29266. if (result0 !== null) {
  29267. if (input.substr(pos.offset, 3) === "16r") {
  29268. result1 = "16r";
  29269. advance(pos, 3);
  29270. } else {
  29271. result1 = null;
  29272. if (reportFailures === 0) {
  29273. matchFailed("\"16r\"");
  29274. }
  29275. }
  29276. if (result1 !== null) {
  29277. if (/^[0-9a-fA-F]/.test(input.charAt(pos.offset))) {
  29278. result3 = input.charAt(pos.offset);
  29279. advance(pos, 1);
  29280. } else {
  29281. result3 = null;
  29282. if (reportFailures === 0) {
  29283. matchFailed("[0-9a-fA-F]");
  29284. }
  29285. }
  29286. if (result3 !== null) {
  29287. result2 = [];
  29288. while (result3 !== null) {
  29289. result2.push(result3);
  29290. if (/^[0-9a-fA-F]/.test(input.charAt(pos.offset))) {
  29291. result3 = input.charAt(pos.offset);
  29292. advance(pos, 1);
  29293. } else {
  29294. result3 = null;
  29295. if (reportFailures === 0) {
  29296. matchFailed("[0-9a-fA-F]");
  29297. }
  29298. }
  29299. }
  29300. } else {
  29301. result2 = null;
  29302. }
  29303. if (result2 !== null) {
  29304. result0 = [result0, result1, result2];
  29305. } else {
  29306. result0 = null;
  29307. pos = clone(pos1);
  29308. }
  29309. } else {
  29310. result0 = null;
  29311. pos = clone(pos1);
  29312. }
  29313. } else {
  29314. result0 = null;
  29315. pos = clone(pos1);
  29316. }
  29317. if (result0 !== null) {
  29318. result0 = (function(offset, line, column, neg, num) {return parseInt((neg + num.join("")), 16);})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  29319. }
  29320. if (result0 === null) {
  29321. pos = clone(pos0);
  29322. }
  29323. cache[cacheKey] = {
  29324. nextPos: clone(pos),
  29325. result: result0
  29326. };
  29327. return result0;
  29328. }
  29329. function parse_float() {
  29330. var cacheKey = "float@" + pos.offset;
  29331. var cachedResult = cache[cacheKey];
  29332. if (cachedResult) {
  29333. pos = clone(cachedResult.nextPos);
  29334. return cachedResult.result;
  29335. }
  29336. var result0, result1, result2, result3, result4;
  29337. var pos0, pos1;
  29338. pos0 = clone(pos);
  29339. pos1 = clone(pos);
  29340. if (/^[\-]/.test(input.charAt(pos.offset))) {
  29341. result0 = input.charAt(pos.offset);
  29342. advance(pos, 1);
  29343. } else {
  29344. result0 = null;
  29345. if (reportFailures === 0) {
  29346. matchFailed("[\\-]");
  29347. }
  29348. }
  29349. result0 = result0 !== null ? result0 : "";
  29350. if (result0 !== null) {
  29351. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29352. result2 = input.charAt(pos.offset);
  29353. advance(pos, 1);
  29354. } else {
  29355. result2 = null;
  29356. if (reportFailures === 0) {
  29357. matchFailed("[0-9]");
  29358. }
  29359. }
  29360. if (result2 !== null) {
  29361. result1 = [];
  29362. while (result2 !== null) {
  29363. result1.push(result2);
  29364. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29365. result2 = input.charAt(pos.offset);
  29366. advance(pos, 1);
  29367. } else {
  29368. result2 = null;
  29369. if (reportFailures === 0) {
  29370. matchFailed("[0-9]");
  29371. }
  29372. }
  29373. }
  29374. } else {
  29375. result1 = null;
  29376. }
  29377. if (result1 !== null) {
  29378. if (input.charCodeAt(pos.offset) === 46) {
  29379. result2 = ".";
  29380. advance(pos, 1);
  29381. } else {
  29382. result2 = null;
  29383. if (reportFailures === 0) {
  29384. matchFailed("\".\"");
  29385. }
  29386. }
  29387. if (result2 !== null) {
  29388. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29389. result4 = input.charAt(pos.offset);
  29390. advance(pos, 1);
  29391. } else {
  29392. result4 = null;
  29393. if (reportFailures === 0) {
  29394. matchFailed("[0-9]");
  29395. }
  29396. }
  29397. if (result4 !== null) {
  29398. result3 = [];
  29399. while (result4 !== null) {
  29400. result3.push(result4);
  29401. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29402. result4 = input.charAt(pos.offset);
  29403. advance(pos, 1);
  29404. } else {
  29405. result4 = null;
  29406. if (reportFailures === 0) {
  29407. matchFailed("[0-9]");
  29408. }
  29409. }
  29410. }
  29411. } else {
  29412. result3 = null;
  29413. }
  29414. if (result3 !== null) {
  29415. result0 = [result0, result1, result2, result3];
  29416. } else {
  29417. result0 = null;
  29418. pos = clone(pos1);
  29419. }
  29420. } else {
  29421. result0 = null;
  29422. pos = clone(pos1);
  29423. }
  29424. } else {
  29425. result0 = null;
  29426. pos = clone(pos1);
  29427. }
  29428. } else {
  29429. result0 = null;
  29430. pos = clone(pos1);
  29431. }
  29432. if (result0 !== null) {
  29433. 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]);
  29434. }
  29435. if (result0 === null) {
  29436. pos = clone(pos0);
  29437. }
  29438. cache[cacheKey] = {
  29439. nextPos: clone(pos),
  29440. result: result0
  29441. };
  29442. return result0;
  29443. }
  29444. function parse_integer() {
  29445. var cacheKey = "integer@" + pos.offset;
  29446. var cachedResult = cache[cacheKey];
  29447. if (cachedResult) {
  29448. pos = clone(cachedResult.nextPos);
  29449. return cachedResult.result;
  29450. }
  29451. var result0, result1, result2;
  29452. var pos0, pos1;
  29453. pos0 = clone(pos);
  29454. pos1 = clone(pos);
  29455. if (/^[\-]/.test(input.charAt(pos.offset))) {
  29456. result0 = input.charAt(pos.offset);
  29457. advance(pos, 1);
  29458. } else {
  29459. result0 = null;
  29460. if (reportFailures === 0) {
  29461. matchFailed("[\\-]");
  29462. }
  29463. }
  29464. result0 = result0 !== null ? result0 : "";
  29465. if (result0 !== null) {
  29466. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29467. result2 = input.charAt(pos.offset);
  29468. advance(pos, 1);
  29469. } else {
  29470. result2 = null;
  29471. if (reportFailures === 0) {
  29472. matchFailed("[0-9]");
  29473. }
  29474. }
  29475. if (result2 !== null) {
  29476. result1 = [];
  29477. while (result2 !== null) {
  29478. result1.push(result2);
  29479. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29480. result2 = input.charAt(pos.offset);
  29481. advance(pos, 1);
  29482. } else {
  29483. result2 = null;
  29484. if (reportFailures === 0) {
  29485. matchFailed("[0-9]");
  29486. }
  29487. }
  29488. }
  29489. } else {
  29490. result1 = null;
  29491. }
  29492. if (result1 !== null) {
  29493. result0 = [result0, result1];
  29494. } else {
  29495. result0 = null;
  29496. pos = clone(pos1);
  29497. }
  29498. } else {
  29499. result0 = null;
  29500. pos = clone(pos1);
  29501. }
  29502. if (result0 !== null) {
  29503. result0 = (function(offset, line, column, neg, digits) {return (parseInt(neg+digits.join(""), 10));})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  29504. }
  29505. if (result0 === null) {
  29506. pos = clone(pos0);
  29507. }
  29508. cache[cacheKey] = {
  29509. nextPos: clone(pos),
  29510. result: result0
  29511. };
  29512. return result0;
  29513. }
  29514. function parse_literalArray() {
  29515. var cacheKey = "literalArray@" + pos.offset;
  29516. var cachedResult = cache[cacheKey];
  29517. if (cachedResult) {
  29518. pos = clone(cachedResult.nextPos);
  29519. return cachedResult.result;
  29520. }
  29521. var result0, result1;
  29522. var pos0, pos1;
  29523. pos0 = clone(pos);
  29524. pos1 = clone(pos);
  29525. if (input.substr(pos.offset, 2) === "#(") {
  29526. result0 = "#(";
  29527. advance(pos, 2);
  29528. } else {
  29529. result0 = null;
  29530. if (reportFailures === 0) {
  29531. matchFailed("\"#(\"");
  29532. }
  29533. }
  29534. if (result0 !== null) {
  29535. result1 = parse_literalArrayRest();
  29536. if (result1 !== null) {
  29537. result0 = [result0, result1];
  29538. } else {
  29539. result0 = null;
  29540. pos = clone(pos1);
  29541. }
  29542. } else {
  29543. result0 = null;
  29544. pos = clone(pos1);
  29545. }
  29546. if (result0 !== null) {
  29547. result0 = (function(offset, line, column, rest) {return rest;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  29548. }
  29549. if (result0 === null) {
  29550. pos = clone(pos0);
  29551. }
  29552. cache[cacheKey] = {
  29553. nextPos: clone(pos),
  29554. result: result0
  29555. };
  29556. return result0;
  29557. }
  29558. function parse_bareLiteralArray() {
  29559. var cacheKey = "bareLiteralArray@" + pos.offset;
  29560. var cachedResult = cache[cacheKey];
  29561. if (cachedResult) {
  29562. pos = clone(cachedResult.nextPos);
  29563. return cachedResult.result;
  29564. }
  29565. var result0, result1;
  29566. var pos0, pos1;
  29567. pos0 = clone(pos);
  29568. pos1 = clone(pos);
  29569. if (input.charCodeAt(pos.offset) === 40) {
  29570. result0 = "(";
  29571. advance(pos, 1);
  29572. } else {
  29573. result0 = null;
  29574. if (reportFailures === 0) {
  29575. matchFailed("\"(\"");
  29576. }
  29577. }
  29578. if (result0 !== null) {
  29579. result1 = parse_literalArrayRest();
  29580. if (result1 !== null) {
  29581. result0 = [result0, result1];
  29582. } else {
  29583. result0 = null;
  29584. pos = clone(pos1);
  29585. }
  29586. } else {
  29587. result0 = null;
  29588. pos = clone(pos1);
  29589. }
  29590. if (result0 !== null) {
  29591. result0 = (function(offset, line, column, rest) {return rest;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  29592. }
  29593. if (result0 === null) {
  29594. pos = clone(pos0);
  29595. }
  29596. cache[cacheKey] = {
  29597. nextPos: clone(pos),
  29598. result: result0
  29599. };
  29600. return result0;
  29601. }
  29602. function parse_literalArrayRest() {
  29603. var cacheKey = "literalArrayRest@" + pos.offset;
  29604. var cachedResult = cache[cacheKey];
  29605. if (cachedResult) {
  29606. pos = clone(cachedResult.nextPos);
  29607. return cachedResult.result;
  29608. }
  29609. var result0, result1, result2, result3;
  29610. var pos0, pos1, pos2, pos3;
  29611. pos0 = clone(pos);
  29612. pos1 = clone(pos);
  29613. result0 = parse_ws();
  29614. if (result0 !== null) {
  29615. result1 = [];
  29616. pos2 = clone(pos);
  29617. pos3 = clone(pos);
  29618. result2 = parse_parseTimeLiteral();
  29619. if (result2 === null) {
  29620. result2 = parse_bareLiteralArray();
  29621. if (result2 === null) {
  29622. result2 = parse_bareSymbol();
  29623. }
  29624. }
  29625. if (result2 !== null) {
  29626. result3 = parse_ws();
  29627. if (result3 !== null) {
  29628. result2 = [result2, result3];
  29629. } else {
  29630. result2 = null;
  29631. pos = clone(pos3);
  29632. }
  29633. } else {
  29634. result2 = null;
  29635. pos = clone(pos3);
  29636. }
  29637. if (result2 !== null) {
  29638. result2 = (function(offset, line, column, lit) {return lit._value();})(pos2.offset, pos2.line, pos2.column, result2[0]);
  29639. }
  29640. if (result2 === null) {
  29641. pos = clone(pos2);
  29642. }
  29643. while (result2 !== null) {
  29644. result1.push(result2);
  29645. pos2 = clone(pos);
  29646. pos3 = clone(pos);
  29647. result2 = parse_parseTimeLiteral();
  29648. if (result2 === null) {
  29649. result2 = parse_bareLiteralArray();
  29650. if (result2 === null) {
  29651. result2 = parse_bareSymbol();
  29652. }
  29653. }
  29654. if (result2 !== null) {
  29655. result3 = parse_ws();
  29656. if (result3 !== null) {
  29657. result2 = [result2, result3];
  29658. } else {
  29659. result2 = null;
  29660. pos = clone(pos3);
  29661. }
  29662. } else {
  29663. result2 = null;
  29664. pos = clone(pos3);
  29665. }
  29666. if (result2 !== null) {
  29667. result2 = (function(offset, line, column, lit) {return lit._value();})(pos2.offset, pos2.line, pos2.column, result2[0]);
  29668. }
  29669. if (result2 === null) {
  29670. pos = clone(pos2);
  29671. }
  29672. }
  29673. if (result1 !== null) {
  29674. result2 = parse_ws();
  29675. if (result2 !== null) {
  29676. if (input.charCodeAt(pos.offset) === 41) {
  29677. result3 = ")";
  29678. advance(pos, 1);
  29679. } else {
  29680. result3 = null;
  29681. if (reportFailures === 0) {
  29682. matchFailed("\")\"");
  29683. }
  29684. }
  29685. if (result3 !== null) {
  29686. result0 = [result0, result1, result2, result3];
  29687. } else {
  29688. result0 = null;
  29689. pos = clone(pos1);
  29690. }
  29691. } else {
  29692. result0 = null;
  29693. pos = clone(pos1);
  29694. }
  29695. } else {
  29696. result0 = null;
  29697. pos = clone(pos1);
  29698. }
  29699. } else {
  29700. result0 = null;
  29701. pos = clone(pos1);
  29702. }
  29703. if (result0 !== null) {
  29704. result0 = (function(offset, line, column, lits) {
  29705. return smalltalk.ValueNode._new()
  29706. ._position_((line).__at(column))
  29707. ._value_(lits);
  29708. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  29709. }
  29710. if (result0 === null) {
  29711. pos = clone(pos0);
  29712. }
  29713. cache[cacheKey] = {
  29714. nextPos: clone(pos),
  29715. result: result0
  29716. };
  29717. return result0;
  29718. }
  29719. function parse_dynamicArray() {
  29720. var cacheKey = "dynamicArray@" + pos.offset;
  29721. var cachedResult = cache[cacheKey];
  29722. if (cachedResult) {
  29723. pos = clone(cachedResult.nextPos);
  29724. return cachedResult.result;
  29725. }
  29726. var result0, result1, result2, result3, result4, result5;
  29727. var pos0, pos1;
  29728. pos0 = clone(pos);
  29729. pos1 = clone(pos);
  29730. if (input.charCodeAt(pos.offset) === 123) {
  29731. result0 = "{";
  29732. advance(pos, 1);
  29733. } else {
  29734. result0 = null;
  29735. if (reportFailures === 0) {
  29736. matchFailed("\"{\"");
  29737. }
  29738. }
  29739. if (result0 !== null) {
  29740. result1 = parse_ws();
  29741. if (result1 !== null) {
  29742. result2 = parse_expressions();
  29743. result2 = result2 !== null ? result2 : "";
  29744. if (result2 !== null) {
  29745. result3 = parse_ws();
  29746. if (result3 !== null) {
  29747. if (input.charCodeAt(pos.offset) === 46) {
  29748. result4 = ".";
  29749. advance(pos, 1);
  29750. } else {
  29751. result4 = null;
  29752. if (reportFailures === 0) {
  29753. matchFailed("\".\"");
  29754. }
  29755. }
  29756. result4 = result4 !== null ? result4 : "";
  29757. if (result4 !== null) {
  29758. if (input.charCodeAt(pos.offset) === 125) {
  29759. result5 = "}";
  29760. advance(pos, 1);
  29761. } else {
  29762. result5 = null;
  29763. if (reportFailures === 0) {
  29764. matchFailed("\"}\"");
  29765. }
  29766. }
  29767. if (result5 !== null) {
  29768. result0 = [result0, result1, result2, result3, result4, result5];
  29769. } else {
  29770. result0 = null;
  29771. pos = clone(pos1);
  29772. }
  29773. } else {
  29774. result0 = null;
  29775. pos = clone(pos1);
  29776. }
  29777. } else {
  29778. result0 = null;
  29779. pos = clone(pos1);
  29780. }
  29781. } else {
  29782. result0 = null;
  29783. pos = clone(pos1);
  29784. }
  29785. } else {
  29786. result0 = null;
  29787. pos = clone(pos1);
  29788. }
  29789. } else {
  29790. result0 = null;
  29791. pos = clone(pos1);
  29792. }
  29793. if (result0 !== null) {
  29794. result0 = (function(offset, line, column, expressions) {
  29795. return smalltalk.DynamicArrayNode._new()
  29796. ._position_((line).__at(column))
  29797. ._nodes_(expressions);
  29798. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  29799. }
  29800. if (result0 === null) {
  29801. pos = clone(pos0);
  29802. }
  29803. cache[cacheKey] = {
  29804. nextPos: clone(pos),
  29805. result: result0
  29806. };
  29807. return result0;
  29808. }
  29809. function parse_dynamicDictionary() {
  29810. var cacheKey = "dynamicDictionary@" + pos.offset;
  29811. var cachedResult = cache[cacheKey];
  29812. if (cachedResult) {
  29813. pos = clone(cachedResult.nextPos);
  29814. return cachedResult.result;
  29815. }
  29816. var result0, result1, result2, result3, result4;
  29817. var pos0, pos1;
  29818. pos0 = clone(pos);
  29819. pos1 = clone(pos);
  29820. if (input.substr(pos.offset, 2) === "#{") {
  29821. result0 = "#{";
  29822. advance(pos, 2);
  29823. } else {
  29824. result0 = null;
  29825. if (reportFailures === 0) {
  29826. matchFailed("\"#{\"");
  29827. }
  29828. }
  29829. if (result0 !== null) {
  29830. result1 = parse_ws();
  29831. if (result1 !== null) {
  29832. result2 = parse_expressions();
  29833. result2 = result2 !== null ? result2 : "";
  29834. if (result2 !== null) {
  29835. result3 = parse_ws();
  29836. if (result3 !== null) {
  29837. if (input.charCodeAt(pos.offset) === 125) {
  29838. result4 = "}";
  29839. advance(pos, 1);
  29840. } else {
  29841. result4 = null;
  29842. if (reportFailures === 0) {
  29843. matchFailed("\"}\"");
  29844. }
  29845. }
  29846. if (result4 !== null) {
  29847. result0 = [result0, result1, result2, result3, result4];
  29848. } else {
  29849. result0 = null;
  29850. pos = clone(pos1);
  29851. }
  29852. } else {
  29853. result0 = null;
  29854. pos = clone(pos1);
  29855. }
  29856. } else {
  29857. result0 = null;
  29858. pos = clone(pos1);
  29859. }
  29860. } else {
  29861. result0 = null;
  29862. pos = clone(pos1);
  29863. }
  29864. } else {
  29865. result0 = null;
  29866. pos = clone(pos1);
  29867. }
  29868. if (result0 !== null) {
  29869. result0 = (function(offset, line, column, expressions) {
  29870. return smalltalk.DynamicDictionaryNode._new()
  29871. ._position_((line).__at(column))
  29872. ._nodes_(expressions);
  29873. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  29874. }
  29875. if (result0 === null) {
  29876. pos = clone(pos0);
  29877. }
  29878. cache[cacheKey] = {
  29879. nextPos: clone(pos),
  29880. result: result0
  29881. };
  29882. return result0;
  29883. }
  29884. function parse_pseudoVariable() {
  29885. var cacheKey = "pseudoVariable@" + pos.offset;
  29886. var cachedResult = cache[cacheKey];
  29887. if (cachedResult) {
  29888. pos = clone(cachedResult.nextPos);
  29889. return cachedResult.result;
  29890. }
  29891. var result0;
  29892. var pos0, pos1;
  29893. pos0 = clone(pos);
  29894. pos1 = clone(pos);
  29895. if (input.substr(pos.offset, 4) === "true") {
  29896. result0 = "true";
  29897. advance(pos, 4);
  29898. } else {
  29899. result0 = null;
  29900. if (reportFailures === 0) {
  29901. matchFailed("\"true\"");
  29902. }
  29903. }
  29904. if (result0 !== null) {
  29905. result0 = (function(offset, line, column) {return true;})(pos1.offset, pos1.line, pos1.column);
  29906. }
  29907. if (result0 === null) {
  29908. pos = clone(pos1);
  29909. }
  29910. if (result0 === null) {
  29911. pos1 = clone(pos);
  29912. if (input.substr(pos.offset, 5) === "false") {
  29913. result0 = "false";
  29914. advance(pos, 5);
  29915. } else {
  29916. result0 = null;
  29917. if (reportFailures === 0) {
  29918. matchFailed("\"false\"");
  29919. }
  29920. }
  29921. if (result0 !== null) {
  29922. result0 = (function(offset, line, column) {return false;})(pos1.offset, pos1.line, pos1.column);
  29923. }
  29924. if (result0 === null) {
  29925. pos = clone(pos1);
  29926. }
  29927. if (result0 === null) {
  29928. pos1 = clone(pos);
  29929. if (input.substr(pos.offset, 3) === "nil") {
  29930. result0 = "nil";
  29931. advance(pos, 3);
  29932. } else {
  29933. result0 = null;
  29934. if (reportFailures === 0) {
  29935. matchFailed("\"nil\"");
  29936. }
  29937. }
  29938. if (result0 !== null) {
  29939. result0 = (function(offset, line, column) {return nil;})(pos1.offset, pos1.line, pos1.column);
  29940. }
  29941. if (result0 === null) {
  29942. pos = clone(pos1);
  29943. }
  29944. }
  29945. }
  29946. if (result0 !== null) {
  29947. result0 = (function(offset, line, column, val) {
  29948. return smalltalk.ValueNode._new()
  29949. ._position_((line).__at(column))
  29950. ._value_(val);
  29951. })(pos0.offset, pos0.line, pos0.column, result0);
  29952. }
  29953. if (result0 === null) {
  29954. pos = clone(pos0);
  29955. }
  29956. cache[cacheKey] = {
  29957. nextPos: clone(pos),
  29958. result: result0
  29959. };
  29960. return result0;
  29961. }
  29962. function parse_parseTimeLiteral() {
  29963. var cacheKey = "parseTimeLiteral@" + pos.offset;
  29964. var cachedResult = cache[cacheKey];
  29965. if (cachedResult) {
  29966. pos = clone(cachedResult.nextPos);
  29967. return cachedResult.result;
  29968. }
  29969. var result0;
  29970. result0 = parse_pseudoVariable();
  29971. if (result0 === null) {
  29972. result0 = parse_number();
  29973. if (result0 === null) {
  29974. result0 = parse_literalArray();
  29975. if (result0 === null) {
  29976. result0 = parse_string();
  29977. if (result0 === null) {
  29978. result0 = parse_symbol();
  29979. }
  29980. }
  29981. }
  29982. }
  29983. cache[cacheKey] = {
  29984. nextPos: clone(pos),
  29985. result: result0
  29986. };
  29987. return result0;
  29988. }
  29989. function parse_runtimeLiteral() {
  29990. var cacheKey = "runtimeLiteral@" + pos.offset;
  29991. var cachedResult = cache[cacheKey];
  29992. if (cachedResult) {
  29993. pos = clone(cachedResult.nextPos);
  29994. return cachedResult.result;
  29995. }
  29996. var result0;
  29997. result0 = parse_dynamicDictionary();
  29998. if (result0 === null) {
  29999. result0 = parse_dynamicArray();
  30000. if (result0 === null) {
  30001. result0 = parse_block();
  30002. }
  30003. }
  30004. cache[cacheKey] = {
  30005. nextPos: clone(pos),
  30006. result: result0
  30007. };
  30008. return result0;
  30009. }
  30010. function parse_literal() {
  30011. var cacheKey = "literal@" + pos.offset;
  30012. var cachedResult = cache[cacheKey];
  30013. if (cachedResult) {
  30014. pos = clone(cachedResult.nextPos);
  30015. return cachedResult.result;
  30016. }
  30017. var result0;
  30018. result0 = parse_runtimeLiteral();
  30019. if (result0 === null) {
  30020. result0 = parse_parseTimeLiteral();
  30021. }
  30022. cache[cacheKey] = {
  30023. nextPos: clone(pos),
  30024. result: result0
  30025. };
  30026. return result0;
  30027. }
  30028. function parse_variable() {
  30029. var cacheKey = "variable@" + pos.offset;
  30030. var cachedResult = cache[cacheKey];
  30031. if (cachedResult) {
  30032. pos = clone(cachedResult.nextPos);
  30033. return cachedResult.result;
  30034. }
  30035. var result0;
  30036. var pos0;
  30037. pos0 = clone(pos);
  30038. result0 = parse_varIdentifier();
  30039. if (result0 !== null) {
  30040. result0 = (function(offset, line, column, identifier) {
  30041. return smalltalk.VariableNode._new()
  30042. ._position_((line).__at(column))
  30043. ._value_(identifier);
  30044. })(pos0.offset, pos0.line, pos0.column, result0);
  30045. }
  30046. if (result0 === null) {
  30047. pos = clone(pos0);
  30048. }
  30049. cache[cacheKey] = {
  30050. nextPos: clone(pos),
  30051. result: result0
  30052. };
  30053. return result0;
  30054. }
  30055. function parse_classReference() {
  30056. var cacheKey = "classReference@" + pos.offset;
  30057. var cachedResult = cache[cacheKey];
  30058. if (cachedResult) {
  30059. pos = clone(cachedResult.nextPos);
  30060. return cachedResult.result;
  30061. }
  30062. var result0;
  30063. var pos0;
  30064. pos0 = clone(pos);
  30065. result0 = parse_className();
  30066. if (result0 !== null) {
  30067. result0 = (function(offset, line, column, className) {
  30068. return smalltalk.ClassReferenceNode._new()
  30069. ._position_((line).__at(column))
  30070. ._value_(className);
  30071. })(pos0.offset, pos0.line, pos0.column, result0);
  30072. }
  30073. if (result0 === null) {
  30074. pos = clone(pos0);
  30075. }
  30076. cache[cacheKey] = {
  30077. nextPos: clone(pos),
  30078. result: result0
  30079. };
  30080. return result0;
  30081. }
  30082. function parse_reference() {
  30083. var cacheKey = "reference@" + pos.offset;
  30084. var cachedResult = cache[cacheKey];
  30085. if (cachedResult) {
  30086. pos = clone(cachedResult.nextPos);
  30087. return cachedResult.result;
  30088. }
  30089. var result0;
  30090. result0 = parse_variable();
  30091. if (result0 === null) {
  30092. result0 = parse_classReference();
  30093. }
  30094. cache[cacheKey] = {
  30095. nextPos: clone(pos),
  30096. result: result0
  30097. };
  30098. return result0;
  30099. }
  30100. function parse_keywordPair() {
  30101. var cacheKey = "keywordPair@" + pos.offset;
  30102. var cachedResult = cache[cacheKey];
  30103. if (cachedResult) {
  30104. pos = clone(cachedResult.nextPos);
  30105. return cachedResult.result;
  30106. }
  30107. var result0, result1, result2, result3;
  30108. var pos0, pos1;
  30109. pos0 = clone(pos);
  30110. pos1 = clone(pos);
  30111. result0 = parse_keyword();
  30112. if (result0 !== null) {
  30113. result1 = parse_ws();
  30114. if (result1 !== null) {
  30115. result2 = parse_binarySend();
  30116. if (result2 !== null) {
  30117. result3 = parse_ws();
  30118. if (result3 !== null) {
  30119. result0 = [result0, result1, result2, result3];
  30120. } else {
  30121. result0 = null;
  30122. pos = clone(pos1);
  30123. }
  30124. } else {
  30125. result0 = null;
  30126. pos = clone(pos1);
  30127. }
  30128. } else {
  30129. result0 = null;
  30130. pos = clone(pos1);
  30131. }
  30132. } else {
  30133. result0 = null;
  30134. pos = clone(pos1);
  30135. }
  30136. if (result0 !== null) {
  30137. result0 = (function(offset, line, column, key, arg) {return {key:key, arg: arg};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  30138. }
  30139. if (result0 === null) {
  30140. pos = clone(pos0);
  30141. }
  30142. cache[cacheKey] = {
  30143. nextPos: clone(pos),
  30144. result: result0
  30145. };
  30146. return result0;
  30147. }
  30148. function parse_binarySelector() {
  30149. var cacheKey = "binarySelector@" + pos.offset;
  30150. var cachedResult = cache[cacheKey];
  30151. if (cachedResult) {
  30152. pos = clone(cachedResult.nextPos);
  30153. return cachedResult.result;
  30154. }
  30155. var result0, result1;
  30156. var pos0;
  30157. pos0 = clone(pos);
  30158. if (/^[\\+*\/=><,@%~|&\-]/.test(input.charAt(pos.offset))) {
  30159. result1 = input.charAt(pos.offset);
  30160. advance(pos, 1);
  30161. } else {
  30162. result1 = null;
  30163. if (reportFailures === 0) {
  30164. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  30165. }
  30166. }
  30167. if (result1 !== null) {
  30168. result0 = [];
  30169. while (result1 !== null) {
  30170. result0.push(result1);
  30171. if (/^[\\+*\/=><,@%~|&\-]/.test(input.charAt(pos.offset))) {
  30172. result1 = input.charAt(pos.offset);
  30173. advance(pos, 1);
  30174. } else {
  30175. result1 = null;
  30176. if (reportFailures === 0) {
  30177. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  30178. }
  30179. }
  30180. }
  30181. } else {
  30182. result0 = null;
  30183. }
  30184. if (result0 !== null) {
  30185. result0 = (function(offset, line, column, bin) {return bin.join("");})(pos0.offset, pos0.line, pos0.column, result0);
  30186. }
  30187. if (result0 === null) {
  30188. pos = clone(pos0);
  30189. }
  30190. cache[cacheKey] = {
  30191. nextPos: clone(pos),
  30192. result: result0
  30193. };
  30194. return result0;
  30195. }
  30196. function parse_keywordPattern() {
  30197. var cacheKey = "keywordPattern@" + pos.offset;
  30198. var cachedResult = cache[cacheKey];
  30199. if (cachedResult) {
  30200. pos = clone(cachedResult.nextPos);
  30201. return cachedResult.result;
  30202. }
  30203. var result0, result1, result2, result3, result4;
  30204. var pos0, pos1, pos2;
  30205. pos0 = clone(pos);
  30206. pos1 = clone(pos);
  30207. pos2 = clone(pos);
  30208. result1 = parse_ws();
  30209. if (result1 !== null) {
  30210. result2 = parse_keyword();
  30211. if (result2 !== null) {
  30212. result3 = parse_ws();
  30213. if (result3 !== null) {
  30214. result4 = parse_identifier();
  30215. if (result4 !== null) {
  30216. result1 = [result1, result2, result3, result4];
  30217. } else {
  30218. result1 = null;
  30219. pos = clone(pos2);
  30220. }
  30221. } else {
  30222. result1 = null;
  30223. pos = clone(pos2);
  30224. }
  30225. } else {
  30226. result1 = null;
  30227. pos = clone(pos2);
  30228. }
  30229. } else {
  30230. result1 = null;
  30231. pos = clone(pos2);
  30232. }
  30233. if (result1 !== null) {
  30234. result1 = (function(offset, line, column, key, arg) {return {key:key, arg: arg};})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]);
  30235. }
  30236. if (result1 === null) {
  30237. pos = clone(pos1);
  30238. }
  30239. if (result1 !== null) {
  30240. result0 = [];
  30241. while (result1 !== null) {
  30242. result0.push(result1);
  30243. pos1 = clone(pos);
  30244. pos2 = clone(pos);
  30245. result1 = parse_ws();
  30246. if (result1 !== null) {
  30247. result2 = parse_keyword();
  30248. if (result2 !== null) {
  30249. result3 = parse_ws();
  30250. if (result3 !== null) {
  30251. result4 = parse_identifier();
  30252. if (result4 !== null) {
  30253. result1 = [result1, result2, result3, result4];
  30254. } else {
  30255. result1 = null;
  30256. pos = clone(pos2);
  30257. }
  30258. } else {
  30259. result1 = null;
  30260. pos = clone(pos2);
  30261. }
  30262. } else {
  30263. result1 = null;
  30264. pos = clone(pos2);
  30265. }
  30266. } else {
  30267. result1 = null;
  30268. pos = clone(pos2);
  30269. }
  30270. if (result1 !== null) {
  30271. result1 = (function(offset, line, column, key, arg) {return {key:key, arg: arg};})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]);
  30272. }
  30273. if (result1 === null) {
  30274. pos = clone(pos1);
  30275. }
  30276. }
  30277. } else {
  30278. result0 = null;
  30279. }
  30280. if (result0 !== null) {
  30281. result0 = (function(offset, line, column, pairs) {
  30282. var keywords = [];
  30283. var params = [];
  30284. var i = 0;
  30285. for(i = 0; i < pairs.length; i++){
  30286. keywords.push(pairs[i].key);
  30287. }
  30288. for(i = 0; i < pairs.length; i++){
  30289. params.push(pairs[i].arg);
  30290. }
  30291. return [keywords.join(""), params];
  30292. })(pos0.offset, pos0.line, pos0.column, result0);
  30293. }
  30294. if (result0 === null) {
  30295. pos = clone(pos0);
  30296. }
  30297. cache[cacheKey] = {
  30298. nextPos: clone(pos),
  30299. result: result0
  30300. };
  30301. return result0;
  30302. }
  30303. function parse_binaryPattern() {
  30304. var cacheKey = "binaryPattern@" + pos.offset;
  30305. var cachedResult = cache[cacheKey];
  30306. if (cachedResult) {
  30307. pos = clone(cachedResult.nextPos);
  30308. return cachedResult.result;
  30309. }
  30310. var result0, result1, result2, result3;
  30311. var pos0, pos1;
  30312. pos0 = clone(pos);
  30313. pos1 = clone(pos);
  30314. result0 = parse_ws();
  30315. if (result0 !== null) {
  30316. result1 = parse_binarySelector();
  30317. if (result1 !== null) {
  30318. result2 = parse_ws();
  30319. if (result2 !== null) {
  30320. result3 = parse_identifier();
  30321. if (result3 !== null) {
  30322. result0 = [result0, result1, result2, result3];
  30323. } else {
  30324. result0 = null;
  30325. pos = clone(pos1);
  30326. }
  30327. } else {
  30328. result0 = null;
  30329. pos = clone(pos1);
  30330. }
  30331. } else {
  30332. result0 = null;
  30333. pos = clone(pos1);
  30334. }
  30335. } else {
  30336. result0 = null;
  30337. pos = clone(pos1);
  30338. }
  30339. if (result0 !== null) {
  30340. result0 = (function(offset, line, column, selector, arg) {return [selector, [arg]];})(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  30341. }
  30342. if (result0 === null) {
  30343. pos = clone(pos0);
  30344. }
  30345. cache[cacheKey] = {
  30346. nextPos: clone(pos),
  30347. result: result0
  30348. };
  30349. return result0;
  30350. }
  30351. function parse_unaryPattern() {
  30352. var cacheKey = "unaryPattern@" + pos.offset;
  30353. var cachedResult = cache[cacheKey];
  30354. if (cachedResult) {
  30355. pos = clone(cachedResult.nextPos);
  30356. return cachedResult.result;
  30357. }
  30358. var result0, result1;
  30359. var pos0, pos1;
  30360. pos0 = clone(pos);
  30361. pos1 = clone(pos);
  30362. result0 = parse_ws();
  30363. if (result0 !== null) {
  30364. result1 = parse_identifier();
  30365. if (result1 !== null) {
  30366. result0 = [result0, result1];
  30367. } else {
  30368. result0 = null;
  30369. pos = clone(pos1);
  30370. }
  30371. } else {
  30372. result0 = null;
  30373. pos = clone(pos1);
  30374. }
  30375. if (result0 !== null) {
  30376. result0 = (function(offset, line, column, selector) {return [selector, []];})(pos0.offset, pos0.line, pos0.column, result0[1]);
  30377. }
  30378. if (result0 === null) {
  30379. pos = clone(pos0);
  30380. }
  30381. cache[cacheKey] = {
  30382. nextPos: clone(pos),
  30383. result: result0
  30384. };
  30385. return result0;
  30386. }
  30387. function parse_expression() {
  30388. var cacheKey = "expression@" + pos.offset;
  30389. var cachedResult = cache[cacheKey];
  30390. if (cachedResult) {
  30391. pos = clone(cachedResult.nextPos);
  30392. return cachedResult.result;
  30393. }
  30394. var result0;
  30395. result0 = parse_assignment();
  30396. if (result0 === null) {
  30397. result0 = parse_cascade();
  30398. if (result0 === null) {
  30399. result0 = parse_keywordSend();
  30400. if (result0 === null) {
  30401. result0 = parse_binarySend();
  30402. }
  30403. }
  30404. }
  30405. cache[cacheKey] = {
  30406. nextPos: clone(pos),
  30407. result: result0
  30408. };
  30409. return result0;
  30410. }
  30411. function parse_expressionList() {
  30412. var cacheKey = "expressionList@" + pos.offset;
  30413. var cachedResult = cache[cacheKey];
  30414. if (cachedResult) {
  30415. pos = clone(cachedResult.nextPos);
  30416. return cachedResult.result;
  30417. }
  30418. var result0, result1, result2, result3;
  30419. var pos0, pos1;
  30420. pos0 = clone(pos);
  30421. pos1 = clone(pos);
  30422. result0 = parse_ws();
  30423. if (result0 !== null) {
  30424. if (input.charCodeAt(pos.offset) === 46) {
  30425. result1 = ".";
  30426. advance(pos, 1);
  30427. } else {
  30428. result1 = null;
  30429. if (reportFailures === 0) {
  30430. matchFailed("\".\"");
  30431. }
  30432. }
  30433. if (result1 !== null) {
  30434. result2 = parse_ws();
  30435. if (result2 !== null) {
  30436. result3 = parse_expression();
  30437. if (result3 !== null) {
  30438. result0 = [result0, result1, result2, result3];
  30439. } else {
  30440. result0 = null;
  30441. pos = clone(pos1);
  30442. }
  30443. } else {
  30444. result0 = null;
  30445. pos = clone(pos1);
  30446. }
  30447. } else {
  30448. result0 = null;
  30449. pos = clone(pos1);
  30450. }
  30451. } else {
  30452. result0 = null;
  30453. pos = clone(pos1);
  30454. }
  30455. if (result0 !== null) {
  30456. result0 = (function(offset, line, column, expression) {return expression;})(pos0.offset, pos0.line, pos0.column, result0[3]);
  30457. }
  30458. if (result0 === null) {
  30459. pos = clone(pos0);
  30460. }
  30461. cache[cacheKey] = {
  30462. nextPos: clone(pos),
  30463. result: result0
  30464. };
  30465. return result0;
  30466. }
  30467. function parse_expressions() {
  30468. var cacheKey = "expressions@" + pos.offset;
  30469. var cachedResult = cache[cacheKey];
  30470. if (cachedResult) {
  30471. pos = clone(cachedResult.nextPos);
  30472. return cachedResult.result;
  30473. }
  30474. var result0, result1, result2;
  30475. var pos0, pos1;
  30476. pos0 = clone(pos);
  30477. pos1 = clone(pos);
  30478. result0 = parse_expression();
  30479. if (result0 !== null) {
  30480. result1 = [];
  30481. result2 = parse_expressionList();
  30482. while (result2 !== null) {
  30483. result1.push(result2);
  30484. result2 = parse_expressionList();
  30485. }
  30486. if (result1 !== null) {
  30487. result0 = [result0, result1];
  30488. } else {
  30489. result0 = null;
  30490. pos = clone(pos1);
  30491. }
  30492. } else {
  30493. result0 = null;
  30494. pos = clone(pos1);
  30495. }
  30496. if (result0 !== null) {
  30497. result0 = (function(offset, line, column, first, others) {
  30498. var result = [first];
  30499. for(var i = 0; i < others.length; i++) {
  30500. result.push(others[i]);
  30501. }
  30502. return result;
  30503. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  30504. }
  30505. if (result0 === null) {
  30506. pos = clone(pos0);
  30507. }
  30508. cache[cacheKey] = {
  30509. nextPos: clone(pos),
  30510. result: result0
  30511. };
  30512. return result0;
  30513. }
  30514. function parse_assignment() {
  30515. var cacheKey = "assignment@" + pos.offset;
  30516. var cachedResult = cache[cacheKey];
  30517. if (cachedResult) {
  30518. pos = clone(cachedResult.nextPos);
  30519. return cachedResult.result;
  30520. }
  30521. var result0, result1, result2, result3, result4;
  30522. var pos0, pos1;
  30523. pos0 = clone(pos);
  30524. pos1 = clone(pos);
  30525. result0 = parse_variable();
  30526. if (result0 !== null) {
  30527. result1 = parse_ws();
  30528. if (result1 !== null) {
  30529. if (input.substr(pos.offset, 2) === ":=") {
  30530. result2 = ":=";
  30531. advance(pos, 2);
  30532. } else {
  30533. result2 = null;
  30534. if (reportFailures === 0) {
  30535. matchFailed("\":=\"");
  30536. }
  30537. }
  30538. if (result2 !== null) {
  30539. result3 = parse_ws();
  30540. if (result3 !== null) {
  30541. result4 = parse_expression();
  30542. if (result4 !== null) {
  30543. result0 = [result0, result1, result2, result3, result4];
  30544. } else {
  30545. result0 = null;
  30546. pos = clone(pos1);
  30547. }
  30548. } else {
  30549. result0 = null;
  30550. pos = clone(pos1);
  30551. }
  30552. } else {
  30553. result0 = null;
  30554. pos = clone(pos1);
  30555. }
  30556. } else {
  30557. result0 = null;
  30558. pos = clone(pos1);
  30559. }
  30560. } else {
  30561. result0 = null;
  30562. pos = clone(pos1);
  30563. }
  30564. if (result0 !== null) {
  30565. result0 = (function(offset, line, column, variable, expression) {
  30566. return smalltalk.AssignmentNode._new()
  30567. ._position_((line).__at(column))
  30568. ._left_(variable)
  30569. ._right_(expression);
  30570. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[4]);
  30571. }
  30572. if (result0 === null) {
  30573. pos = clone(pos0);
  30574. }
  30575. cache[cacheKey] = {
  30576. nextPos: clone(pos),
  30577. result: result0
  30578. };
  30579. return result0;
  30580. }
  30581. function parse_ret() {
  30582. var cacheKey = "ret@" + pos.offset;
  30583. var cachedResult = cache[cacheKey];
  30584. if (cachedResult) {
  30585. pos = clone(cachedResult.nextPos);
  30586. return cachedResult.result;
  30587. }
  30588. var result0, result1, result2, result3, result4;
  30589. var pos0, pos1;
  30590. pos0 = clone(pos);
  30591. pos1 = clone(pos);
  30592. if (input.charCodeAt(pos.offset) === 94) {
  30593. result0 = "^";
  30594. advance(pos, 1);
  30595. } else {
  30596. result0 = null;
  30597. if (reportFailures === 0) {
  30598. matchFailed("\"^\"");
  30599. }
  30600. }
  30601. if (result0 !== null) {
  30602. result1 = parse_ws();
  30603. if (result1 !== null) {
  30604. result2 = parse_expression();
  30605. if (result2 !== null) {
  30606. result3 = parse_ws();
  30607. if (result3 !== null) {
  30608. if (input.charCodeAt(pos.offset) === 46) {
  30609. result4 = ".";
  30610. advance(pos, 1);
  30611. } else {
  30612. result4 = null;
  30613. if (reportFailures === 0) {
  30614. matchFailed("\".\"");
  30615. }
  30616. }
  30617. result4 = result4 !== null ? result4 : "";
  30618. if (result4 !== null) {
  30619. result0 = [result0, result1, result2, result3, result4];
  30620. } else {
  30621. result0 = null;
  30622. pos = clone(pos1);
  30623. }
  30624. } else {
  30625. result0 = null;
  30626. pos = clone(pos1);
  30627. }
  30628. } else {
  30629. result0 = null;
  30630. pos = clone(pos1);
  30631. }
  30632. } else {
  30633. result0 = null;
  30634. pos = clone(pos1);
  30635. }
  30636. } else {
  30637. result0 = null;
  30638. pos = clone(pos1);
  30639. }
  30640. if (result0 !== null) {
  30641. result0 = (function(offset, line, column, expression) {
  30642. return smalltalk.ReturnNode._new()
  30643. ._position_((line).__at(column))
  30644. ._nodes_([expression]);
  30645. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  30646. }
  30647. if (result0 === null) {
  30648. pos = clone(pos0);
  30649. }
  30650. cache[cacheKey] = {
  30651. nextPos: clone(pos),
  30652. result: result0
  30653. };
  30654. return result0;
  30655. }
  30656. function parse_temps() {
  30657. var cacheKey = "temps@" + pos.offset;
  30658. var cachedResult = cache[cacheKey];
  30659. if (cachedResult) {
  30660. pos = clone(cachedResult.nextPos);
  30661. return cachedResult.result;
  30662. }
  30663. var result0, result1, result2, result3, result4;
  30664. var pos0, pos1, pos2, pos3;
  30665. pos0 = clone(pos);
  30666. pos1 = clone(pos);
  30667. if (input.charCodeAt(pos.offset) === 124) {
  30668. result0 = "|";
  30669. advance(pos, 1);
  30670. } else {
  30671. result0 = null;
  30672. if (reportFailures === 0) {
  30673. matchFailed("\"|\"");
  30674. }
  30675. }
  30676. if (result0 !== null) {
  30677. result1 = [];
  30678. pos2 = clone(pos);
  30679. pos3 = clone(pos);
  30680. result2 = parse_ws();
  30681. if (result2 !== null) {
  30682. result3 = parse_identifier();
  30683. if (result3 !== null) {
  30684. result4 = parse_ws();
  30685. if (result4 !== null) {
  30686. result2 = [result2, result3, result4];
  30687. } else {
  30688. result2 = null;
  30689. pos = clone(pos3);
  30690. }
  30691. } else {
  30692. result2 = null;
  30693. pos = clone(pos3);
  30694. }
  30695. } else {
  30696. result2 = null;
  30697. pos = clone(pos3);
  30698. }
  30699. if (result2 !== null) {
  30700. result2 = (function(offset, line, column, variable) {return variable;})(pos2.offset, pos2.line, pos2.column, result2[1]);
  30701. }
  30702. if (result2 === null) {
  30703. pos = clone(pos2);
  30704. }
  30705. while (result2 !== null) {
  30706. result1.push(result2);
  30707. pos2 = clone(pos);
  30708. pos3 = clone(pos);
  30709. result2 = parse_ws();
  30710. if (result2 !== null) {
  30711. result3 = parse_identifier();
  30712. if (result3 !== null) {
  30713. result4 = parse_ws();
  30714. if (result4 !== null) {
  30715. result2 = [result2, result3, result4];
  30716. } else {
  30717. result2 = null;
  30718. pos = clone(pos3);
  30719. }
  30720. } else {
  30721. result2 = null;
  30722. pos = clone(pos3);
  30723. }
  30724. } else {
  30725. result2 = null;
  30726. pos = clone(pos3);
  30727. }
  30728. if (result2 !== null) {
  30729. result2 = (function(offset, line, column, variable) {return variable;})(pos2.offset, pos2.line, pos2.column, result2[1]);
  30730. }
  30731. if (result2 === null) {
  30732. pos = clone(pos2);
  30733. }
  30734. }
  30735. if (result1 !== null) {
  30736. if (input.charCodeAt(pos.offset) === 124) {
  30737. result2 = "|";
  30738. advance(pos, 1);
  30739. } else {
  30740. result2 = null;
  30741. if (reportFailures === 0) {
  30742. matchFailed("\"|\"");
  30743. }
  30744. }
  30745. if (result2 !== null) {
  30746. result0 = [result0, result1, result2];
  30747. } else {
  30748. result0 = null;
  30749. pos = clone(pos1);
  30750. }
  30751. } else {
  30752. result0 = null;
  30753. pos = clone(pos1);
  30754. }
  30755. } else {
  30756. result0 = null;
  30757. pos = clone(pos1);
  30758. }
  30759. if (result0 !== null) {
  30760. result0 = (function(offset, line, column, vars) {return vars;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  30761. }
  30762. if (result0 === null) {
  30763. pos = clone(pos0);
  30764. }
  30765. cache[cacheKey] = {
  30766. nextPos: clone(pos),
  30767. result: result0
  30768. };
  30769. return result0;
  30770. }
  30771. function parse_blockParamList() {
  30772. var cacheKey = "blockParamList@" + pos.offset;
  30773. var cachedResult = cache[cacheKey];
  30774. if (cachedResult) {
  30775. pos = clone(cachedResult.nextPos);
  30776. return cachedResult.result;
  30777. }
  30778. var result0, result1, result2, result3, result4;
  30779. var pos0, pos1, pos2, pos3;
  30780. pos0 = clone(pos);
  30781. pos1 = clone(pos);
  30782. pos2 = clone(pos);
  30783. pos3 = clone(pos);
  30784. result1 = parse_ws();
  30785. if (result1 !== null) {
  30786. if (input.charCodeAt(pos.offset) === 58) {
  30787. result2 = ":";
  30788. advance(pos, 1);
  30789. } else {
  30790. result2 = null;
  30791. if (reportFailures === 0) {
  30792. matchFailed("\":\"");
  30793. }
  30794. }
  30795. if (result2 !== null) {
  30796. result3 = parse_ws();
  30797. if (result3 !== null) {
  30798. result4 = parse_identifier();
  30799. if (result4 !== null) {
  30800. result1 = [result1, result2, result3, result4];
  30801. } else {
  30802. result1 = null;
  30803. pos = clone(pos3);
  30804. }
  30805. } else {
  30806. result1 = null;
  30807. pos = clone(pos3);
  30808. }
  30809. } else {
  30810. result1 = null;
  30811. pos = clone(pos3);
  30812. }
  30813. } else {
  30814. result1 = null;
  30815. pos = clone(pos3);
  30816. }
  30817. if (result1 !== null) {
  30818. result1 = (function(offset, line, column, param) {return param;})(pos2.offset, pos2.line, pos2.column, result1[3]);
  30819. }
  30820. if (result1 === null) {
  30821. pos = clone(pos2);
  30822. }
  30823. if (result1 !== null) {
  30824. result0 = [];
  30825. while (result1 !== null) {
  30826. result0.push(result1);
  30827. pos2 = clone(pos);
  30828. pos3 = clone(pos);
  30829. result1 = parse_ws();
  30830. if (result1 !== null) {
  30831. if (input.charCodeAt(pos.offset) === 58) {
  30832. result2 = ":";
  30833. advance(pos, 1);
  30834. } else {
  30835. result2 = null;
  30836. if (reportFailures === 0) {
  30837. matchFailed("\":\"");
  30838. }
  30839. }
  30840. if (result2 !== null) {
  30841. result3 = parse_ws();
  30842. if (result3 !== null) {
  30843. result4 = parse_identifier();
  30844. if (result4 !== null) {
  30845. result1 = [result1, result2, result3, result4];
  30846. } else {
  30847. result1 = null;
  30848. pos = clone(pos3);
  30849. }
  30850. } else {
  30851. result1 = null;
  30852. pos = clone(pos3);
  30853. }
  30854. } else {
  30855. result1 = null;
  30856. pos = clone(pos3);
  30857. }
  30858. } else {
  30859. result1 = null;
  30860. pos = clone(pos3);
  30861. }
  30862. if (result1 !== null) {
  30863. result1 = (function(offset, line, column, param) {return param;})(pos2.offset, pos2.line, pos2.column, result1[3]);
  30864. }
  30865. if (result1 === null) {
  30866. pos = clone(pos2);
  30867. }
  30868. }
  30869. } else {
  30870. result0 = null;
  30871. }
  30872. if (result0 !== null) {
  30873. result1 = parse_ws();
  30874. if (result1 !== null) {
  30875. if (input.charCodeAt(pos.offset) === 124) {
  30876. result2 = "|";
  30877. advance(pos, 1);
  30878. } else {
  30879. result2 = null;
  30880. if (reportFailures === 0) {
  30881. matchFailed("\"|\"");
  30882. }
  30883. }
  30884. if (result2 !== null) {
  30885. result0 = [result0, result1, result2];
  30886. } else {
  30887. result0 = null;
  30888. pos = clone(pos1);
  30889. }
  30890. } else {
  30891. result0 = null;
  30892. pos = clone(pos1);
  30893. }
  30894. } else {
  30895. result0 = null;
  30896. pos = clone(pos1);
  30897. }
  30898. if (result0 !== null) {
  30899. result0 = (function(offset, line, column, params) {return params;})(pos0.offset, pos0.line, pos0.column, result0[0]);
  30900. }
  30901. if (result0 === null) {
  30902. pos = clone(pos0);
  30903. }
  30904. cache[cacheKey] = {
  30905. nextPos: clone(pos),
  30906. result: result0
  30907. };
  30908. return result0;
  30909. }
  30910. function parse_subexpression() {
  30911. var cacheKey = "subexpression@" + pos.offset;
  30912. var cachedResult = cache[cacheKey];
  30913. if (cachedResult) {
  30914. pos = clone(cachedResult.nextPos);
  30915. return cachedResult.result;
  30916. }
  30917. var result0, result1, result2, result3, result4;
  30918. var pos0, pos1;
  30919. pos0 = clone(pos);
  30920. pos1 = clone(pos);
  30921. if (input.charCodeAt(pos.offset) === 40) {
  30922. result0 = "(";
  30923. advance(pos, 1);
  30924. } else {
  30925. result0 = null;
  30926. if (reportFailures === 0) {
  30927. matchFailed("\"(\"");
  30928. }
  30929. }
  30930. if (result0 !== null) {
  30931. result1 = parse_ws();
  30932. if (result1 !== null) {
  30933. result2 = parse_expression();
  30934. if (result2 !== null) {
  30935. result3 = parse_ws();
  30936. if (result3 !== null) {
  30937. if (input.charCodeAt(pos.offset) === 41) {
  30938. result4 = ")";
  30939. advance(pos, 1);
  30940. } else {
  30941. result4 = null;
  30942. if (reportFailures === 0) {
  30943. matchFailed("\")\"");
  30944. }
  30945. }
  30946. if (result4 !== null) {
  30947. result0 = [result0, result1, result2, result3, result4];
  30948. } else {
  30949. result0 = null;
  30950. pos = clone(pos1);
  30951. }
  30952. } else {
  30953. result0 = null;
  30954. pos = clone(pos1);
  30955. }
  30956. } else {
  30957. result0 = null;
  30958. pos = clone(pos1);
  30959. }
  30960. } else {
  30961. result0 = null;
  30962. pos = clone(pos1);
  30963. }
  30964. } else {
  30965. result0 = null;
  30966. pos = clone(pos1);
  30967. }
  30968. if (result0 !== null) {
  30969. result0 = (function(offset, line, column, expression) {return expression;})(pos0.offset, pos0.line, pos0.column, result0[2]);
  30970. }
  30971. if (result0 === null) {
  30972. pos = clone(pos0);
  30973. }
  30974. cache[cacheKey] = {
  30975. nextPos: clone(pos),
  30976. result: result0
  30977. };
  30978. return result0;
  30979. }
  30980. function parse_statements() {
  30981. var cacheKey = "statements@" + pos.offset;
  30982. var cachedResult = cache[cacheKey];
  30983. if (cachedResult) {
  30984. pos = clone(cachedResult.nextPos);
  30985. return cachedResult.result;
  30986. }
  30987. var result0, result1, result2, result3, result4, result5, result6;
  30988. var pos0, pos1;
  30989. pos0 = clone(pos);
  30990. pos1 = clone(pos);
  30991. result0 = parse_ret();
  30992. if (result0 !== null) {
  30993. result1 = [];
  30994. if (/^[.]/.test(input.charAt(pos.offset))) {
  30995. result2 = input.charAt(pos.offset);
  30996. advance(pos, 1);
  30997. } else {
  30998. result2 = null;
  30999. if (reportFailures === 0) {
  31000. matchFailed("[.]");
  31001. }
  31002. }
  31003. while (result2 !== null) {
  31004. result1.push(result2);
  31005. if (/^[.]/.test(input.charAt(pos.offset))) {
  31006. result2 = input.charAt(pos.offset);
  31007. advance(pos, 1);
  31008. } else {
  31009. result2 = null;
  31010. if (reportFailures === 0) {
  31011. matchFailed("[.]");
  31012. }
  31013. }
  31014. }
  31015. if (result1 !== null) {
  31016. result0 = [result0, result1];
  31017. } else {
  31018. result0 = null;
  31019. pos = clone(pos1);
  31020. }
  31021. } else {
  31022. result0 = null;
  31023. pos = clone(pos1);
  31024. }
  31025. if (result0 !== null) {
  31026. result0 = (function(offset, line, column, ret) {return [ret];})(pos0.offset, pos0.line, pos0.column, result0[0]);
  31027. }
  31028. if (result0 === null) {
  31029. pos = clone(pos0);
  31030. }
  31031. if (result0 === null) {
  31032. pos0 = clone(pos);
  31033. pos1 = clone(pos);
  31034. result0 = parse_expressions();
  31035. if (result0 !== null) {
  31036. result1 = parse_ws();
  31037. if (result1 !== null) {
  31038. if (/^[.]/.test(input.charAt(pos.offset))) {
  31039. result3 = input.charAt(pos.offset);
  31040. advance(pos, 1);
  31041. } else {
  31042. result3 = null;
  31043. if (reportFailures === 0) {
  31044. matchFailed("[.]");
  31045. }
  31046. }
  31047. if (result3 !== null) {
  31048. result2 = [];
  31049. while (result3 !== null) {
  31050. result2.push(result3);
  31051. if (/^[.]/.test(input.charAt(pos.offset))) {
  31052. result3 = input.charAt(pos.offset);
  31053. advance(pos, 1);
  31054. } else {
  31055. result3 = null;
  31056. if (reportFailures === 0) {
  31057. matchFailed("[.]");
  31058. }
  31059. }
  31060. }
  31061. } else {
  31062. result2 = null;
  31063. }
  31064. if (result2 !== null) {
  31065. result3 = parse_ws();
  31066. if (result3 !== null) {
  31067. result4 = parse_ret();
  31068. if (result4 !== null) {
  31069. result5 = [];
  31070. if (/^[.]/.test(input.charAt(pos.offset))) {
  31071. result6 = input.charAt(pos.offset);
  31072. advance(pos, 1);
  31073. } else {
  31074. result6 = null;
  31075. if (reportFailures === 0) {
  31076. matchFailed("[.]");
  31077. }
  31078. }
  31079. while (result6 !== null) {
  31080. result5.push(result6);
  31081. if (/^[.]/.test(input.charAt(pos.offset))) {
  31082. result6 = input.charAt(pos.offset);
  31083. advance(pos, 1);
  31084. } else {
  31085. result6 = null;
  31086. if (reportFailures === 0) {
  31087. matchFailed("[.]");
  31088. }
  31089. }
  31090. }
  31091. if (result5 !== null) {
  31092. result0 = [result0, result1, result2, result3, result4, result5];
  31093. } else {
  31094. result0 = null;
  31095. pos = clone(pos1);
  31096. }
  31097. } else {
  31098. result0 = null;
  31099. pos = clone(pos1);
  31100. }
  31101. } else {
  31102. result0 = null;
  31103. pos = clone(pos1);
  31104. }
  31105. } else {
  31106. result0 = null;
  31107. pos = clone(pos1);
  31108. }
  31109. } else {
  31110. result0 = null;
  31111. pos = clone(pos1);
  31112. }
  31113. } else {
  31114. result0 = null;
  31115. pos = clone(pos1);
  31116. }
  31117. if (result0 !== null) {
  31118. result0 = (function(offset, line, column, exps, ret) {
  31119. var expressions = exps;
  31120. expressions.push(ret);
  31121. return expressions;
  31122. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[4]);
  31123. }
  31124. if (result0 === null) {
  31125. pos = clone(pos0);
  31126. }
  31127. if (result0 === null) {
  31128. pos0 = clone(pos);
  31129. pos1 = clone(pos);
  31130. result0 = parse_expressions();
  31131. result0 = result0 !== null ? result0 : "";
  31132. if (result0 !== null) {
  31133. result1 = [];
  31134. if (/^[.]/.test(input.charAt(pos.offset))) {
  31135. result2 = input.charAt(pos.offset);
  31136. advance(pos, 1);
  31137. } else {
  31138. result2 = null;
  31139. if (reportFailures === 0) {
  31140. matchFailed("[.]");
  31141. }
  31142. }
  31143. while (result2 !== null) {
  31144. result1.push(result2);
  31145. if (/^[.]/.test(input.charAt(pos.offset))) {
  31146. result2 = input.charAt(pos.offset);
  31147. advance(pos, 1);
  31148. } else {
  31149. result2 = null;
  31150. if (reportFailures === 0) {
  31151. matchFailed("[.]");
  31152. }
  31153. }
  31154. }
  31155. if (result1 !== null) {
  31156. result0 = [result0, result1];
  31157. } else {
  31158. result0 = null;
  31159. pos = clone(pos1);
  31160. }
  31161. } else {
  31162. result0 = null;
  31163. pos = clone(pos1);
  31164. }
  31165. if (result0 !== null) {
  31166. result0 = (function(offset, line, column, expressions) {
  31167. return expressions || [];
  31168. })(pos0.offset, pos0.line, pos0.column, result0[0]);
  31169. }
  31170. if (result0 === null) {
  31171. pos = clone(pos0);
  31172. }
  31173. }
  31174. }
  31175. cache[cacheKey] = {
  31176. nextPos: clone(pos),
  31177. result: result0
  31178. };
  31179. return result0;
  31180. }
  31181. function parse_sequence() {
  31182. var cacheKey = "sequence@" + pos.offset;
  31183. var cachedResult = cache[cacheKey];
  31184. if (cachedResult) {
  31185. pos = clone(cachedResult.nextPos);
  31186. return cachedResult.result;
  31187. }
  31188. var result0;
  31189. result0 = parse_jsStatement();
  31190. if (result0 === null) {
  31191. result0 = parse_stSequence();
  31192. }
  31193. cache[cacheKey] = {
  31194. nextPos: clone(pos),
  31195. result: result0
  31196. };
  31197. return result0;
  31198. }
  31199. function parse_stSequence() {
  31200. var cacheKey = "stSequence@" + pos.offset;
  31201. var cachedResult = cache[cacheKey];
  31202. if (cachedResult) {
  31203. pos = clone(cachedResult.nextPos);
  31204. return cachedResult.result;
  31205. }
  31206. var result0, result1, result2, result3;
  31207. var pos0, pos1;
  31208. pos0 = clone(pos);
  31209. pos1 = clone(pos);
  31210. result0 = parse_temps();
  31211. result0 = result0 !== null ? result0 : "";
  31212. if (result0 !== null) {
  31213. result1 = parse_ws();
  31214. if (result1 !== null) {
  31215. result2 = parse_statements();
  31216. result2 = result2 !== null ? result2 : "";
  31217. if (result2 !== null) {
  31218. result3 = parse_ws();
  31219. if (result3 !== null) {
  31220. result0 = [result0, result1, result2, result3];
  31221. } else {
  31222. result0 = null;
  31223. pos = clone(pos1);
  31224. }
  31225. } else {
  31226. result0 = null;
  31227. pos = clone(pos1);
  31228. }
  31229. } else {
  31230. result0 = null;
  31231. pos = clone(pos1);
  31232. }
  31233. } else {
  31234. result0 = null;
  31235. pos = clone(pos1);
  31236. }
  31237. if (result0 !== null) {
  31238. result0 = (function(offset, line, column, temps, statements) {
  31239. return smalltalk.SequenceNode._new()
  31240. ._position_((line).__at(column))
  31241. ._temps_(temps || [])
  31242. ._nodes_(statements || []);
  31243. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  31244. }
  31245. if (result0 === null) {
  31246. pos = clone(pos0);
  31247. }
  31248. cache[cacheKey] = {
  31249. nextPos: clone(pos),
  31250. result: result0
  31251. };
  31252. return result0;
  31253. }
  31254. function parse_block() {
  31255. var cacheKey = "block@" + pos.offset;
  31256. var cachedResult = cache[cacheKey];
  31257. if (cachedResult) {
  31258. pos = clone(cachedResult.nextPos);
  31259. return cachedResult.result;
  31260. }
  31261. var result0, result1, result2, result3, result4, result5, result6;
  31262. var pos0, pos1;
  31263. pos0 = clone(pos);
  31264. pos1 = clone(pos);
  31265. if (input.charCodeAt(pos.offset) === 91) {
  31266. result0 = "[";
  31267. advance(pos, 1);
  31268. } else {
  31269. result0 = null;
  31270. if (reportFailures === 0) {
  31271. matchFailed("\"[\"");
  31272. }
  31273. }
  31274. if (result0 !== null) {
  31275. result1 = parse_ws();
  31276. if (result1 !== null) {
  31277. result2 = parse_blockParamList();
  31278. result2 = result2 !== null ? result2 : "";
  31279. if (result2 !== null) {
  31280. result3 = parse_ws();
  31281. if (result3 !== null) {
  31282. result4 = parse_sequence();
  31283. result4 = result4 !== null ? result4 : "";
  31284. if (result4 !== null) {
  31285. result5 = parse_ws();
  31286. if (result5 !== null) {
  31287. if (input.charCodeAt(pos.offset) === 93) {
  31288. result6 = "]";
  31289. advance(pos, 1);
  31290. } else {
  31291. result6 = null;
  31292. if (reportFailures === 0) {
  31293. matchFailed("\"]\"");
  31294. }
  31295. }
  31296. if (result6 !== null) {
  31297. result0 = [result0, result1, result2, result3, result4, result5, result6];
  31298. } else {
  31299. result0 = null;
  31300. pos = clone(pos1);
  31301. }
  31302. } else {
  31303. result0 = null;
  31304. pos = clone(pos1);
  31305. }
  31306. } else {
  31307. result0 = null;
  31308. pos = clone(pos1);
  31309. }
  31310. } else {
  31311. result0 = null;
  31312. pos = clone(pos1);
  31313. }
  31314. } else {
  31315. result0 = null;
  31316. pos = clone(pos1);
  31317. }
  31318. } else {
  31319. result0 = null;
  31320. pos = clone(pos1);
  31321. }
  31322. } else {
  31323. result0 = null;
  31324. pos = clone(pos1);
  31325. }
  31326. if (result0 !== null) {
  31327. result0 = (function(offset, line, column, params, sequence) {
  31328. return smalltalk.BlockNode._new()
  31329. ._position_((line).__at(column))
  31330. ._parameters_(params || [])
  31331. ._nodes_([sequence._asBlockSequenceNode()]);
  31332. })(pos0.offset, pos0.line, pos0.column, result0[2], result0[4]);
  31333. }
  31334. if (result0 === null) {
  31335. pos = clone(pos0);
  31336. }
  31337. cache[cacheKey] = {
  31338. nextPos: clone(pos),
  31339. result: result0
  31340. };
  31341. return result0;
  31342. }
  31343. function parse_operand() {
  31344. var cacheKey = "operand@" + pos.offset;
  31345. var cachedResult = cache[cacheKey];
  31346. if (cachedResult) {
  31347. pos = clone(cachedResult.nextPos);
  31348. return cachedResult.result;
  31349. }
  31350. var result0;
  31351. result0 = parse_literal();
  31352. if (result0 === null) {
  31353. result0 = parse_reference();
  31354. if (result0 === null) {
  31355. result0 = parse_subexpression();
  31356. }
  31357. }
  31358. cache[cacheKey] = {
  31359. nextPos: clone(pos),
  31360. result: result0
  31361. };
  31362. return result0;
  31363. }
  31364. function parse_unaryMessage() {
  31365. var cacheKey = "unaryMessage@" + pos.offset;
  31366. var cachedResult = cache[cacheKey];
  31367. if (cachedResult) {
  31368. pos = clone(cachedResult.nextPos);
  31369. return cachedResult.result;
  31370. }
  31371. var result0, result1, result2;
  31372. var pos0, pos1, pos2;
  31373. pos0 = clone(pos);
  31374. pos1 = clone(pos);
  31375. result0 = parse_ws();
  31376. if (result0 !== null) {
  31377. result1 = parse_identifier();
  31378. if (result1 !== null) {
  31379. pos2 = clone(pos);
  31380. reportFailures++;
  31381. if (/^[:]/.test(input.charAt(pos.offset))) {
  31382. result2 = input.charAt(pos.offset);
  31383. advance(pos, 1);
  31384. } else {
  31385. result2 = null;
  31386. if (reportFailures === 0) {
  31387. matchFailed("[:]");
  31388. }
  31389. }
  31390. reportFailures--;
  31391. if (result2 === null) {
  31392. result2 = "";
  31393. } else {
  31394. result2 = null;
  31395. pos = clone(pos2);
  31396. }
  31397. if (result2 !== null) {
  31398. result0 = [result0, result1, result2];
  31399. } else {
  31400. result0 = null;
  31401. pos = clone(pos1);
  31402. }
  31403. } else {
  31404. result0 = null;
  31405. pos = clone(pos1);
  31406. }
  31407. } else {
  31408. result0 = null;
  31409. pos = clone(pos1);
  31410. }
  31411. if (result0 !== null) {
  31412. result0 = (function(offset, line, column, selector) {
  31413. return smalltalk.SendNode._new()
  31414. ._position_((line).__at(column))
  31415. ._selector_(selector);
  31416. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  31417. }
  31418. if (result0 === null) {
  31419. pos = clone(pos0);
  31420. }
  31421. cache[cacheKey] = {
  31422. nextPos: clone(pos),
  31423. result: result0
  31424. };
  31425. return result0;
  31426. }
  31427. function parse_unaryTail() {
  31428. var cacheKey = "unaryTail@" + pos.offset;
  31429. var cachedResult = cache[cacheKey];
  31430. if (cachedResult) {
  31431. pos = clone(cachedResult.nextPos);
  31432. return cachedResult.result;
  31433. }
  31434. var result0, result1, result2, result3;
  31435. var pos0, pos1;
  31436. pos0 = clone(pos);
  31437. pos1 = clone(pos);
  31438. result0 = parse_unaryMessage();
  31439. if (result0 !== null) {
  31440. result1 = parse_ws();
  31441. if (result1 !== null) {
  31442. result2 = parse_unaryTail();
  31443. result2 = result2 !== null ? result2 : "";
  31444. if (result2 !== null) {
  31445. result3 = parse_ws();
  31446. if (result3 !== null) {
  31447. result0 = [result0, result1, result2, result3];
  31448. } else {
  31449. result0 = null;
  31450. pos = clone(pos1);
  31451. }
  31452. } else {
  31453. result0 = null;
  31454. pos = clone(pos1);
  31455. }
  31456. } else {
  31457. result0 = null;
  31458. pos = clone(pos1);
  31459. }
  31460. } else {
  31461. result0 = null;
  31462. pos = clone(pos1);
  31463. }
  31464. if (result0 !== null) {
  31465. result0 = (function(offset, line, column, message, tail) {
  31466. if(tail) {
  31467. return tail._valueForReceiver_(message);
  31468. }
  31469. else {
  31470. return message;
  31471. }
  31472. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  31473. }
  31474. if (result0 === null) {
  31475. pos = clone(pos0);
  31476. }
  31477. cache[cacheKey] = {
  31478. nextPos: clone(pos),
  31479. result: result0
  31480. };
  31481. return result0;
  31482. }
  31483. function parse_unarySend() {
  31484. var cacheKey = "unarySend@" + pos.offset;
  31485. var cachedResult = cache[cacheKey];
  31486. if (cachedResult) {
  31487. pos = clone(cachedResult.nextPos);
  31488. return cachedResult.result;
  31489. }
  31490. var result0, result1, result2;
  31491. var pos0, pos1;
  31492. pos0 = clone(pos);
  31493. pos1 = clone(pos);
  31494. result0 = parse_operand();
  31495. if (result0 !== null) {
  31496. result1 = parse_ws();
  31497. if (result1 !== null) {
  31498. result2 = parse_unaryTail();
  31499. result2 = result2 !== null ? result2 : "";
  31500. if (result2 !== null) {
  31501. result0 = [result0, result1, result2];
  31502. } else {
  31503. result0 = null;
  31504. pos = clone(pos1);
  31505. }
  31506. } else {
  31507. result0 = null;
  31508. pos = clone(pos1);
  31509. }
  31510. } else {
  31511. result0 = null;
  31512. pos = clone(pos1);
  31513. }
  31514. if (result0 !== null) {
  31515. result0 = (function(offset, line, column, receiver, tail) {
  31516. if(tail) {
  31517. return tail._valueForReceiver_(receiver);
  31518. }
  31519. else {
  31520. return receiver;
  31521. }
  31522. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  31523. }
  31524. if (result0 === null) {
  31525. pos = clone(pos0);
  31526. }
  31527. cache[cacheKey] = {
  31528. nextPos: clone(pos),
  31529. result: result0
  31530. };
  31531. return result0;
  31532. }
  31533. function parse_binaryMessage() {
  31534. var cacheKey = "binaryMessage@" + pos.offset;
  31535. var cachedResult = cache[cacheKey];
  31536. if (cachedResult) {
  31537. pos = clone(cachedResult.nextPos);
  31538. return cachedResult.result;
  31539. }
  31540. var result0, result1, result2, result3;
  31541. var pos0, pos1;
  31542. pos0 = clone(pos);
  31543. pos1 = clone(pos);
  31544. result0 = parse_ws();
  31545. if (result0 !== null) {
  31546. result1 = parse_binarySelector();
  31547. if (result1 !== null) {
  31548. result2 = parse_ws();
  31549. if (result2 !== null) {
  31550. result3 = parse_unarySend();
  31551. if (result3 === null) {
  31552. result3 = parse_operand();
  31553. }
  31554. if (result3 !== null) {
  31555. result0 = [result0, result1, result2, result3];
  31556. } else {
  31557. result0 = null;
  31558. pos = clone(pos1);
  31559. }
  31560. } else {
  31561. result0 = null;
  31562. pos = clone(pos1);
  31563. }
  31564. } else {
  31565. result0 = null;
  31566. pos = clone(pos1);
  31567. }
  31568. } else {
  31569. result0 = null;
  31570. pos = clone(pos1);
  31571. }
  31572. if (result0 !== null) {
  31573. result0 = (function(offset, line, column, selector, arg) {
  31574. return smalltalk.SendNode._new()
  31575. ._position_((line).__at(column))
  31576. ._selector_(selector)
  31577. ._arguments_([arg]);
  31578. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  31579. }
  31580. if (result0 === null) {
  31581. pos = clone(pos0);
  31582. }
  31583. cache[cacheKey] = {
  31584. nextPos: clone(pos),
  31585. result: result0
  31586. };
  31587. return result0;
  31588. }
  31589. function parse_binaryTail() {
  31590. var cacheKey = "binaryTail@" + pos.offset;
  31591. var cachedResult = cache[cacheKey];
  31592. if (cachedResult) {
  31593. pos = clone(cachedResult.nextPos);
  31594. return cachedResult.result;
  31595. }
  31596. var result0, result1;
  31597. var pos0, pos1;
  31598. pos0 = clone(pos);
  31599. pos1 = clone(pos);
  31600. result0 = parse_binaryMessage();
  31601. if (result0 !== null) {
  31602. result1 = parse_binaryTail();
  31603. result1 = result1 !== null ? result1 : "";
  31604. if (result1 !== null) {
  31605. result0 = [result0, result1];
  31606. } else {
  31607. result0 = null;
  31608. pos = clone(pos1);
  31609. }
  31610. } else {
  31611. result0 = null;
  31612. pos = clone(pos1);
  31613. }
  31614. if (result0 !== null) {
  31615. result0 = (function(offset, line, column, message, tail) {
  31616. if(tail) {
  31617. return tail._valueForReceiver_(message);
  31618. }
  31619. else {
  31620. return message;
  31621. }
  31622. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  31623. }
  31624. if (result0 === null) {
  31625. pos = clone(pos0);
  31626. }
  31627. cache[cacheKey] = {
  31628. nextPos: clone(pos),
  31629. result: result0
  31630. };
  31631. return result0;
  31632. }
  31633. function parse_binarySend() {
  31634. var cacheKey = "binarySend@" + pos.offset;
  31635. var cachedResult = cache[cacheKey];
  31636. if (cachedResult) {
  31637. pos = clone(cachedResult.nextPos);
  31638. return cachedResult.result;
  31639. }
  31640. var result0, result1;
  31641. var pos0, pos1;
  31642. pos0 = clone(pos);
  31643. pos1 = clone(pos);
  31644. result0 = parse_unarySend();
  31645. if (result0 !== null) {
  31646. result1 = parse_binaryTail();
  31647. result1 = result1 !== null ? result1 : "";
  31648. if (result1 !== null) {
  31649. result0 = [result0, result1];
  31650. } else {
  31651. result0 = null;
  31652. pos = clone(pos1);
  31653. }
  31654. } else {
  31655. result0 = null;
  31656. pos = clone(pos1);
  31657. }
  31658. if (result0 !== null) {
  31659. result0 = (function(offset, line, column, receiver, tail) {
  31660. if(tail) {
  31661. return tail._valueForReceiver_(receiver);
  31662. }
  31663. else {
  31664. return receiver;
  31665. }
  31666. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  31667. }
  31668. if (result0 === null) {
  31669. pos = clone(pos0);
  31670. }
  31671. cache[cacheKey] = {
  31672. nextPos: clone(pos),
  31673. result: result0
  31674. };
  31675. return result0;
  31676. }
  31677. function parse_keywordMessage() {
  31678. var cacheKey = "keywordMessage@" + pos.offset;
  31679. var cachedResult = cache[cacheKey];
  31680. if (cachedResult) {
  31681. pos = clone(cachedResult.nextPos);
  31682. return cachedResult.result;
  31683. }
  31684. var result0, result1, result2, result3;
  31685. var pos0, pos1, pos2, pos3;
  31686. pos0 = clone(pos);
  31687. pos1 = clone(pos);
  31688. result0 = parse_ws();
  31689. if (result0 !== null) {
  31690. pos2 = clone(pos);
  31691. pos3 = clone(pos);
  31692. result2 = parse_keywordPair();
  31693. if (result2 !== null) {
  31694. result3 = parse_ws();
  31695. if (result3 !== null) {
  31696. result2 = [result2, result3];
  31697. } else {
  31698. result2 = null;
  31699. pos = clone(pos3);
  31700. }
  31701. } else {
  31702. result2 = null;
  31703. pos = clone(pos3);
  31704. }
  31705. if (result2 !== null) {
  31706. result2 = (function(offset, line, column, pair) {return pair;})(pos2.offset, pos2.line, pos2.column, result2[0]);
  31707. }
  31708. if (result2 === null) {
  31709. pos = clone(pos2);
  31710. }
  31711. if (result2 !== null) {
  31712. result1 = [];
  31713. while (result2 !== null) {
  31714. result1.push(result2);
  31715. pos2 = clone(pos);
  31716. pos3 = clone(pos);
  31717. result2 = parse_keywordPair();
  31718. if (result2 !== null) {
  31719. result3 = parse_ws();
  31720. if (result3 !== null) {
  31721. result2 = [result2, result3];
  31722. } else {
  31723. result2 = null;
  31724. pos = clone(pos3);
  31725. }
  31726. } else {
  31727. result2 = null;
  31728. pos = clone(pos3);
  31729. }
  31730. if (result2 !== null) {
  31731. result2 = (function(offset, line, column, pair) {return pair;})(pos2.offset, pos2.line, pos2.column, result2[0]);
  31732. }
  31733. if (result2 === null) {
  31734. pos = clone(pos2);
  31735. }
  31736. }
  31737. } else {
  31738. result1 = null;
  31739. }
  31740. if (result1 !== null) {
  31741. result0 = [result0, result1];
  31742. } else {
  31743. result0 = null;
  31744. pos = clone(pos1);
  31745. }
  31746. } else {
  31747. result0 = null;
  31748. pos = clone(pos1);
  31749. }
  31750. if (result0 !== null) {
  31751. result0 = (function(offset, line, column, pairs) {
  31752. var selector = [];
  31753. var args = [];
  31754. for(var i = 0; i < pairs.length; i++) {
  31755. selector.push(pairs[i].key);
  31756. args.push(pairs[i].arg);
  31757. }
  31758. return smalltalk.SendNode._new()
  31759. ._position_((line).__at(column))
  31760. ._selector_(selector.join(""))
  31761. ._arguments_(args);
  31762. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  31763. }
  31764. if (result0 === null) {
  31765. pos = clone(pos0);
  31766. }
  31767. cache[cacheKey] = {
  31768. nextPos: clone(pos),
  31769. result: result0
  31770. };
  31771. return result0;
  31772. }
  31773. function parse_keywordSend() {
  31774. var cacheKey = "keywordSend@" + pos.offset;
  31775. var cachedResult = cache[cacheKey];
  31776. if (cachedResult) {
  31777. pos = clone(cachedResult.nextPos);
  31778. return cachedResult.result;
  31779. }
  31780. var result0, result1;
  31781. var pos0, pos1;
  31782. pos0 = clone(pos);
  31783. pos1 = clone(pos);
  31784. result0 = parse_binarySend();
  31785. if (result0 !== null) {
  31786. result1 = parse_keywordMessage();
  31787. if (result1 !== null) {
  31788. result0 = [result0, result1];
  31789. } else {
  31790. result0 = null;
  31791. pos = clone(pos1);
  31792. }
  31793. } else {
  31794. result0 = null;
  31795. pos = clone(pos1);
  31796. }
  31797. if (result0 !== null) {
  31798. result0 = (function(offset, line, column, receiver, tail) {
  31799. return tail._valueForReceiver_(receiver);
  31800. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  31801. }
  31802. if (result0 === null) {
  31803. pos = clone(pos0);
  31804. }
  31805. cache[cacheKey] = {
  31806. nextPos: clone(pos),
  31807. result: result0
  31808. };
  31809. return result0;
  31810. }
  31811. function parse_message() {
  31812. var cacheKey = "message@" + pos.offset;
  31813. var cachedResult = cache[cacheKey];
  31814. if (cachedResult) {
  31815. pos = clone(cachedResult.nextPos);
  31816. return cachedResult.result;
  31817. }
  31818. var result0;
  31819. result0 = parse_binaryMessage();
  31820. if (result0 === null) {
  31821. result0 = parse_unaryMessage();
  31822. if (result0 === null) {
  31823. result0 = parse_keywordMessage();
  31824. }
  31825. }
  31826. cache[cacheKey] = {
  31827. nextPos: clone(pos),
  31828. result: result0
  31829. };
  31830. return result0;
  31831. }
  31832. function parse_cascade() {
  31833. var cacheKey = "cascade@" + pos.offset;
  31834. var cachedResult = cache[cacheKey];
  31835. if (cachedResult) {
  31836. pos = clone(cachedResult.nextPos);
  31837. return cachedResult.result;
  31838. }
  31839. var result0, result1, result2, result3, result4, result5, result6, result7;
  31840. var pos0, pos1, pos2, pos3;
  31841. pos0 = clone(pos);
  31842. pos1 = clone(pos);
  31843. result0 = parse_ws();
  31844. if (result0 !== null) {
  31845. result1 = parse_keywordSend();
  31846. if (result1 === null) {
  31847. result1 = parse_binarySend();
  31848. }
  31849. if (result1 !== null) {
  31850. pos2 = clone(pos);
  31851. pos3 = clone(pos);
  31852. result3 = parse_ws();
  31853. if (result3 !== null) {
  31854. if (input.charCodeAt(pos.offset) === 59) {
  31855. result4 = ";";
  31856. advance(pos, 1);
  31857. } else {
  31858. result4 = null;
  31859. if (reportFailures === 0) {
  31860. matchFailed("\";\"");
  31861. }
  31862. }
  31863. if (result4 !== null) {
  31864. result5 = parse_ws();
  31865. if (result5 !== null) {
  31866. result6 = parse_message();
  31867. if (result6 !== null) {
  31868. result7 = parse_ws();
  31869. if (result7 !== null) {
  31870. result3 = [result3, result4, result5, result6, result7];
  31871. } else {
  31872. result3 = null;
  31873. pos = clone(pos3);
  31874. }
  31875. } else {
  31876. result3 = null;
  31877. pos = clone(pos3);
  31878. }
  31879. } else {
  31880. result3 = null;
  31881. pos = clone(pos3);
  31882. }
  31883. } else {
  31884. result3 = null;
  31885. pos = clone(pos3);
  31886. }
  31887. } else {
  31888. result3 = null;
  31889. pos = clone(pos3);
  31890. }
  31891. if (result3 !== null) {
  31892. result3 = (function(offset, line, column, mess) {return mess;})(pos2.offset, pos2.line, pos2.column, result3[3]);
  31893. }
  31894. if (result3 === null) {
  31895. pos = clone(pos2);
  31896. }
  31897. if (result3 !== null) {
  31898. result2 = [];
  31899. while (result3 !== null) {
  31900. result2.push(result3);
  31901. pos2 = clone(pos);
  31902. pos3 = clone(pos);
  31903. result3 = parse_ws();
  31904. if (result3 !== null) {
  31905. if (input.charCodeAt(pos.offset) === 59) {
  31906. result4 = ";";
  31907. advance(pos, 1);
  31908. } else {
  31909. result4 = null;
  31910. if (reportFailures === 0) {
  31911. matchFailed("\";\"");
  31912. }
  31913. }
  31914. if (result4 !== null) {
  31915. result5 = parse_ws();
  31916. if (result5 !== null) {
  31917. result6 = parse_message();
  31918. if (result6 !== null) {
  31919. result7 = parse_ws();
  31920. if (result7 !== null) {
  31921. result3 = [result3, result4, result5, result6, result7];
  31922. } else {
  31923. result3 = null;
  31924. pos = clone(pos3);
  31925. }
  31926. } else {
  31927. result3 = null;
  31928. pos = clone(pos3);
  31929. }
  31930. } else {
  31931. result3 = null;
  31932. pos = clone(pos3);
  31933. }
  31934. } else {
  31935. result3 = null;
  31936. pos = clone(pos3);
  31937. }
  31938. } else {
  31939. result3 = null;
  31940. pos = clone(pos3);
  31941. }
  31942. if (result3 !== null) {
  31943. result3 = (function(offset, line, column, mess) {return mess;})(pos2.offset, pos2.line, pos2.column, result3[3]);
  31944. }
  31945. if (result3 === null) {
  31946. pos = clone(pos2);
  31947. }
  31948. }
  31949. } else {
  31950. result2 = null;
  31951. }
  31952. if (result2 !== null) {
  31953. result0 = [result0, result1, result2];
  31954. } else {
  31955. result0 = null;
  31956. pos = clone(pos1);
  31957. }
  31958. } else {
  31959. result0 = null;
  31960. pos = clone(pos1);
  31961. }
  31962. } else {
  31963. result0 = null;
  31964. pos = clone(pos1);
  31965. }
  31966. if (result0 !== null) {
  31967. result0 = (function(offset, line, column, send, messages) {
  31968. var cascade = [];
  31969. cascade.push(send);
  31970. for(var i = 0; i < messages.length; i++) {
  31971. cascade.push(messages[i]);
  31972. }
  31973. return smalltalk.CascadeNode._new()
  31974. ._position_((line).__at(column))
  31975. ._receiver_(send._receiver())
  31976. ._nodes_(cascade);
  31977. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[2]);
  31978. }
  31979. if (result0 === null) {
  31980. pos = clone(pos0);
  31981. }
  31982. cache[cacheKey] = {
  31983. nextPos: clone(pos),
  31984. result: result0
  31985. };
  31986. return result0;
  31987. }
  31988. function parse_jsStatement() {
  31989. var cacheKey = "jsStatement@" + pos.offset;
  31990. var cachedResult = cache[cacheKey];
  31991. if (cachedResult) {
  31992. pos = clone(cachedResult.nextPos);
  31993. return cachedResult.result;
  31994. }
  31995. var result0, result1, result2;
  31996. var pos0, pos1, pos2;
  31997. pos0 = clone(pos);
  31998. pos1 = clone(pos);
  31999. if (input.charCodeAt(pos.offset) === 60) {
  32000. result0 = "<";
  32001. advance(pos, 1);
  32002. } else {
  32003. result0 = null;
  32004. if (reportFailures === 0) {
  32005. matchFailed("\"<\"");
  32006. }
  32007. }
  32008. if (result0 !== null) {
  32009. result1 = [];
  32010. pos2 = clone(pos);
  32011. if (input.substr(pos.offset, 2) === ">>") {
  32012. result2 = ">>";
  32013. advance(pos, 2);
  32014. } else {
  32015. result2 = null;
  32016. if (reportFailures === 0) {
  32017. matchFailed("\">>\"");
  32018. }
  32019. }
  32020. if (result2 !== null) {
  32021. result2 = (function(offset, line, column) {return ">";})(pos2.offset, pos2.line, pos2.column);
  32022. }
  32023. if (result2 === null) {
  32024. pos = clone(pos2);
  32025. }
  32026. if (result2 === null) {
  32027. if (/^[^>]/.test(input.charAt(pos.offset))) {
  32028. result2 = input.charAt(pos.offset);
  32029. advance(pos, 1);
  32030. } else {
  32031. result2 = null;
  32032. if (reportFailures === 0) {
  32033. matchFailed("[^>]");
  32034. }
  32035. }
  32036. }
  32037. while (result2 !== null) {
  32038. result1.push(result2);
  32039. pos2 = clone(pos);
  32040. if (input.substr(pos.offset, 2) === ">>") {
  32041. result2 = ">>";
  32042. advance(pos, 2);
  32043. } else {
  32044. result2 = null;
  32045. if (reportFailures === 0) {
  32046. matchFailed("\">>\"");
  32047. }
  32048. }
  32049. if (result2 !== null) {
  32050. result2 = (function(offset, line, column) {return ">";})(pos2.offset, pos2.line, pos2.column);
  32051. }
  32052. if (result2 === null) {
  32053. pos = clone(pos2);
  32054. }
  32055. if (result2 === null) {
  32056. if (/^[^>]/.test(input.charAt(pos.offset))) {
  32057. result2 = input.charAt(pos.offset);
  32058. advance(pos, 1);
  32059. } else {
  32060. result2 = null;
  32061. if (reportFailures === 0) {
  32062. matchFailed("[^>]");
  32063. }
  32064. }
  32065. }
  32066. }
  32067. if (result1 !== null) {
  32068. if (input.charCodeAt(pos.offset) === 62) {
  32069. result2 = ">";
  32070. advance(pos, 1);
  32071. } else {
  32072. result2 = null;
  32073. if (reportFailures === 0) {
  32074. matchFailed("\">\"");
  32075. }
  32076. }
  32077. if (result2 !== null) {
  32078. result0 = [result0, result1, result2];
  32079. } else {
  32080. result0 = null;
  32081. pos = clone(pos1);
  32082. }
  32083. } else {
  32084. result0 = null;
  32085. pos = clone(pos1);
  32086. }
  32087. } else {
  32088. result0 = null;
  32089. pos = clone(pos1);
  32090. }
  32091. if (result0 !== null) {
  32092. result0 = (function(offset, line, column, val) {
  32093. return smalltalk.JSStatementNode._new()
  32094. ._position_((line).__at(column))
  32095. ._source_(val.join(""));
  32096. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  32097. }
  32098. if (result0 === null) {
  32099. pos = clone(pos0);
  32100. }
  32101. cache[cacheKey] = {
  32102. nextPos: clone(pos),
  32103. result: result0
  32104. };
  32105. return result0;
  32106. }
  32107. function parse_method() {
  32108. var cacheKey = "method@" + pos.offset;
  32109. var cachedResult = cache[cacheKey];
  32110. if (cachedResult) {
  32111. pos = clone(cachedResult.nextPos);
  32112. return cachedResult.result;
  32113. }
  32114. var result0, result1, result2, result3, result4;
  32115. var pos0, pos1;
  32116. pos0 = clone(pos);
  32117. pos1 = clone(pos);
  32118. result0 = parse_ws();
  32119. if (result0 !== null) {
  32120. result1 = parse_keywordPattern();
  32121. if (result1 === null) {
  32122. result1 = parse_binaryPattern();
  32123. if (result1 === null) {
  32124. result1 = parse_unaryPattern();
  32125. }
  32126. }
  32127. if (result1 !== null) {
  32128. result2 = parse_ws();
  32129. if (result2 !== null) {
  32130. result3 = parse_sequence();
  32131. result3 = result3 !== null ? result3 : "";
  32132. if (result3 !== null) {
  32133. result4 = parse_ws();
  32134. if (result4 !== null) {
  32135. result0 = [result0, result1, result2, result3, result4];
  32136. } else {
  32137. result0 = null;
  32138. pos = clone(pos1);
  32139. }
  32140. } else {
  32141. result0 = null;
  32142. pos = clone(pos1);
  32143. }
  32144. } else {
  32145. result0 = null;
  32146. pos = clone(pos1);
  32147. }
  32148. } else {
  32149. result0 = null;
  32150. pos = clone(pos1);
  32151. }
  32152. } else {
  32153. result0 = null;
  32154. pos = clone(pos1);
  32155. }
  32156. if (result0 !== null) {
  32157. result0 = (function(offset, line, column, pattern, sequence) {
  32158. return smalltalk.MethodNode._new()
  32159. ._position_((line).__at(column))
  32160. ._selector_(pattern[0])
  32161. ._arguments_(pattern[1])
  32162. ._nodes_([sequence]);
  32163. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  32164. }
  32165. if (result0 === null) {
  32166. pos = clone(pos0);
  32167. }
  32168. cache[cacheKey] = {
  32169. nextPos: clone(pos),
  32170. result: result0
  32171. };
  32172. return result0;
  32173. }
  32174. function cleanupExpected(expected) {
  32175. expected.sort();
  32176. var lastExpected = null;
  32177. var cleanExpected = [];
  32178. for (var i = 0; i < expected.length; i++) {
  32179. if (expected[i] !== lastExpected) {
  32180. cleanExpected.push(expected[i]);
  32181. lastExpected = expected[i];
  32182. }
  32183. }
  32184. return cleanExpected;
  32185. }
  32186. var result = parseFunctions[startRule]();
  32187. /*
  32188. * The parser is now in one of the following three states:
  32189. *
  32190. * 1. The parser successfully parsed the whole input.
  32191. *
  32192. * - |result !== null|
  32193. * - |pos.offset === input.length|
  32194. * - |rightmostFailuresExpected| may or may not contain something
  32195. *
  32196. * 2. The parser successfully parsed only a part of the input.
  32197. *
  32198. * - |result !== null|
  32199. * - |pos.offset < input.length|
  32200. * - |rightmostFailuresExpected| may or may not contain something
  32201. *
  32202. * 3. The parser did not successfully parse any part of the input.
  32203. *
  32204. * - |result === null|
  32205. * - |pos.offset === 0|
  32206. * - |rightmostFailuresExpected| contains at least one failure
  32207. *
  32208. * All code following this comment (including called functions) must
  32209. * handle these states.
  32210. */
  32211. if (result === null || pos.offset !== input.length) {
  32212. var offset = Math.max(pos.offset, rightmostFailuresPos.offset);
  32213. var found = offset < input.length ? input.charAt(offset) : null;
  32214. var errorPosition = pos.offset > rightmostFailuresPos.offset ? pos : rightmostFailuresPos;
  32215. throw new this.SyntaxError(
  32216. cleanupExpected(rightmostFailuresExpected),
  32217. found,
  32218. offset,
  32219. errorPosition.line,
  32220. errorPosition.column
  32221. );
  32222. }
  32223. return result;
  32224. },
  32225. /* Returns the parser source code. */
  32226. toSource: function() { return this._source; }
  32227. };
  32228. /* Thrown when a parser encounters a syntax error. */
  32229. result.SyntaxError = function(expected, found, offset, line, column) {
  32230. function buildMessage(expected, found) {
  32231. var expectedHumanized, foundHumanized;
  32232. switch (expected.length) {
  32233. case 0:
  32234. expectedHumanized = "end of input";
  32235. break;
  32236. case 1:
  32237. expectedHumanized = expected[0];
  32238. break;
  32239. default:
  32240. expectedHumanized = expected.slice(0, expected.length - 1).join(", ")
  32241. + " or "
  32242. + expected[expected.length - 1];
  32243. }
  32244. foundHumanized = found ? quote(found) : "end of input";
  32245. return "Expected " + expectedHumanized + " but " + foundHumanized + " found.";
  32246. }
  32247. this.name = "SyntaxError";
  32248. this.expected = expected;
  32249. this.found = found;
  32250. this.message = buildMessage(expected, found);
  32251. this.offset = offset;
  32252. this.line = line;
  32253. this.column = column;
  32254. };
  32255. result.SyntaxError.prototype = Error.prototype;
  32256. return result;
  32257. })();
  32258. smalltalk.addPackage('AmberCli');
  32259. smalltalk.addClass('AmberCli', smalltalk.Object, [], 'AmberCli');
  32260. 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.";
  32261. smalltalk.addMethod(
  32262. smalltalk.method({
  32263. selector: "commandLineSwitches",
  32264. category: 'commandline',
  32265. fn: function (){
  32266. var self=this;
  32267. var switches;
  32268. return smalltalk.withContext(function($ctx1) {
  32269. var $1;
  32270. switches=_st(_st(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  32271. return smalltalk.withContext(function($ctx2) {
  32272. return _st(each)._selector();
  32273. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  32274. switches=_st(switches)._select_((function(each){
  32275. return smalltalk.withContext(function($ctx2) {
  32276. return _st(each)._match_("^[^:]*:$");
  32277. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  32278. switches=_st(switches)._collect_((function(each){
  32279. return smalltalk.withContext(function($ctx2) {
  32280. return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  32281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  32282. $1=switches;
  32283. return $1;
  32284. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.AmberCli.klass)})},
  32285. args: [],
  32286. 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",
  32287. messageSends: ["collect:", "selector", "methodsInProtocol:", "class", "select:", "match:", "asLowercase", "replace:with:", "allButLast"],
  32288. referencedClasses: []
  32289. }),
  32290. smalltalk.AmberCli.klass);
  32291. smalltalk.addMethod(
  32292. smalltalk.method({
  32293. selector: "handleArguments:",
  32294. category: 'commandline',
  32295. fn: function (args){
  32296. var self=this;
  32297. var selector;
  32298. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  32299. return smalltalk.withContext(function($ctx1) {
  32300. selector=self._selectorForCommandLineSwitch_(_st(args)._first());
  32301. _st(args)._remove_(_st(args)._first());
  32302. self._perform_withArguments_(selector,_st($Array())._with_(args));
  32303. return self}, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},smalltalk.AmberCli.klass)})},
  32304. args: ["args"],
  32305. 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)",
  32306. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"],
  32307. referencedClasses: ["Array"]
  32308. }),
  32309. smalltalk.AmberCli.klass);
  32310. smalltalk.addMethod(
  32311. smalltalk.method({
  32312. selector: "help:",
  32313. category: 'commands',
  32314. fn: function (args){
  32315. var self=this;
  32316. return smalltalk.withContext(function($ctx1) {
  32317. _st(console)._log_("Available Commands:");
  32318. _st(self._commandLineSwitches())._do_((function(each){
  32319. return smalltalk.withContext(function($ctx2) {
  32320. return _st(console)._log_(each);
  32321. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  32322. return self}, function($ctx1) {$ctx1.fill(self,"help:",{args:args},smalltalk.AmberCli.klass)})},
  32323. args: ["args"],
  32324. source: "help: args\x0a\x09console log: 'Available Commands:'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  32325. messageSends: ["log:", "do:", "commandLineSwitches"],
  32326. referencedClasses: []
  32327. }),
  32328. smalltalk.AmberCli.klass);
  32329. smalltalk.addMethod(
  32330. smalltalk.method({
  32331. selector: "main",
  32332. category: 'startup',
  32333. fn: function (){
  32334. var self=this;
  32335. var args,nodeMinorVersion;
  32336. return smalltalk.withContext(function($ctx1) {
  32337. var $1,$2,$3;
  32338. nodeMinorVersion=_st(_st(_st(_st(process)._version())._tokenize_("."))._second())._asNumber();
  32339. $1=_st(nodeMinorVersion).__lt((8));
  32340. if(smalltalk.assert($1)){
  32341. _st(console)._log_("You are currently using Node.js ".__comma(_st(process)._version()));
  32342. _st(console)._log_("Required is at least Node.js v0.8.x or greater.");
  32343. return (-1);
  32344. };
  32345. args=_st(process)._argv();
  32346. _st(args)._removeFrom_to_((1),(3));
  32347. $2=_st(args)._isEmpty();
  32348. if(smalltalk.assert($2)){
  32349. self._help_(nil);
  32350. } else {
  32351. $3=self._handleArguments_(args);
  32352. return $3;
  32353. };
  32354. return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},smalltalk.AmberCli.klass)})},
  32355. args: [],
  32356. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args nodeMinorVersion |\x0a\x0a\x09nodeMinorVersion := ((process version) tokenize: '.') second asNumber.\x0a\x09nodeMinorVersion < 8 ifTrue: [\x0a\x09\x09console log: 'You are currently using Node.js ', (process version).\x0a\x09\x09console log: 'Required is at least Node.js v0.8.x or greater.'.\x0a\x09\x09^ -1.\x0a\x09].\x0a\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 3.\x0a\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
  32357. messageSends: ["asNumber", "second", "tokenize:", "version", "ifTrue:", "log:", ",", "<", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "help:", "handleArguments:", "isEmpty"],
  32358. referencedClasses: []
  32359. }),
  32360. smalltalk.AmberCli.klass);
  32361. smalltalk.addMethod(
  32362. smalltalk.method({
  32363. selector: "repl:",
  32364. category: 'commands',
  32365. fn: function (args){
  32366. var self=this;
  32367. function $Repl(){return smalltalk.Repl||(typeof Repl=="undefined"?nil:Repl)}
  32368. return smalltalk.withContext(function($ctx1) {
  32369. var $1;
  32370. $1=_st(_st($Repl())._new())._createInterface();
  32371. return $1;
  32372. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},smalltalk.AmberCli.klass)})},
  32373. args: ["args"],
  32374. source: "repl: args\x0a\x09^Repl new createInterface",
  32375. messageSends: ["createInterface", "new"],
  32376. referencedClasses: ["Repl"]
  32377. }),
  32378. smalltalk.AmberCli.klass);
  32379. smalltalk.addMethod(
  32380. smalltalk.method({
  32381. selector: "selectorForCommandLineSwitch:",
  32382. category: 'commandline',
  32383. fn: function (aSwitch){
  32384. var self=this;
  32385. var command,selector;
  32386. return smalltalk.withContext(function($ctx1) {
  32387. var $1,$2;
  32388. $1=_st(self._commandLineSwitches())._includes_(aSwitch);
  32389. if(smalltalk.assert($1)){
  32390. selector=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){
  32391. return smalltalk.withContext(function($ctx2) {
  32392. return _st(_st(each)._second())._asUppercase();
  32393. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":");
  32394. selector;
  32395. } else {
  32396. selector="help:";
  32397. selector;
  32398. };
  32399. $2=selector;
  32400. return $2;
  32401. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},smalltalk.AmberCli.klass)})},
  32402. args: ["aSwitch"],
  32403. 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",
  32404. messageSends: ["ifTrue:ifFalse:", ",", "replace:with:", "asUppercase", "second", "includes:", "commandLineSwitches"],
  32405. referencedClasses: []
  32406. }),
  32407. smalltalk.AmberCli.klass);
  32408. smalltalk.addMethod(
  32409. smalltalk.method({
  32410. selector: "serve:",
  32411. category: 'commands',
  32412. fn: function (args){
  32413. var self=this;
  32414. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  32415. return smalltalk.withContext(function($ctx1) {
  32416. var $1;
  32417. $1=_st(_st($FileServer())._createServerWithArguments_(args))._start();
  32418. return $1;
  32419. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},smalltalk.AmberCli.klass)})},
  32420. args: ["args"],
  32421. source: "serve: args\x0a\x09^(FileServer createServerWithArguments: args) start",
  32422. messageSends: ["start", "createServerWithArguments:"],
  32423. referencedClasses: ["FileServer"]
  32424. }),
  32425. smalltalk.AmberCli.klass);
  32426. smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  32427. 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.";
  32428. smalltalk.addMethod(
  32429. smalltalk.method({
  32430. selector: "base64Decode:",
  32431. category: 'private',
  32432. fn: function (aString){
  32433. var self=this;
  32434. return smalltalk.withContext(function($ctx1) {
  32435. return (new Buffer(aString, 'base64').toString());
  32436. return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},smalltalk.FileServer)})},
  32437. args: ["aString"],
  32438. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  32439. messageSends: [],
  32440. referencedClasses: []
  32441. }),
  32442. smalltalk.FileServer);
  32443. smalltalk.addMethod(
  32444. smalltalk.method({
  32445. selector: "basePath",
  32446. category: 'accessing',
  32447. fn: function (){
  32448. var self=this;
  32449. return smalltalk.withContext(function($ctx1) {
  32450. var $2,$1;
  32451. $2=self["@basePath"];
  32452. if(($receiver = $2) == nil || $receiver == undefined){
  32453. $1="./";
  32454. } else {
  32455. $1=$2;
  32456. };
  32457. return $1;
  32458. }, function($ctx1) {$ctx1.fill(self,"basePath",{},smalltalk.FileServer)})},
  32459. args: [],
  32460. source: "basePath\x0a\x09^basePath ifNil: ['./']",
  32461. messageSends: ["ifNil:"],
  32462. referencedClasses: []
  32463. }),
  32464. smalltalk.FileServer);
  32465. smalltalk.addMethod(
  32466. smalltalk.method({
  32467. selector: "basePath:",
  32468. category: 'accessing',
  32469. fn: function (aString){
  32470. var self=this;
  32471. return smalltalk.withContext(function($ctx1) {
  32472. self["@basePath"]=aString;
  32473. return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},smalltalk.FileServer)})},
  32474. args: ["aString"],
  32475. source: "basePath: aString\x0a\x09basePath := aString",
  32476. messageSends: [],
  32477. referencedClasses: []
  32478. }),
  32479. smalltalk.FileServer);
  32480. smalltalk.addMethod(
  32481. smalltalk.method({
  32482. selector: "checkDirectoryLayout",
  32483. category: 'initialization',
  32484. fn: function (){
  32485. var self=this;
  32486. return smalltalk.withContext(function($ctx1) {
  32487. var $1,$2,$3;
  32488. $1=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("index.html"));
  32489. if(! smalltalk.assert($1)){
  32490. _st(console)._warn_("Warning: project directory does not contain index.html");
  32491. };
  32492. $2=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("st"));
  32493. if(! smalltalk.assert($2)){
  32494. _st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory");
  32495. };
  32496. $3=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("js"));
  32497. if(! smalltalk.assert($3)){
  32498. _st(console)._warn_("Warning: project directory is missing a \x22js\x22 directory");
  32499. };
  32500. return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},smalltalk.FileServer)})},
  32501. args: [],
  32502. 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'].",
  32503. messageSends: ["ifFalse:", "warn:", "existsSync:", ",", "basePath"],
  32504. referencedClasses: []
  32505. }),
  32506. smalltalk.FileServer);
  32507. smalltalk.addMethod(
  32508. smalltalk.method({
  32509. selector: "fallbackPage",
  32510. category: 'accessing',
  32511. fn: function (){
  32512. var self=this;
  32513. return smalltalk.withContext(function($ctx1) {
  32514. var $1;
  32515. $1=self["@fallbackPage"];
  32516. return $1;
  32517. }, function($ctx1) {$ctx1.fill(self,"fallbackPage",{},smalltalk.FileServer)})},
  32518. args: [],
  32519. source: "fallbackPage\x0a\x09^fallbackPage",
  32520. messageSends: [],
  32521. referencedClasses: []
  32522. }),
  32523. smalltalk.FileServer);
  32524. smalltalk.addMethod(
  32525. smalltalk.method({
  32526. selector: "fallbackPage:",
  32527. category: 'accessing',
  32528. fn: function (aString){
  32529. var self=this;
  32530. return smalltalk.withContext(function($ctx1) {
  32531. self["@fallbackPage"]=aString;
  32532. return self}, function($ctx1) {$ctx1.fill(self,"fallbackPage:",{aString:aString},smalltalk.FileServer)})},
  32533. args: ["aString"],
  32534. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  32535. messageSends: [],
  32536. referencedClasses: []
  32537. }),
  32538. smalltalk.FileServer);
  32539. smalltalk.addMethod(
  32540. smalltalk.method({
  32541. selector: "handleGETRequest:respondTo:",
  32542. category: 'request handling',
  32543. fn: function (aRequest,aResponse){
  32544. var self=this;
  32545. var uri,filename;
  32546. return smalltalk.withContext(function($ctx1) {
  32547. var $1;
  32548. uri=_st(_st(self["@url"])._parse_(_st(aRequest)._url()))._pathname();
  32549. filename=_st(self["@path"])._join_with_(self._basePath(),uri);
  32550. _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
  32551. return smalltalk.withContext(function($ctx2) {
  32552. $1=aBoolean;
  32553. if(smalltalk.assert($1)){
  32554. return self._respondFileNamed_to_(filename,aResponse);
  32555. } else {
  32556. return self._respondNotFoundTo_(aResponse);
  32557. };
  32558. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1)})}));
  32559. return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},smalltalk.FileServer)})},
  32560. args: ["aRequest", "aResponse"],
  32561. 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]]",
  32562. messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"],
  32563. referencedClasses: []
  32564. }),
  32565. smalltalk.FileServer);
  32566. smalltalk.addMethod(
  32567. smalltalk.method({
  32568. selector: "handleOPTIONSRequest:respondTo:",
  32569. category: 'request handling',
  32570. fn: function (aRequest,aResponse){
  32571. var self=this;
  32572. return smalltalk.withContext(function($ctx1) {
  32573. _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))]));
  32574. _st(aResponse)._end();
  32575. return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  32576. args: ["aRequest", "aResponse"],
  32577. 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",
  32578. messageSends: ["writeHead:options:", "->", "end"],
  32579. referencedClasses: []
  32580. }),
  32581. smalltalk.FileServer);
  32582. smalltalk.addMethod(
  32583. smalltalk.method({
  32584. selector: "handlePUTRequest:respondTo:",
  32585. category: 'request handling',
  32586. fn: function (aRequest,aResponse){
  32587. var self=this;
  32588. var file,stream;
  32589. return smalltalk.withContext(function($ctx1) {
  32590. var $1,$2;
  32591. $1=self._isAuthenticated_(aRequest);
  32592. if(! smalltalk.assert($1)){
  32593. self._respondAuthenticationRequiredTo_(aResponse);
  32594. return nil;
  32595. };
  32596. file=".".__comma(_st(aRequest)._url());
  32597. stream=_st(self["@fs"])._createWriteStream_(file);
  32598. _st(stream)._on_do_("error",(function(error){
  32599. return smalltalk.withContext(function($ctx2) {
  32600. _st(console)._warn_("Error creating WriteStream for file ".__comma(file));
  32601. _st(console)._warn_(" Did you forget to create the necessary js/ or st/ directory in your project?");
  32602. _st(console)._warn_(" The exact error is: ".__comma(error));
  32603. return self._respondNotCreatedTo_(aResponse);
  32604. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  32605. _st(stream)._on_do_("close",(function(){
  32606. return smalltalk.withContext(function($ctx2) {
  32607. return self._respondCreatedTo_(aResponse);
  32608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  32609. _st(aRequest)._setEncoding_("utf8");
  32610. _st(aRequest)._on_do_("data",(function(data){
  32611. return smalltalk.withContext(function($ctx2) {
  32612. return _st(stream)._write_(data);
  32613. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1)})}));
  32614. _st(aRequest)._on_do_("end",(function(){
  32615. return smalltalk.withContext(function($ctx2) {
  32616. $2=_st(stream)._writable();
  32617. if(smalltalk.assert($2)){
  32618. return _st(stream)._end();
  32619. };
  32620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  32621. return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},smalltalk.FileServer)})},
  32622. args: ["aRequest", "aResponse"],
  32623. 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]]",
  32624. messageSends: ["ifFalse:", "respondAuthenticationRequiredTo:", "isAuthenticated:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "end", "writable"],
  32625. referencedClasses: []
  32626. }),
  32627. smalltalk.FileServer);
  32628. smalltalk.addMethod(
  32629. smalltalk.method({
  32630. selector: "handleRequest:respondTo:",
  32631. category: 'request handling',
  32632. fn: function (aRequest,aResponse){
  32633. var self=this;
  32634. return smalltalk.withContext(function($ctx1) {
  32635. var $1,$2,$3;
  32636. $1=_st(_st(aRequest)._method()).__eq("PUT");
  32637. if(smalltalk.assert($1)){
  32638. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  32639. };
  32640. $2=_st(_st(aRequest)._method()).__eq("GET");
  32641. if(smalltalk.assert($2)){
  32642. self._handleGETRequest_respondTo_(aRequest,aResponse);
  32643. };
  32644. $3=_st(_st(aRequest)._method()).__eq("OPTIONS");
  32645. if(smalltalk.assert($3)){
  32646. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  32647. };
  32648. return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  32649. args: ["aRequest", "aResponse"],
  32650. 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]",
  32651. messageSends: ["ifTrue:", "handlePUTRequest:respondTo:", "=", "method", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
  32652. referencedClasses: []
  32653. }),
  32654. smalltalk.FileServer);
  32655. smalltalk.addMethod(
  32656. smalltalk.method({
  32657. selector: "host",
  32658. category: 'accessing',
  32659. fn: function (){
  32660. var self=this;
  32661. return smalltalk.withContext(function($ctx1) {
  32662. var $1;
  32663. $1=self["@host"];
  32664. return $1;
  32665. }, function($ctx1) {$ctx1.fill(self,"host",{},smalltalk.FileServer)})},
  32666. args: [],
  32667. source: "host\x0a\x09^host",
  32668. messageSends: [],
  32669. referencedClasses: []
  32670. }),
  32671. smalltalk.FileServer);
  32672. smalltalk.addMethod(
  32673. smalltalk.method({
  32674. selector: "host:",
  32675. category: 'accessing',
  32676. fn: function (hostname){
  32677. var self=this;
  32678. return smalltalk.withContext(function($ctx1) {
  32679. self["@host"]=hostname;
  32680. return self}, function($ctx1) {$ctx1.fill(self,"host:",{hostname:hostname},smalltalk.FileServer)})},
  32681. args: ["hostname"],
  32682. source: "host: hostname\x0a\x09host := hostname",
  32683. messageSends: [],
  32684. referencedClasses: []
  32685. }),
  32686. smalltalk.FileServer);
  32687. smalltalk.addMethod(
  32688. smalltalk.method({
  32689. selector: "initialize",
  32690. category: 'initialization',
  32691. fn: function (){
  32692. var self=this;
  32693. return smalltalk.withContext(function($ctx1) {
  32694. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  32695. self["@path"]=self._require_("path");
  32696. self["@http"]=self._require_("http");
  32697. self["@fs"]=self._require_("fs");
  32698. self["@util"]=self._require_("util");
  32699. self["@url"]=self._require_("url");
  32700. self["@host"]=_st(self._class())._defaultHost();
  32701. self["@port"]=_st(self._class())._defaultPort();
  32702. self["@username"]=nil;
  32703. self["@password"]=nil;
  32704. self["@fallbackPage"]=nil;
  32705. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.FileServer)})},
  32706. args: [],
  32707. 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.",
  32708. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"],
  32709. referencedClasses: []
  32710. }),
  32711. smalltalk.FileServer);
  32712. smalltalk.addMethod(
  32713. smalltalk.method({
  32714. selector: "isAuthenticated:",
  32715. category: 'private',
  32716. fn: function (aRequest){
  32717. var self=this;
  32718. var header,token,auth,parts;
  32719. return smalltalk.withContext(function($ctx1) {
  32720. var $1,$2,$3,$4,$5;
  32721. $1=_st(_st(self["@username"])._isNil())._and_((function(){
  32722. return smalltalk.withContext(function($ctx2) {
  32723. return _st(self["@password"])._isNil();
  32724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  32725. if(smalltalk.assert($1)){
  32726. return true;
  32727. };
  32728. $2=_st(_st(aRequest)._headers())._at_("authorization");
  32729. if(($receiver = $2) == nil || $receiver == undefined){
  32730. header="";
  32731. } else {
  32732. header=$2;
  32733. };
  32734. $3=_st(header)._isEmpty();
  32735. if(smalltalk.assert($3)){
  32736. return false;
  32737. } else {
  32738. $4=_st(header)._tokenize_(" ");
  32739. if(($receiver = $4) == nil || $receiver == undefined){
  32740. token="";
  32741. } else {
  32742. token=$4;
  32743. };
  32744. token;
  32745. auth=self._base64Decode_(_st(token)._at_((2)));
  32746. auth;
  32747. parts=_st(auth)._tokenize_(":");
  32748. parts;
  32749. $5=_st(_st(self["@username"]).__eq(_st(parts)._at_((1))))._and_((function(){
  32750. return smalltalk.withContext(function($ctx2) {
  32751. return _st(self["@password"]).__eq(_st(parts)._at_((2)));
  32752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  32753. if(smalltalk.assert($5)){
  32754. return true;
  32755. } else {
  32756. return false;
  32757. };
  32758. };
  32759. return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},smalltalk.FileServer)})},
  32760. args: ["aRequest"],
  32761. 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].",
  32762. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "tokenize:", "base64Decode:", "=", "isEmpty"],
  32763. referencedClasses: []
  32764. }),
  32765. smalltalk.FileServer);
  32766. smalltalk.addMethod(
  32767. smalltalk.method({
  32768. selector: "password:",
  32769. category: 'accessing',
  32770. fn: function (aPassword){
  32771. var self=this;
  32772. return smalltalk.withContext(function($ctx1) {
  32773. self["@password"]=aPassword;
  32774. return self}, function($ctx1) {$ctx1.fill(self,"password:",{aPassword:aPassword},smalltalk.FileServer)})},
  32775. args: ["aPassword"],
  32776. source: "password: aPassword\x0a\x09password := aPassword.",
  32777. messageSends: [],
  32778. referencedClasses: []
  32779. }),
  32780. smalltalk.FileServer);
  32781. smalltalk.addMethod(
  32782. smalltalk.method({
  32783. selector: "port",
  32784. category: 'accessing',
  32785. fn: function (){
  32786. var self=this;
  32787. return smalltalk.withContext(function($ctx1) {
  32788. var $1;
  32789. $1=self["@port"];
  32790. return $1;
  32791. }, function($ctx1) {$ctx1.fill(self,"port",{},smalltalk.FileServer)})},
  32792. args: [],
  32793. source: "port\x0a\x09^port",
  32794. messageSends: [],
  32795. referencedClasses: []
  32796. }),
  32797. smalltalk.FileServer);
  32798. smalltalk.addMethod(
  32799. smalltalk.method({
  32800. selector: "port:",
  32801. category: 'accessing',
  32802. fn: function (aNumber){
  32803. var self=this;
  32804. return smalltalk.withContext(function($ctx1) {
  32805. self["@port"]=aNumber;
  32806. return self}, function($ctx1) {$ctx1.fill(self,"port:",{aNumber:aNumber},smalltalk.FileServer)})},
  32807. args: ["aNumber"],
  32808. source: "port: aNumber\x0a\x09port := aNumber",
  32809. messageSends: [],
  32810. referencedClasses: []
  32811. }),
  32812. smalltalk.FileServer);
  32813. smalltalk.addMethod(
  32814. smalltalk.method({
  32815. selector: "require:",
  32816. category: 'private',
  32817. fn: function (aModuleString){
  32818. var self=this;
  32819. return smalltalk.withContext(function($ctx1) {
  32820. var $1;
  32821. $1=_st(require)._value_(aModuleString);
  32822. return $1;
  32823. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},smalltalk.FileServer)})},
  32824. args: ["aModuleString"],
  32825. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  32826. messageSends: ["value:"],
  32827. referencedClasses: []
  32828. }),
  32829. smalltalk.FileServer);
  32830. smalltalk.addMethod(
  32831. smalltalk.method({
  32832. selector: "respondAuthenticationRequiredTo:",
  32833. category: 'request handling',
  32834. fn: function (aResponse){
  32835. var self=this;
  32836. return smalltalk.withContext(function($ctx1) {
  32837. var $1,$2;
  32838. $1=aResponse;
  32839. _st($1)._writeHead_options_((401),smalltalk.HashedCollection._from_(["WWW-Authenticate".__minus_gt("Basic realm=\x22Secured Developer Area\x22")]));
  32840. _st($1)._write_("<html><body>Authentication needed</body></html>");
  32841. $2=_st($1)._end();
  32842. return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32843. args: ["aResponse"],
  32844. 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.",
  32845. messageSends: ["writeHead:options:", "->", "write:", "end"],
  32846. referencedClasses: []
  32847. }),
  32848. smalltalk.FileServer);
  32849. smalltalk.addMethod(
  32850. smalltalk.method({
  32851. selector: "respondCreatedTo:",
  32852. category: 'request handling',
  32853. fn: function (aResponse){
  32854. var self=this;
  32855. return smalltalk.withContext(function($ctx1) {
  32856. var $1,$2;
  32857. $1=aResponse;
  32858. _st($1)._writeHead_options_((201),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain"),"Access-Control-Allow-Origin".__minus_gt("*")]));
  32859. $2=_st($1)._end();
  32860. return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32861. args: ["aResponse"],
  32862. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  32863. messageSends: ["writeHead:options:", "->", "end"],
  32864. referencedClasses: []
  32865. }),
  32866. smalltalk.FileServer);
  32867. smalltalk.addMethod(
  32868. smalltalk.method({
  32869. selector: "respondFileNamed:to:",
  32870. category: 'request handling',
  32871. fn: function (aFilename,aResponse){
  32872. var self=this;
  32873. var type,filename;
  32874. return smalltalk.withContext(function($ctx1) {
  32875. var $1,$2,$3,$4,$5;
  32876. filename=aFilename;
  32877. $1=_st(_st(self["@fs"])._statSync_(aFilename))._isDirectory();
  32878. if(smalltalk.assert($1)){
  32879. filename=_st(filename).__comma("index.html");
  32880. filename;
  32881. };
  32882. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  32883. return smalltalk.withContext(function($ctx2) {
  32884. $2=_st(ex)._notNil();
  32885. if(smalltalk.assert($2)){
  32886. _st(console)._log_(_st(filename).__comma(" does not exist"));
  32887. return self._respondInternalErrorTo_(aResponse);
  32888. } else {
  32889. type=_st(self._class())._mimeTypeFor_(filename);
  32890. type;
  32891. $3=_st(type).__eq("application/javascript");
  32892. if(smalltalk.assert($3)){
  32893. type=_st(type).__comma(";charset=utf-8");
  32894. type;
  32895. };
  32896. $4=aResponse;
  32897. _st($4)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt(type)]));
  32898. _st($4)._write_encoding_(file,"binary");
  32899. $5=_st($4)._end();
  32900. return $5;
  32901. };
  32902. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1)})}));
  32903. return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},smalltalk.FileServer)})},
  32904. args: ["aFilename", "aResponse"],
  32905. 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]]",
  32906. messageSends: ["ifTrue:", ",", "isDirectory", "statSync:", "readFile:do:", "ifTrue:ifFalse:", "log:", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end", "notNil"],
  32907. referencedClasses: []
  32908. }),
  32909. smalltalk.FileServer);
  32910. smalltalk.addMethod(
  32911. smalltalk.method({
  32912. selector: "respondInternalErrorTo:",
  32913. category: 'request handling',
  32914. fn: function (aResponse){
  32915. var self=this;
  32916. return smalltalk.withContext(function($ctx1) {
  32917. var $1,$2;
  32918. $1=aResponse;
  32919. _st($1)._writeHead_options_((500),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  32920. _st($1)._write_("500 Internal server error");
  32921. $2=_st($1)._end();
  32922. return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32923. args: ["aResponse"],
  32924. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  32925. messageSends: ["writeHead:options:", "->", "write:", "end"],
  32926. referencedClasses: []
  32927. }),
  32928. smalltalk.FileServer);
  32929. smalltalk.addMethod(
  32930. smalltalk.method({
  32931. selector: "respondNotCreatedTo:",
  32932. category: 'request handling',
  32933. fn: function (aResponse){
  32934. var self=this;
  32935. return smalltalk.withContext(function($ctx1) {
  32936. var $1,$2;
  32937. $1=aResponse;
  32938. _st($1)._writeHead_options_((400),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  32939. _st($1)._write_("File could not be created. Did you forget to create the st/js directories on the server?");
  32940. $2=_st($1)._end();
  32941. return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32942. args: ["aResponse"],
  32943. 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.",
  32944. messageSends: ["writeHead:options:", "->", "write:", "end"],
  32945. referencedClasses: []
  32946. }),
  32947. smalltalk.FileServer);
  32948. smalltalk.addMethod(
  32949. smalltalk.method({
  32950. selector: "respondNotFoundTo:",
  32951. category: 'request handling',
  32952. fn: function (aResponse){
  32953. var self=this;
  32954. return smalltalk.withContext(function($ctx1) {
  32955. var $1,$2,$3,$4;
  32956. $1=_st(self._fallbackPage())._isNil();
  32957. if(! smalltalk.assert($1)){
  32958. $2=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  32959. return $2;
  32960. };
  32961. $3=aResponse;
  32962. _st($3)._writeHead_options_((404),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  32963. _st($3)._write_("404 Not found");
  32964. $4=_st($3)._end();
  32965. return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32966. args: ["aResponse"],
  32967. 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",
  32968. messageSends: ["ifFalse:", "respondFileNamed:to:", "fallbackPage", "isNil", "writeHead:options:", "->", "write:", "end"],
  32969. referencedClasses: []
  32970. }),
  32971. smalltalk.FileServer);
  32972. smalltalk.addMethod(
  32973. smalltalk.method({
  32974. selector: "respondOKTo:",
  32975. category: 'request handling',
  32976. fn: function (aResponse){
  32977. var self=this;
  32978. return smalltalk.withContext(function($ctx1) {
  32979. var $1,$2;
  32980. $1=aResponse;
  32981. _st($1)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain"),"Access-Control-Allow-Origin".__minus_gt("*")]));
  32982. $2=_st($1)._end();
  32983. return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32984. args: ["aResponse"],
  32985. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  32986. messageSends: ["writeHead:options:", "->", "end"],
  32987. referencedClasses: []
  32988. }),
  32989. smalltalk.FileServer);
  32990. smalltalk.addMethod(
  32991. smalltalk.method({
  32992. selector: "start",
  32993. category: 'starting',
  32994. fn: function (){
  32995. var self=this;
  32996. return smalltalk.withContext(function($ctx1) {
  32997. var $1,$2;
  32998. self._checkDirectoryLayout();
  32999. $1=_st(self["@http"])._createServer_((function(request,response){
  33000. return smalltalk.withContext(function($ctx2) {
  33001. return self._handleRequest_respondTo_(request,response);
  33002. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1)})}));
  33003. _st($1)._on_do_("error",(function(error){
  33004. return smalltalk.withContext(function($ctx2) {
  33005. return _st(console)._log_("Error starting server: ".__comma(error));
  33006. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  33007. _st($1)._on_do_("listening",(function(){
  33008. return smalltalk.withContext(function($ctx2) {
  33009. return _st(console)._log_(_st(_st("Starting file server on http://".__comma(self._host())).__comma(":")).__comma(_st(self._port())._asString()));
  33010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33011. $2=_st($1)._listen_host_(self._port(),self._host());
  33012. return self}, function($ctx1) {$ctx1.fill(self,"start",{},smalltalk.FileServer)})},
  33013. args: [],
  33014. 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.",
  33015. messageSends: ["checkDirectoryLayout", "on:do:", "log:", ",", "createServer:", "handleRequest:respondTo:", "asString", "port", "host", "listen:host:"],
  33016. referencedClasses: []
  33017. }),
  33018. smalltalk.FileServer);
  33019. smalltalk.addMethod(
  33020. smalltalk.method({
  33021. selector: "startOn:",
  33022. category: 'starting',
  33023. fn: function (aPort){
  33024. var self=this;
  33025. return smalltalk.withContext(function($ctx1) {
  33026. self._port_(aPort);
  33027. self._start();
  33028. return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},smalltalk.FileServer)})},
  33029. args: ["aPort"],
  33030. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  33031. messageSends: ["port:", "start"],
  33032. referencedClasses: []
  33033. }),
  33034. smalltalk.FileServer);
  33035. smalltalk.addMethod(
  33036. smalltalk.method({
  33037. selector: "username:",
  33038. category: 'accessing',
  33039. fn: function (aUsername){
  33040. var self=this;
  33041. return smalltalk.withContext(function($ctx1) {
  33042. self["@username"]=aUsername;
  33043. return self}, function($ctx1) {$ctx1.fill(self,"username:",{aUsername:aUsername},smalltalk.FileServer)})},
  33044. args: ["aUsername"],
  33045. source: "username: aUsername\x0a\x09username := aUsername.",
  33046. messageSends: [],
  33047. referencedClasses: []
  33048. }),
  33049. smalltalk.FileServer);
  33050. smalltalk.addMethod(
  33051. smalltalk.method({
  33052. selector: "writeData:toFileNamed:",
  33053. category: 'private',
  33054. fn: function (data,aFilename){
  33055. var self=this;
  33056. return smalltalk.withContext(function($ctx1) {
  33057. _st(console)._log_(aFilename);
  33058. return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},smalltalk.FileServer)})},
  33059. args: ["data", "aFilename"],
  33060. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  33061. messageSends: ["log:"],
  33062. referencedClasses: []
  33063. }),
  33064. smalltalk.FileServer);
  33065. smalltalk.FileServer.klass.iVarNames = ['mimeTypes'];
  33066. smalltalk.addMethod(
  33067. smalltalk.method({
  33068. selector: "commandLineSwitches",
  33069. category: 'accessing',
  33070. fn: function (){
  33071. var self=this;
  33072. var switches;
  33073. return smalltalk.withContext(function($ctx1) {
  33074. var $1;
  33075. switches=_st(self._methodsInProtocol_("accessing"))._collect_((function(each){
  33076. return smalltalk.withContext(function($ctx2) {
  33077. return _st(each)._selector();
  33078. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  33079. switches=_st(switches)._select_((function(each){
  33080. return smalltalk.withContext(function($ctx2) {
  33081. return _st(each)._match_("^[^:]*:$");
  33082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  33083. switches=_st(switches)._collect_((function(each){
  33084. return smalltalk.withContext(function($ctx2) {
  33085. return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  33086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  33087. $1=switches;
  33088. return $1;
  33089. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.FileServer.klass)})},
  33090. args: [],
  33091. 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",
  33092. messageSends: ["collect:", "selector", "methodsInProtocol:", "select:", "match:", "replace:with:", "asLowercase", "allButLast"],
  33093. referencedClasses: []
  33094. }),
  33095. smalltalk.FileServer.klass);
  33096. smalltalk.addMethod(
  33097. smalltalk.method({
  33098. selector: "createServerWithArguments:",
  33099. category: 'initialization',
  33100. fn: function (options){
  33101. var self=this;
  33102. var server,popFront,front,optionName,optionValue,switches;
  33103. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  33104. return smalltalk.withContext(function($ctx1) {
  33105. var $1,$2,$3,$4,$5;
  33106. var $early={};
  33107. try {
  33108. switches=self._commandLineSwitches();
  33109. server=self._new();
  33110. _st(options)._ifEmpty_((function(){
  33111. return smalltalk.withContext(function($ctx2) {
  33112. $1=server;
  33113. throw $early=[$1];
  33114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33115. $2=_st(_st(options)._size())._even();
  33116. if(! smalltalk.assert($2)){
  33117. _st(console)._log_("Using default parameters.");
  33118. _st(console)._log_("Wrong commandline options or not enough arguments for: ".__comma(options));
  33119. _st(console)._log_("Use any of the following ones: ".__comma(switches));
  33120. $3=server;
  33121. return $3;
  33122. };
  33123. popFront=(function(args){
  33124. return smalltalk.withContext(function($ctx2) {
  33125. front=_st(args)._first();
  33126. front;
  33127. _st(args)._remove_(front);
  33128. return front;
  33129. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})});
  33130. _st((function(){
  33131. return smalltalk.withContext(function($ctx2) {
  33132. return _st(options)._notEmpty();
  33133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  33134. return smalltalk.withContext(function($ctx2) {
  33135. optionName=_st(popFront)._value_(options);
  33136. optionName;
  33137. optionValue=_st(popFront)._value_(options);
  33138. optionValue;
  33139. $4=_st(switches)._includes_(optionName);
  33140. if(smalltalk.assert($4)){
  33141. optionName=self._selectorForCommandLineSwitch_(optionName);
  33142. optionName;
  33143. return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
  33144. } else {
  33145. _st(console)._log_(_st(optionName).__comma(" is not a valid commandline option"));
  33146. return _st(console)._log_("Use any of the following ones: ".__comma(switches));
  33147. };
  33148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33149. $5=server;
  33150. return $5;
  33151. }
  33152. catch(e) {if(e===$early)return e[0]; throw e}
  33153. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},smalltalk.FileServer.klass)})},
  33154. args: ["options"],
  33155. 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.",
  33156. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "log:", ",", "even", "size", "first", "remove:", "whileTrue:", "value:", "ifTrue:ifFalse:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:", "includes:", "notEmpty"],
  33157. referencedClasses: ["Array"]
  33158. }),
  33159. smalltalk.FileServer.klass);
  33160. smalltalk.addMethod(
  33161. smalltalk.method({
  33162. selector: "defaultHost",
  33163. category: 'accessing',
  33164. fn: function (){
  33165. var self=this;
  33166. return smalltalk.withContext(function($ctx1) {
  33167. return "127.0.0.1";
  33168. }, function($ctx1) {$ctx1.fill(self,"defaultHost",{},smalltalk.FileServer.klass)})},
  33169. args: [],
  33170. source: "defaultHost\x0a\x09^'127.0.0.1'",
  33171. messageSends: [],
  33172. referencedClasses: []
  33173. }),
  33174. smalltalk.FileServer.klass);
  33175. smalltalk.addMethod(
  33176. smalltalk.method({
  33177. selector: "defaultMimeTypes",
  33178. category: 'accessing',
  33179. fn: function (){
  33180. var self=this;
  33181. return smalltalk.withContext(function($ctx1) {
  33182. var $1;
  33183. $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")]);
  33184. return $1;
  33185. }, function($ctx1) {$ctx1.fill(self,"defaultMimeTypes",{},smalltalk.FileServer.klass)})},
  33186. args: [],
  33187. 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}",
  33188. messageSends: ["->"],
  33189. referencedClasses: []
  33190. }),
  33191. smalltalk.FileServer.klass);
  33192. smalltalk.addMethod(
  33193. smalltalk.method({
  33194. selector: "defaultPort",
  33195. category: 'accessing',
  33196. fn: function (){
  33197. var self=this;
  33198. return smalltalk.withContext(function($ctx1) {
  33199. return (4000);
  33200. }, function($ctx1) {$ctx1.fill(self,"defaultPort",{},smalltalk.FileServer.klass)})},
  33201. args: [],
  33202. source: "defaultPort\x0a\x09^4000",
  33203. messageSends: [],
  33204. referencedClasses: []
  33205. }),
  33206. smalltalk.FileServer.klass);
  33207. smalltalk.addMethod(
  33208. smalltalk.method({
  33209. selector: "main",
  33210. category: 'initialization',
  33211. fn: function (){
  33212. var self=this;
  33213. var fileServer,args;
  33214. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  33215. return smalltalk.withContext(function($ctx1) {
  33216. var $1,$2;
  33217. var $early={};
  33218. try {
  33219. args=_st(process)._argv();
  33220. _st(args)._removeFrom_to_((1),(3));
  33221. _st(args)._detect_ifNone_((function(each){
  33222. return smalltalk.withContext(function($ctx2) {
  33223. $1=_st(each).__eq("--help");
  33224. if(smalltalk.assert($1)){
  33225. return _st($FileServer())._printHelp();
  33226. };
  33227. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  33228. return smalltalk.withContext(function($ctx2) {
  33229. fileServer=_st($FileServer())._createServerWithArguments_(args);
  33230. fileServer;
  33231. $2=_st(fileServer)._start();
  33232. throw $early=[$2];
  33233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33234. return self}
  33235. catch(e) {if(e===$early)return e[0]; throw e}
  33236. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},smalltalk.FileServer.klass)})},
  33237. args: [],
  33238. 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]",
  33239. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "printHelp", "=", "createServerWithArguments:", "start"],
  33240. referencedClasses: ["FileServer"]
  33241. }),
  33242. smalltalk.FileServer.klass);
  33243. smalltalk.addMethod(
  33244. smalltalk.method({
  33245. selector: "mimeTypeFor:",
  33246. category: 'accessing',
  33247. fn: function (aString){
  33248. var self=this;
  33249. return smalltalk.withContext(function($ctx1) {
  33250. var $1;
  33251. $1=_st(self._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  33252. return smalltalk.withContext(function($ctx2) {
  33253. return "text/plain";
  33254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33255. return $1;
  33256. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},smalltalk.FileServer.klass)})},
  33257. args: ["aString"],
  33258. source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  33259. messageSends: ["at:ifAbsent:", "replace:with:", "mimeTypes"],
  33260. referencedClasses: []
  33261. }),
  33262. smalltalk.FileServer.klass);
  33263. smalltalk.addMethod(
  33264. smalltalk.method({
  33265. selector: "mimeTypes",
  33266. category: 'accessing',
  33267. fn: function (){
  33268. var self=this;
  33269. return smalltalk.withContext(function($ctx1) {
  33270. var $2,$1;
  33271. $2=self["@mimeTypes"];
  33272. if(($receiver = $2) == nil || $receiver == undefined){
  33273. self["@mimeTypes"]=self._defaultMimeTypes();
  33274. $1=self["@mimeTypes"];
  33275. } else {
  33276. $1=$2;
  33277. };
  33278. return $1;
  33279. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},smalltalk.FileServer.klass)})},
  33280. args: [],
  33281. source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  33282. messageSends: ["ifNil:", "defaultMimeTypes"],
  33283. referencedClasses: []
  33284. }),
  33285. smalltalk.FileServer.klass);
  33286. smalltalk.addMethod(
  33287. smalltalk.method({
  33288. selector: "printHelp",
  33289. category: 'accessing',
  33290. fn: function (){
  33291. var self=this;
  33292. return smalltalk.withContext(function($ctx1) {
  33293. _st(console)._log_("Available commandline options are:");
  33294. _st(console)._log_("--help");
  33295. _st(self._commandLineSwitches())._do_((function(each){
  33296. return smalltalk.withContext(function($ctx2) {
  33297. return _st(console)._log_(_st(each).__comma(" <parameter>"));
  33298. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  33299. return self}, function($ctx1) {$ctx1.fill(self,"printHelp",{},smalltalk.FileServer.klass)})},
  33300. args: [],
  33301. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  33302. messageSends: ["log:", "do:", ",", "commandLineSwitches"],
  33303. referencedClasses: []
  33304. }),
  33305. smalltalk.FileServer.klass);
  33306. smalltalk.addMethod(
  33307. smalltalk.method({
  33308. selector: "selectorForCommandLineSwitch:",
  33309. category: 'accessing',
  33310. fn: function (aSwitch){
  33311. var self=this;
  33312. return smalltalk.withContext(function($ctx1) {
  33313. var $1;
  33314. $1=_st(_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  33315. return smalltalk.withContext(function($ctx2) {
  33316. return _st(_st(each)._second())._asUppercase();
  33317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":");
  33318. return $1;
  33319. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},smalltalk.FileServer.klass)})},
  33320. args: ["aSwitch"],
  33321. 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 ]), ':'",
  33322. messageSends: [",", "replace:with:", "asUppercase", "second"],
  33323. referencedClasses: []
  33324. }),
  33325. smalltalk.FileServer.klass);
  33326. smalltalk.addClass('Repl', smalltalk.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  33327. 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.";
  33328. smalltalk.addMethod(
  33329. smalltalk.method({
  33330. selector: "addVariableNamed:to:",
  33331. category: 'private',
  33332. fn: function (aString,anObject){
  33333. var self=this;
  33334. var newClass,newObject;
  33335. return smalltalk.withContext(function($ctx1) {
  33336. var $1;
  33337. newClass=self._subclass_withVariable_(_st(anObject)._class(),aString);
  33338. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  33339. newObject=_st(newClass)._new();
  33340. self._setPreviousVariablesFor_from_(newObject,anObject);
  33341. $1=newObject;
  33342. return $1;
  33343. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},smalltalk.Repl)})},
  33344. args: ["aString", "anObject"],
  33345. 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",
  33346. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"],
  33347. referencedClasses: []
  33348. }),
  33349. smalltalk.Repl);
  33350. smalltalk.addMethod(
  33351. smalltalk.method({
  33352. selector: "assignNewVariable:do:",
  33353. category: 'private',
  33354. fn: function (buffer,aBlock){
  33355. var self=this;
  33356. return smalltalk.withContext(function($ctx1) {
  33357. var $2,$3,$5,$7,$6,$4,$1;
  33358. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  33359. var varName,value;
  33360. return smalltalk.withContext(function($ctx2) {
  33361. $2=name;
  33362. if(($receiver = $2) == nil || $receiver == undefined){
  33363. varName=self._nextResultName();
  33364. } else {
  33365. varName=$2;
  33366. };
  33367. varName;
  33368. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  33369. self["@session"];
  33370. $3=self;
  33371. $5=_st(varName).__comma(" := ");
  33372. $7=expr;
  33373. if(($receiver = $7) == nil || $receiver == undefined){
  33374. $6=buffer;
  33375. } else {
  33376. $6=$7;
  33377. };
  33378. $4=_st($5).__comma($6);
  33379. value=_st($3)._eval_on_($4,self["@session"]);
  33380. value;
  33381. return _st(aBlock)._value_value_(varName,value);
  33382. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1)})}));
  33383. return $1;
  33384. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},smalltalk.Repl)})},
  33385. args: ["buffer", "aBlock"],
  33386. 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]",
  33387. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "eval:on:", ",", "value:value:"],
  33388. referencedClasses: []
  33389. }),
  33390. smalltalk.Repl);
  33391. smalltalk.addMethod(
  33392. smalltalk.method({
  33393. selector: "clearScreen",
  33394. category: 'private',
  33395. fn: function (){
  33396. var self=this;
  33397. var esc,cls;
  33398. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  33399. return smalltalk.withContext(function($ctx1) {
  33400. esc=_st($String())._fromCharCode_((27));
  33401. cls=_st(_st(_st(esc).__comma("[2J")).__comma(esc)).__comma("[0;0f");
  33402. _st(_st(process)._stdout())._write_(cls);
  33403. _st(self["@interface"])._prompt();
  33404. return self}, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},smalltalk.Repl)})},
  33405. args: [],
  33406. 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",
  33407. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"],
  33408. referencedClasses: ["String"]
  33409. }),
  33410. smalltalk.Repl);
  33411. smalltalk.addMethod(
  33412. smalltalk.method({
  33413. selector: "close",
  33414. category: 'actions',
  33415. fn: function (){
  33416. var self=this;
  33417. return smalltalk.withContext(function($ctx1) {
  33418. _st(_st(process)._stdin())._destroy();
  33419. return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Repl)})},
  33420. args: [],
  33421. source: "close\x0a\x09process stdin destroy",
  33422. messageSends: ["destroy", "stdin"],
  33423. referencedClasses: []
  33424. }),
  33425. smalltalk.Repl);
  33426. smalltalk.addMethod(
  33427. smalltalk.method({
  33428. selector: "commands",
  33429. category: 'accessing',
  33430. fn: function (){
  33431. var self=this;
  33432. return smalltalk.withContext(function($ctx1) {
  33433. var $1;
  33434. $1=self["@commands"];
  33435. return $1;
  33436. }, function($ctx1) {$ctx1.fill(self,"commands",{},smalltalk.Repl)})},
  33437. args: [],
  33438. source: "commands\x0a\x09^ commands",
  33439. messageSends: [],
  33440. referencedClasses: []
  33441. }),
  33442. smalltalk.Repl);
  33443. smalltalk.addMethod(
  33444. smalltalk.method({
  33445. selector: "createInterface",
  33446. category: 'actions',
  33447. fn: function (){
  33448. var self=this;
  33449. return smalltalk.withContext(function($ctx1) {
  33450. var $1,$2;
  33451. self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout());
  33452. _st(self["@interface"])._on_do_("line",(function(buffer){
  33453. return smalltalk.withContext(function($ctx2) {
  33454. return self._processLine_(buffer);
  33455. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1)})}));
  33456. _st(self["@interface"])._on_do_("close",(function(){
  33457. return smalltalk.withContext(function($ctx2) {
  33458. return self._close();
  33459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33460. $1=self;
  33461. _st($1)._printWelcome();
  33462. _st($1)._setupHotkeys();
  33463. $2=_st($1)._setPrompt();
  33464. _st(self["@interface"])._prompt();
  33465. return self}, function($ctx1) {$ctx1.fill(self,"createInterface",{},smalltalk.Repl)})},
  33466. args: [],
  33467. 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",
  33468. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"],
  33469. referencedClasses: []
  33470. }),
  33471. smalltalk.Repl);
  33472. smalltalk.addMethod(
  33473. smalltalk.method({
  33474. selector: "encapsulateVariable:withValue:in:",
  33475. category: 'private',
  33476. fn: function (aString,anObject,aClass){
  33477. var self=this;
  33478. var compiler;
  33479. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  33480. return smalltalk.withContext(function($ctx1) {
  33481. compiler=_st($Compiler())._new();
  33482. _st(compiler)._install_forClass_category_(_st(_st(_st(aString).__comma(": anObject ^ ")).__comma(aString)).__comma(" := anObject"),aClass,"session");
  33483. _st(compiler)._install_forClass_category_(_st(_st(aString).__comma(" ^ ")).__comma(aString),aClass,"session");
  33484. return self}, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},smalltalk.Repl)})},
  33485. args: ["aString", "anObject", "aClass"],
  33486. 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'.",
  33487. messageSends: ["new", "install:forClass:category:", ","],
  33488. referencedClasses: ["Compiler"]
  33489. }),
  33490. smalltalk.Repl);
  33491. smalltalk.addMethod(
  33492. smalltalk.method({
  33493. selector: "eval:",
  33494. category: 'actions',
  33495. fn: function (buffer){
  33496. var self=this;
  33497. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  33498. return smalltalk.withContext(function($ctx1) {
  33499. var $1;
  33500. $1=self._eval_on_(buffer,_st($DoIt())._new());
  33501. return $1;
  33502. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},smalltalk.Repl)})},
  33503. args: ["buffer"],
  33504. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  33505. messageSends: ["eval:on:", "new"],
  33506. referencedClasses: ["DoIt"]
  33507. }),
  33508. smalltalk.Repl);
  33509. smalltalk.addMethod(
  33510. smalltalk.method({
  33511. selector: "eval:on:",
  33512. category: 'actions',
  33513. fn: function (buffer,anObject){
  33514. var self=this;
  33515. var result;
  33516. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  33517. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  33518. return smalltalk.withContext(function($ctx1) {
  33519. var $1,$2,$3;
  33520. $1=_st(buffer)._isEmpty();
  33521. if(! smalltalk.assert($1)){
  33522. self._try_catch_((function(){
  33523. return smalltalk.withContext(function($ctx2) {
  33524. result=_st(_st($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  33525. return result;
  33526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(e){
  33527. return smalltalk.withContext(function($ctx2) {
  33528. $2=_st(e)._isSmalltalkError();
  33529. if(smalltalk.assert($2)){
  33530. return _st(_st($ErrorHandler())._new())._handleError_(e);
  33531. } else {
  33532. return _st(_st(process)._stdout())._write_(_st(e)._jsStack());
  33533. };
  33534. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
  33535. };
  33536. $3=result;
  33537. return $3;
  33538. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},smalltalk.Repl)})},
  33539. args: ["buffer", "anObject"],
  33540. 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",
  33541. messageSends: ["ifFalse:", "try:catch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "handleError:", "write:", "jsStack", "stdout", "isSmalltalkError", "isEmpty"],
  33542. referencedClasses: ["Compiler", "ErrorHandler"]
  33543. }),
  33544. smalltalk.Repl);
  33545. smalltalk.addMethod(
  33546. smalltalk.method({
  33547. selector: "executeCommand:",
  33548. category: 'private',
  33549. fn: function (aString){
  33550. var self=this;
  33551. return smalltalk.withContext(function($ctx1) {
  33552. var $1;
  33553. var $early={};
  33554. try {
  33555. _st(self._commands())._keysAndValuesDo_((function(names,cmd){
  33556. return smalltalk.withContext(function($ctx2) {
  33557. $1=_st(names)._includes_(aString);
  33558. if(smalltalk.assert($1)){
  33559. _st(cmd)._value();
  33560. throw $early=[true];
  33561. };
  33562. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1)})}));
  33563. return false;
  33564. }
  33565. catch(e) {if(e===$early)return e[0]; throw e}
  33566. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},smalltalk.Repl)})},
  33567. args: ["aString"],
  33568. 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",
  33569. messageSends: ["keysAndValuesDo:", "ifTrue:", "value", "includes:", "commands"],
  33570. referencedClasses: []
  33571. }),
  33572. smalltalk.Repl);
  33573. smalltalk.addMethod(
  33574. smalltalk.method({
  33575. selector: "initialize",
  33576. category: 'initialization',
  33577. fn: function (){
  33578. var self=this;
  33579. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  33580. return smalltalk.withContext(function($ctx1) {
  33581. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  33582. self["@session"]=_st($DoIt())._new();
  33583. self["@readline"]=_st(require)._value_("readline");
  33584. self["@util"]=_st(require)._value_("util");
  33585. self._setupCommands();
  33586. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Repl)})},
  33587. args: [],
  33588. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  33589. messageSends: ["initialize", "new", "value:", "setupCommands"],
  33590. referencedClasses: ["DoIt"]
  33591. }),
  33592. smalltalk.Repl);
  33593. smalltalk.addMethod(
  33594. smalltalk.method({
  33595. selector: "instanceVariableNamesFor:",
  33596. category: 'private',
  33597. fn: function (aClass){
  33598. var self=this;
  33599. return smalltalk.withContext(function($ctx1) {
  33600. var $2,$1;
  33601. $2=_st(aClass)._superclass();
  33602. if(($receiver = $2) == nil || $receiver == undefined){
  33603. $1=_st(aClass)._instanceVariableNames();
  33604. } else {
  33605. $1=_st(_st(aClass)._instanceVariableNames())._copyWithAll_(self._instanceVariableNamesFor_(_st(aClass)._superclass()));
  33606. };
  33607. return $1;
  33608. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},smalltalk.Repl)})},
  33609. args: ["aClass"],
  33610. 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]",
  33611. messageSends: ["ifNotNil:ifNil:", "copyWithAll:", "instanceVariableNamesFor:", "superclass", "instanceVariableNames"],
  33612. referencedClasses: []
  33613. }),
  33614. smalltalk.Repl);
  33615. smalltalk.addMethod(
  33616. smalltalk.method({
  33617. selector: "isIdentifier:",
  33618. category: 'private',
  33619. fn: function (aString){
  33620. var self=this;
  33621. return smalltalk.withContext(function($ctx1) {
  33622. var $1;
  33623. $1=_st(aString)._match_("^[a-z_]\x5cw+$"._asRegexp());
  33624. return $1;
  33625. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},smalltalk.Repl)})},
  33626. args: ["aString"],
  33627. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw+$' asRegexp",
  33628. messageSends: ["match:", "asRegexp"],
  33629. referencedClasses: []
  33630. }),
  33631. smalltalk.Repl);
  33632. smalltalk.addMethod(
  33633. smalltalk.method({
  33634. selector: "isVariableDefined:",
  33635. category: 'private',
  33636. fn: function (aString){
  33637. var self=this;
  33638. return smalltalk.withContext(function($ctx1) {
  33639. var $1;
  33640. $1=_st(self._instanceVariableNamesFor_(_st(self["@session"])._class()))._includes_(aString);
  33641. return $1;
  33642. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},smalltalk.Repl)})},
  33643. args: ["aString"],
  33644. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  33645. messageSends: ["includes:", "instanceVariableNamesFor:", "class"],
  33646. referencedClasses: []
  33647. }),
  33648. smalltalk.Repl);
  33649. smalltalk.addMethod(
  33650. smalltalk.method({
  33651. selector: "nextResultName",
  33652. category: 'private',
  33653. fn: function (){
  33654. var self=this;
  33655. return smalltalk.withContext(function($ctx1) {
  33656. var $1,$2;
  33657. $1=self["@resultCount"];
  33658. if(($receiver = $1) == nil || $receiver == undefined){
  33659. self["@resultCount"]=(1);
  33660. } else {
  33661. self["@resultCount"]=_st(self["@resultCount"]).__plus((1));
  33662. };
  33663. $2="res".__comma(_st(self["@resultCount"])._asString());
  33664. return $2;
  33665. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},smalltalk.Repl)})},
  33666. args: [],
  33667. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  33668. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"],
  33669. referencedClasses: []
  33670. }),
  33671. smalltalk.Repl);
  33672. smalltalk.addMethod(
  33673. smalltalk.method({
  33674. selector: "onKeyPress:",
  33675. category: 'private',
  33676. fn: function (key){
  33677. var self=this;
  33678. return smalltalk.withContext(function($ctx1) {
  33679. var $1;
  33680. $1=_st(_st(key)._ctrl())._and_((function(){
  33681. return smalltalk.withContext(function($ctx2) {
  33682. return _st(_st(key)._name()).__eq("l");
  33683. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33684. if(smalltalk.assert($1)){
  33685. self._clearScreen();
  33686. };
  33687. return self}, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},smalltalk.Repl)})},
  33688. args: ["key"],
  33689. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  33690. messageSends: ["ifTrue:", "clearScreen", "and:", "=", "name", "ctrl"],
  33691. referencedClasses: []
  33692. }),
  33693. smalltalk.Repl);
  33694. smalltalk.addMethod(
  33695. smalltalk.method({
  33696. selector: "parseAssignment:do:",
  33697. category: 'private',
  33698. fn: function (aString,aBlock){
  33699. var self=this;
  33700. var assignment;
  33701. return smalltalk.withContext(function($ctx1) {
  33702. var $2,$1;
  33703. assignment=_st(_st(aString)._tokenize_(":="))._collect_((function(s){
  33704. return smalltalk.withContext(function($ctx2) {
  33705. return _st(s)._trimBoth();
  33706. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1)})}));
  33707. $2=_st(_st(_st(assignment)._size()).__eq((2)))._and_((function(){
  33708. return smalltalk.withContext(function($ctx2) {
  33709. return self._isIdentifier_(_st(assignment)._first());
  33710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33711. if(smalltalk.assert($2)){
  33712. $1=_st(aBlock)._value_value_(_st(assignment)._first(),_st(assignment)._last());
  33713. } else {
  33714. $1=_st(aBlock)._value_value_(nil,nil);
  33715. };
  33716. return $1;
  33717. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},smalltalk.Repl)})},
  33718. args: ["aString", "aBlock"],
  33719. 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]",
  33720. messageSends: ["collect:", "trimBoth", "tokenize:", "ifTrue:ifFalse:", "value:value:", "first", "last", "and:", "isIdentifier:", "=", "size"],
  33721. referencedClasses: []
  33722. }),
  33723. smalltalk.Repl);
  33724. smalltalk.addMethod(
  33725. smalltalk.method({
  33726. selector: "presentResultNamed:withValue:",
  33727. category: 'private',
  33728. fn: function (varName,value){
  33729. var self=this;
  33730. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  33731. return smalltalk.withContext(function($ctx1) {
  33732. var $1,$2;
  33733. $1=$Transcript();
  33734. _st($1)._show_(_st(_st(_st(_st(varName).__comma(": ")).__comma(_st(_st(value)._class())._name())).__comma(" = ")).__comma(_st(value)._asString()));
  33735. $2=_st($1)._cr();
  33736. _st(self["@interface"])._prompt();
  33737. return self}, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},smalltalk.Repl)})},
  33738. args: ["varName", "value"],
  33739. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  33740. messageSends: ["show:", ",", "asString", "name", "class", "cr", "prompt"],
  33741. referencedClasses: ["Transcript"]
  33742. }),
  33743. smalltalk.Repl);
  33744. smalltalk.addMethod(
  33745. smalltalk.method({
  33746. selector: "printWelcome",
  33747. category: 'private',
  33748. fn: function (){
  33749. var self=this;
  33750. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  33751. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  33752. return smalltalk.withContext(function($ctx1) {
  33753. var $1,$2;
  33754. _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(")."));
  33755. $1=$Transcript();
  33756. _st($1)._show_("Type :q to exit.");
  33757. $2=_st($1)._cr();
  33758. return self}, function($ctx1) {$ctx1.fill(self,"printWelcome",{},smalltalk.Repl)})},
  33759. args: [],
  33760. source: "printWelcome\x0a\x09Transcript show: 'Welcome to Amber version ', Smalltalk current version, ' (NodeJS ', process versions node, ').'.\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  33761. messageSends: ["show:", ",", "node", "versions", "version", "current", "cr"],
  33762. referencedClasses: ["Smalltalk", "Transcript"]
  33763. }),
  33764. smalltalk.Repl);
  33765. smalltalk.addMethod(
  33766. smalltalk.method({
  33767. selector: "processLine:",
  33768. category: 'private',
  33769. fn: function (buffer){
  33770. var self=this;
  33771. var show;
  33772. return smalltalk.withContext(function($ctx1) {
  33773. var $1,$2;
  33774. show=(function(varName,value){
  33775. return smalltalk.withContext(function($ctx2) {
  33776. return self._presentResultNamed_withValue_(varName,value);
  33777. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1)})});
  33778. $1=self._executeCommand_(buffer);
  33779. if(! smalltalk.assert($1)){
  33780. $2=self._isVariableDefined_(buffer);
  33781. if(smalltalk.assert($2)){
  33782. _st(show)._value_value_(buffer,_st(self["@session"])._perform_(buffer));
  33783. } else {
  33784. self._assignNewVariable_do_(buffer,show);
  33785. };
  33786. };
  33787. return self}, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},smalltalk.Repl)})},
  33788. args: ["buffer"],
  33789. 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]]",
  33790. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "ifTrue:ifFalse:", "value:value:", "perform:", "assignNewVariable:do:", "isVariableDefined:", "executeCommand:"],
  33791. referencedClasses: []
  33792. }),
  33793. smalltalk.Repl);
  33794. smalltalk.addMethod(
  33795. smalltalk.method({
  33796. selector: "prompt",
  33797. category: 'accessing',
  33798. fn: function (){
  33799. var self=this;
  33800. return smalltalk.withContext(function($ctx1) {
  33801. return "amber >> ";
  33802. }, function($ctx1) {$ctx1.fill(self,"prompt",{},smalltalk.Repl)})},
  33803. args: [],
  33804. source: "prompt\x0a\x09^'amber >> '",
  33805. messageSends: [],
  33806. referencedClasses: []
  33807. }),
  33808. smalltalk.Repl);
  33809. smalltalk.addMethod(
  33810. smalltalk.method({
  33811. selector: "setPreviousVariablesFor:from:",
  33812. category: 'private',
  33813. fn: function (newObject,oldObject){
  33814. var self=this;
  33815. return smalltalk.withContext(function($ctx1) {
  33816. _st(self._instanceVariableNamesFor_(_st(oldObject)._class()))._do_((function(each){
  33817. return smalltalk.withContext(function($ctx2) {
  33818. return _st(newObject)._perform_withArguments_(_st(each).__comma(":"),[_st(oldObject)._perform_(each)]);
  33819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  33820. return self}, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},smalltalk.Repl)})},
  33821. args: ["newObject", "oldObject"],
  33822. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  33823. messageSends: ["do:", "perform:withArguments:", ",", "perform:", "instanceVariableNamesFor:", "class"],
  33824. referencedClasses: []
  33825. }),
  33826. smalltalk.Repl);
  33827. smalltalk.addMethod(
  33828. smalltalk.method({
  33829. selector: "setPrompt",
  33830. category: 'actions',
  33831. fn: function (){
  33832. var self=this;
  33833. return smalltalk.withContext(function($ctx1) {
  33834. _st(self["@interface"])._setPrompt_(self._prompt());
  33835. return self}, function($ctx1) {$ctx1.fill(self,"setPrompt",{},smalltalk.Repl)})},
  33836. args: [],
  33837. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  33838. messageSends: ["setPrompt:", "prompt"],
  33839. referencedClasses: []
  33840. }),
  33841. smalltalk.Repl);
  33842. smalltalk.addMethod(
  33843. smalltalk.method({
  33844. selector: "setupCommands",
  33845. category: 'initialization',
  33846. fn: function (){
  33847. var self=this;
  33848. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  33849. return smalltalk.withContext(function($ctx1) {
  33850. self["@commands"]=_st($Dictionary())._from_([_st([":q"]).__minus_gt((function(){
  33851. return smalltalk.withContext(function($ctx2) {
  33852. return _st(process)._exit();
  33853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),_st([""]).__minus_gt((function(){
  33854. return smalltalk.withContext(function($ctx2) {
  33855. return _st(self["@interface"])._prompt();
  33856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]);
  33857. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{},smalltalk.Repl)})},
  33858. args: [],
  33859. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  33860. messageSends: ["from:", "->", "exit", "prompt"],
  33861. referencedClasses: ["Dictionary"]
  33862. }),
  33863. smalltalk.Repl);
  33864. smalltalk.addMethod(
  33865. smalltalk.method({
  33866. selector: "setupHotkeys",
  33867. category: 'initialization',
  33868. fn: function (){
  33869. var self=this;
  33870. return smalltalk.withContext(function($ctx1) {
  33871. var $1;
  33872. _st(_st(process)._stdin())._on_do_("keypress",(function(s,key){
  33873. return smalltalk.withContext(function($ctx2) {
  33874. $1=key;
  33875. if(($receiver = $1) == nil || $receiver == undefined){
  33876. return $1;
  33877. } else {
  33878. return self._onKeyPress_(key);
  33879. };
  33880. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1)})}));
  33881. return self}, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},smalltalk.Repl)})},
  33882. args: [],
  33883. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  33884. messageSends: ["on:do:", "ifNotNil:", "onKeyPress:", "stdin"],
  33885. referencedClasses: []
  33886. }),
  33887. smalltalk.Repl);
  33888. smalltalk.addMethod(
  33889. smalltalk.method({
  33890. selector: "subclass:withVariable:",
  33891. category: 'private',
  33892. fn: function (aClass,varName){
  33893. var self=this;
  33894. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  33895. return smalltalk.withContext(function($ctx1) {
  33896. var $1;
  33897. $1=_st(_st($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,_st(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  33898. return $1;
  33899. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},smalltalk.Repl)})},
  33900. args: ["aClass", "varName"],
  33901. 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'",
  33902. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "asSymbol", "subclassNameFor:", "new"],
  33903. referencedClasses: ["ClassBuilder"]
  33904. }),
  33905. smalltalk.Repl);
  33906. smalltalk.addMethod(
  33907. smalltalk.method({
  33908. selector: "subclassNameFor:",
  33909. category: 'private',
  33910. fn: function (aClass){
  33911. var self=this;
  33912. return smalltalk.withContext(function($ctx1) {
  33913. var $2,$1;
  33914. $2=_st(_st(aClass)._name())._matchesOf_("\x5cd+$");
  33915. if(($receiver = $2) == nil || $receiver == undefined){
  33916. $1=_st(_st(aClass)._name()).__comma("2");
  33917. } else {
  33918. var counter;
  33919. counter=_st(_st(_st(_st(_st(aClass)._name())._matchesOf_("\x5cd+$"))._first())._asNumber()).__plus((1));
  33920. counter;
  33921. $1=_st(_st(aClass)._name())._replaceRegexp_with_("\x5cd+$"._asRegexp(),_st(counter)._asString());
  33922. };
  33923. return $1;
  33924. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},smalltalk.Repl)})},
  33925. args: ["aClass"],
  33926. 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'].",
  33927. messageSends: ["ifNotNil:ifNil:", "+", "asNumber", "first", "matchesOf:", "name", "replaceRegexp:with:", "asRegexp", "asString", ","],
  33928. referencedClasses: []
  33929. }),
  33930. smalltalk.Repl);
  33931. smalltalk.addMethod(
  33932. smalltalk.method({
  33933. selector: "main",
  33934. category: 'initialization',
  33935. fn: function (){
  33936. var self=this;
  33937. return smalltalk.withContext(function($ctx1) {
  33938. _st(self._new())._createInterface();
  33939. return self}, function($ctx1) {$ctx1.fill(self,"main",{},smalltalk.Repl.klass)})},
  33940. args: [],
  33941. source: "main\x0a\x09self new createInterface",
  33942. messageSends: ["createInterface", "new"],
  33943. referencedClasses: []
  33944. }),
  33945. smalltalk.Repl.klass);
  33946. (function () {
  33947. var inBrowser = typeof amber !== "undefined" && typeof amber.load === "function";
  33948. function init() {
  33949. smalltalk.initialize();
  33950. /* Similar to jQuery(document).ready() */
  33951. if (inBrowser && amber.smalltalkReady) {
  33952. amber.smalltalkReady();
  33953. }
  33954. }
  33955. if (inBrowser) {
  33956. // init is lengthy process done in JavaScript.
  33957. // setTimeout here postpones it, so DOM ready
  33958. // event can occur sooner, thus load process
  33959. // may appear optically faster.
  33960. setTimeout(init, 0);
  33961. } else {
  33962. // In certain configurations, setTimeout is not feasible.
  33963. // It is mainly for `amberc`-produced concatenated
  33964. // node.js programs. There, the actual "main" appears
  33965. // immediately after init, so it must happens synchronously.
  33966. init();
  33967. }
  33968. })();smalltalk.AmberCli._main()