amber-cli.js 2.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. // This file is used to make additional changes
  8. // when building an app to run in node.js.
  9. // Free to edit. You can break tests (cli test runner uses
  10. // this to build itself - it is a node executable).
  11. define("amber/Platform", ["amber_core/Platform-Node"], {});
  12. define("amber/compatibility", ["amber/node-compatibility"], {});
  13. define("jquery", {});
  14. define("config-node", function(){});
  15. define('amber/brikz',[], function () {
  16. return function Brikz(api, apiKey, initKey) {
  17. "use strict";
  18. //jshint eqnull:true
  19. var brikz = this,
  20. backup = {};
  21. apiKey = apiKey || 'exports';
  22. initKey = initKey || '__init__';
  23. function mixin(src, target, what) {
  24. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  25. if (src == null) {
  26. target[keys[i]] = undefined;
  27. } else {
  28. var value = src[keys[i]];
  29. if (typeof value !== "undefined") {
  30. target[keys[i]] = value;
  31. }
  32. }
  33. }
  34. return target;
  35. }
  36. Object.defineProperties(this, {
  37. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  38. });
  39. var exclude = mixin(this, {});
  40. this.rebuild = function () {
  41. Object.keys(backup).forEach(function (key) {
  42. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  43. });
  44. var oapi = mixin(api, {}),
  45. order = [],
  46. chk = {};
  47. function ensure(key) {
  48. if (key in exclude) {
  49. return null;
  50. }
  51. var b = brikz[key],
  52. bak = backup[key];
  53. mixin(null, api, api);
  54. while (typeof b === "function") {
  55. (b.deps || []).forEach(ensure);
  56. b = new b(brikz, api, bak);
  57. }
  58. brikz[key] = b;
  59. if (b && !chk[key]) {
  60. chk[key] = true;
  61. order.push(b);
  62. }
  63. if (b && !b[apiKey]) {
  64. b[apiKey] = mixin(api, {});
  65. }
  66. }
  67. Object.keys(brikz).forEach(ensure);
  68. mixin(oapi, mixin(null, api, api));
  69. order.forEach(function (brik) {
  70. mixin(brik[apiKey] || {}, api);
  71. });
  72. order.forEach(function (brik) {
  73. if (brik[initKey]) {
  74. brik[initKey]();
  75. if (brik[initKey].once) {
  76. delete brik[initKey];
  77. }
  78. }
  79. });
  80. backup = mixin(brikz, {});
  81. };
  82. };
  83. });
  84. /*!
  85. * @overview es6-promise - a tiny implementation of Promises/A+.
  86. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  87. * @license Licensed under MIT license
  88. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  89. * @version 3.3.1
  90. */
  91. (function (global, factory) {
  92. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  93. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  94. (global.ES6Promise = factory());
  95. }(this, (function () { 'use strict';
  96. function objectOrFunction(x) {
  97. return typeof x === 'function' || typeof x === 'object' && x !== null;
  98. }
  99. function isFunction(x) {
  100. return typeof x === 'function';
  101. }
  102. var _isArray = undefined;
  103. if (!Array.isArray) {
  104. _isArray = function (x) {
  105. return Object.prototype.toString.call(x) === '[object Array]';
  106. };
  107. } else {
  108. _isArray = Array.isArray;
  109. }
  110. var isArray = _isArray;
  111. var len = 0;
  112. var vertxNext = undefined;
  113. var customSchedulerFn = undefined;
  114. var asap = function asap(callback, arg) {
  115. queue[len] = callback;
  116. queue[len + 1] = arg;
  117. len += 2;
  118. if (len === 2) {
  119. // If len is 2, that means that we need to schedule an async flush.
  120. // If additional callbacks are queued before the queue is flushed, they
  121. // will be processed by this flush that we are scheduling.
  122. if (customSchedulerFn) {
  123. customSchedulerFn(flush);
  124. } else {
  125. scheduleFlush();
  126. }
  127. }
  128. };
  129. function setScheduler(scheduleFn) {
  130. customSchedulerFn = scheduleFn;
  131. }
  132. function setAsap(asapFn) {
  133. asap = asapFn;
  134. }
  135. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  136. var browserGlobal = browserWindow || {};
  137. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  138. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
  139. // test for web worker but not in IE10
  140. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  141. // node
  142. function useNextTick() {
  143. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  144. // see https://github.com/cujojs/when/issues/410 for details
  145. return function () {
  146. return process.nextTick(flush);
  147. };
  148. }
  149. // vertx
  150. function useVertxTimer() {
  151. return function () {
  152. vertxNext(flush);
  153. };
  154. }
  155. function useMutationObserver() {
  156. var iterations = 0;
  157. var observer = new BrowserMutationObserver(flush);
  158. var node = document.createTextNode('');
  159. observer.observe(node, { characterData: true });
  160. return function () {
  161. node.data = iterations = ++iterations % 2;
  162. };
  163. }
  164. // web worker
  165. function useMessageChannel() {
  166. var channel = new MessageChannel();
  167. channel.port1.onmessage = flush;
  168. return function () {
  169. return channel.port2.postMessage(0);
  170. };
  171. }
  172. function useSetTimeout() {
  173. // Store setTimeout reference so es6-promise will be unaffected by
  174. // other code modifying setTimeout (like sinon.useFakeTimers())
  175. var globalSetTimeout = setTimeout;
  176. return function () {
  177. return globalSetTimeout(flush, 1);
  178. };
  179. }
  180. var queue = new Array(1000);
  181. function flush() {
  182. for (var i = 0; i < len; i += 2) {
  183. var callback = queue[i];
  184. var arg = queue[i + 1];
  185. callback(arg);
  186. queue[i] = undefined;
  187. queue[i + 1] = undefined;
  188. }
  189. len = 0;
  190. }
  191. function attemptVertx() {
  192. try {
  193. var r = require;
  194. var vertx = r('vertx');
  195. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  196. return useVertxTimer();
  197. } catch (e) {
  198. return useSetTimeout();
  199. }
  200. }
  201. var scheduleFlush = undefined;
  202. // Decide what async method to use to triggering processing of queued callbacks:
  203. if (isNode) {
  204. scheduleFlush = useNextTick();
  205. } else if (BrowserMutationObserver) {
  206. scheduleFlush = useMutationObserver();
  207. } else if (isWorker) {
  208. scheduleFlush = useMessageChannel();
  209. } else if (browserWindow === undefined && typeof require === 'function') {
  210. scheduleFlush = attemptVertx();
  211. } else {
  212. scheduleFlush = useSetTimeout();
  213. }
  214. function then(onFulfillment, onRejection) {
  215. var _arguments = arguments;
  216. var parent = this;
  217. var child = new this.constructor(noop);
  218. if (child[PROMISE_ID] === undefined) {
  219. makePromise(child);
  220. }
  221. var _state = parent._state;
  222. if (_state) {
  223. (function () {
  224. var callback = _arguments[_state - 1];
  225. asap(function () {
  226. return invokeCallback(_state, child, callback, parent._result);
  227. });
  228. })();
  229. } else {
  230. subscribe(parent, child, onFulfillment, onRejection);
  231. }
  232. return child;
  233. }
  234. /**
  235. `Promise.resolve` returns a promise that will become resolved with the
  236. passed `value`. It is shorthand for the following:
  237. ```javascript
  238. let promise = new Promise(function(resolve, reject){
  239. resolve(1);
  240. });
  241. promise.then(function(value){
  242. // value === 1
  243. });
  244. ```
  245. Instead of writing the above, your code now simply becomes the following:
  246. ```javascript
  247. let promise = Promise.resolve(1);
  248. promise.then(function(value){
  249. // value === 1
  250. });
  251. ```
  252. @method resolve
  253. @static
  254. @param {Any} value value that the returned promise will be resolved with
  255. Useful for tooling.
  256. @return {Promise} a promise that will become fulfilled with the given
  257. `value`
  258. */
  259. function resolve(object) {
  260. /*jshint validthis:true */
  261. var Constructor = this;
  262. if (object && typeof object === 'object' && object.constructor === Constructor) {
  263. return object;
  264. }
  265. var promise = new Constructor(noop);
  266. _resolve(promise, object);
  267. return promise;
  268. }
  269. var PROMISE_ID = Math.random().toString(36).substring(16);
  270. function noop() {}
  271. var PENDING = void 0;
  272. var FULFILLED = 1;
  273. var REJECTED = 2;
  274. var GET_THEN_ERROR = new ErrorObject();
  275. function selfFulfillment() {
  276. return new TypeError("You cannot resolve a promise with itself");
  277. }
  278. function cannotReturnOwn() {
  279. return new TypeError('A promises callback cannot return that same promise.');
  280. }
  281. function getThen(promise) {
  282. try {
  283. return promise.then;
  284. } catch (error) {
  285. GET_THEN_ERROR.error = error;
  286. return GET_THEN_ERROR;
  287. }
  288. }
  289. function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  290. try {
  291. then.call(value, fulfillmentHandler, rejectionHandler);
  292. } catch (e) {
  293. return e;
  294. }
  295. }
  296. function handleForeignThenable(promise, thenable, then) {
  297. asap(function (promise) {
  298. var sealed = false;
  299. var error = tryThen(then, thenable, function (value) {
  300. if (sealed) {
  301. return;
  302. }
  303. sealed = true;
  304. if (thenable !== value) {
  305. _resolve(promise, value);
  306. } else {
  307. fulfill(promise, value);
  308. }
  309. }, function (reason) {
  310. if (sealed) {
  311. return;
  312. }
  313. sealed = true;
  314. _reject(promise, reason);
  315. }, 'Settle: ' + (promise._label || ' unknown promise'));
  316. if (!sealed && error) {
  317. sealed = true;
  318. _reject(promise, error);
  319. }
  320. }, promise);
  321. }
  322. function handleOwnThenable(promise, thenable) {
  323. if (thenable._state === FULFILLED) {
  324. fulfill(promise, thenable._result);
  325. } else if (thenable._state === REJECTED) {
  326. _reject(promise, thenable._result);
  327. } else {
  328. subscribe(thenable, undefined, function (value) {
  329. return _resolve(promise, value);
  330. }, function (reason) {
  331. return _reject(promise, reason);
  332. });
  333. }
  334. }
  335. function handleMaybeThenable(promise, maybeThenable, then$$) {
  336. if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
  337. handleOwnThenable(promise, maybeThenable);
  338. } else {
  339. if (then$$ === GET_THEN_ERROR) {
  340. _reject(promise, GET_THEN_ERROR.error);
  341. } else if (then$$ === undefined) {
  342. fulfill(promise, maybeThenable);
  343. } else if (isFunction(then$$)) {
  344. handleForeignThenable(promise, maybeThenable, then$$);
  345. } else {
  346. fulfill(promise, maybeThenable);
  347. }
  348. }
  349. }
  350. function _resolve(promise, value) {
  351. if (promise === value) {
  352. _reject(promise, selfFulfillment());
  353. } else if (objectOrFunction(value)) {
  354. handleMaybeThenable(promise, value, getThen(value));
  355. } else {
  356. fulfill(promise, value);
  357. }
  358. }
  359. function publishRejection(promise) {
  360. if (promise._onerror) {
  361. promise._onerror(promise._result);
  362. }
  363. publish(promise);
  364. }
  365. function fulfill(promise, value) {
  366. if (promise._state !== PENDING) {
  367. return;
  368. }
  369. promise._result = value;
  370. promise._state = FULFILLED;
  371. if (promise._subscribers.length !== 0) {
  372. asap(publish, promise);
  373. }
  374. }
  375. function _reject(promise, reason) {
  376. if (promise._state !== PENDING) {
  377. return;
  378. }
  379. promise._state = REJECTED;
  380. promise._result = reason;
  381. asap(publishRejection, promise);
  382. }
  383. function subscribe(parent, child, onFulfillment, onRejection) {
  384. var _subscribers = parent._subscribers;
  385. var length = _subscribers.length;
  386. parent._onerror = null;
  387. _subscribers[length] = child;
  388. _subscribers[length + FULFILLED] = onFulfillment;
  389. _subscribers[length + REJECTED] = onRejection;
  390. if (length === 0 && parent._state) {
  391. asap(publish, parent);
  392. }
  393. }
  394. function publish(promise) {
  395. var subscribers = promise._subscribers;
  396. var settled = promise._state;
  397. if (subscribers.length === 0) {
  398. return;
  399. }
  400. var child = undefined,
  401. callback = undefined,
  402. detail = promise._result;
  403. for (var i = 0; i < subscribers.length; i += 3) {
  404. child = subscribers[i];
  405. callback = subscribers[i + settled];
  406. if (child) {
  407. invokeCallback(settled, child, callback, detail);
  408. } else {
  409. callback(detail);
  410. }
  411. }
  412. promise._subscribers.length = 0;
  413. }
  414. function ErrorObject() {
  415. this.error = null;
  416. }
  417. var TRY_CATCH_ERROR = new ErrorObject();
  418. function tryCatch(callback, detail) {
  419. try {
  420. return callback(detail);
  421. } catch (e) {
  422. TRY_CATCH_ERROR.error = e;
  423. return TRY_CATCH_ERROR;
  424. }
  425. }
  426. function invokeCallback(settled, promise, callback, detail) {
  427. var hasCallback = isFunction(callback),
  428. value = undefined,
  429. error = undefined,
  430. succeeded = undefined,
  431. failed = undefined;
  432. if (hasCallback) {
  433. value = tryCatch(callback, detail);
  434. if (value === TRY_CATCH_ERROR) {
  435. failed = true;
  436. error = value.error;
  437. value = null;
  438. } else {
  439. succeeded = true;
  440. }
  441. if (promise === value) {
  442. _reject(promise, cannotReturnOwn());
  443. return;
  444. }
  445. } else {
  446. value = detail;
  447. succeeded = true;
  448. }
  449. if (promise._state !== PENDING) {
  450. // noop
  451. } else if (hasCallback && succeeded) {
  452. _resolve(promise, value);
  453. } else if (failed) {
  454. _reject(promise, error);
  455. } else if (settled === FULFILLED) {
  456. fulfill(promise, value);
  457. } else if (settled === REJECTED) {
  458. _reject(promise, value);
  459. }
  460. }
  461. function initializePromise(promise, resolver) {
  462. try {
  463. resolver(function resolvePromise(value) {
  464. _resolve(promise, value);
  465. }, function rejectPromise(reason) {
  466. _reject(promise, reason);
  467. });
  468. } catch (e) {
  469. _reject(promise, e);
  470. }
  471. }
  472. var id = 0;
  473. function nextId() {
  474. return id++;
  475. }
  476. function makePromise(promise) {
  477. promise[PROMISE_ID] = id++;
  478. promise._state = undefined;
  479. promise._result = undefined;
  480. promise._subscribers = [];
  481. }
  482. function Enumerator(Constructor, input) {
  483. this._instanceConstructor = Constructor;
  484. this.promise = new Constructor(noop);
  485. if (!this.promise[PROMISE_ID]) {
  486. makePromise(this.promise);
  487. }
  488. if (isArray(input)) {
  489. this._input = input;
  490. this.length = input.length;
  491. this._remaining = input.length;
  492. this._result = new Array(this.length);
  493. if (this.length === 0) {
  494. fulfill(this.promise, this._result);
  495. } else {
  496. this.length = this.length || 0;
  497. this._enumerate();
  498. if (this._remaining === 0) {
  499. fulfill(this.promise, this._result);
  500. }
  501. }
  502. } else {
  503. _reject(this.promise, validationError());
  504. }
  505. }
  506. function validationError() {
  507. return new Error('Array Methods must be provided an Array');
  508. };
  509. Enumerator.prototype._enumerate = function () {
  510. var length = this.length;
  511. var _input = this._input;
  512. for (var i = 0; this._state === PENDING && i < length; i++) {
  513. this._eachEntry(_input[i], i);
  514. }
  515. };
  516. Enumerator.prototype._eachEntry = function (entry, i) {
  517. var c = this._instanceConstructor;
  518. var resolve$$ = c.resolve;
  519. if (resolve$$ === resolve) {
  520. var _then = getThen(entry);
  521. if (_then === then && entry._state !== PENDING) {
  522. this._settledAt(entry._state, i, entry._result);
  523. } else if (typeof _then !== 'function') {
  524. this._remaining--;
  525. this._result[i] = entry;
  526. } else if (c === Promise) {
  527. var promise = new c(noop);
  528. handleMaybeThenable(promise, entry, _then);
  529. this._willSettleAt(promise, i);
  530. } else {
  531. this._willSettleAt(new c(function (resolve$$) {
  532. return resolve$$(entry);
  533. }), i);
  534. }
  535. } else {
  536. this._willSettleAt(resolve$$(entry), i);
  537. }
  538. };
  539. Enumerator.prototype._settledAt = function (state, i, value) {
  540. var promise = this.promise;
  541. if (promise._state === PENDING) {
  542. this._remaining--;
  543. if (state === REJECTED) {
  544. _reject(promise, value);
  545. } else {
  546. this._result[i] = value;
  547. }
  548. }
  549. if (this._remaining === 0) {
  550. fulfill(promise, this._result);
  551. }
  552. };
  553. Enumerator.prototype._willSettleAt = function (promise, i) {
  554. var enumerator = this;
  555. subscribe(promise, undefined, function (value) {
  556. return enumerator._settledAt(FULFILLED, i, value);
  557. }, function (reason) {
  558. return enumerator._settledAt(REJECTED, i, reason);
  559. });
  560. };
  561. /**
  562. `Promise.all` accepts an array of promises, and returns a new promise which
  563. is fulfilled with an array of fulfillment values for the passed promises, or
  564. rejected with the reason of the first passed promise to be rejected. It casts all
  565. elements of the passed iterable to promises as it runs this algorithm.
  566. Example:
  567. ```javascript
  568. let promise1 = resolve(1);
  569. let promise2 = resolve(2);
  570. let promise3 = resolve(3);
  571. let promises = [ promise1, promise2, promise3 ];
  572. Promise.all(promises).then(function(array){
  573. // The array here would be [ 1, 2, 3 ];
  574. });
  575. ```
  576. If any of the `promises` given to `all` are rejected, the first promise
  577. that is rejected will be given as an argument to the returned promises's
  578. rejection handler. For example:
  579. Example:
  580. ```javascript
  581. let promise1 = resolve(1);
  582. let promise2 = reject(new Error("2"));
  583. let promise3 = reject(new Error("3"));
  584. let promises = [ promise1, promise2, promise3 ];
  585. Promise.all(promises).then(function(array){
  586. // Code here never runs because there are rejected promises!
  587. }, function(error) {
  588. // error.message === "2"
  589. });
  590. ```
  591. @method all
  592. @static
  593. @param {Array} entries array of promises
  594. @param {String} label optional string for labeling the promise.
  595. Useful for tooling.
  596. @return {Promise} promise that is fulfilled when all `promises` have been
  597. fulfilled, or rejected if any of them become rejected.
  598. @static
  599. */
  600. function all(entries) {
  601. return new Enumerator(this, entries).promise;
  602. }
  603. /**
  604. `Promise.race` returns a new promise which is settled in the same way as the
  605. first passed promise to settle.
  606. Example:
  607. ```javascript
  608. let promise1 = new Promise(function(resolve, reject){
  609. setTimeout(function(){
  610. resolve('promise 1');
  611. }, 200);
  612. });
  613. let promise2 = new Promise(function(resolve, reject){
  614. setTimeout(function(){
  615. resolve('promise 2');
  616. }, 100);
  617. });
  618. Promise.race([promise1, promise2]).then(function(result){
  619. // result === 'promise 2' because it was resolved before promise1
  620. // was resolved.
  621. });
  622. ```
  623. `Promise.race` is deterministic in that only the state of the first
  624. settled promise matters. For example, even if other promises given to the
  625. `promises` array argument are resolved, but the first settled promise has
  626. become rejected before the other promises became fulfilled, the returned
  627. promise will become rejected:
  628. ```javascript
  629. let promise1 = new Promise(function(resolve, reject){
  630. setTimeout(function(){
  631. resolve('promise 1');
  632. }, 200);
  633. });
  634. let promise2 = new Promise(function(resolve, reject){
  635. setTimeout(function(){
  636. reject(new Error('promise 2'));
  637. }, 100);
  638. });
  639. Promise.race([promise1, promise2]).then(function(result){
  640. // Code here never runs
  641. }, function(reason){
  642. // reason.message === 'promise 2' because promise 2 became rejected before
  643. // promise 1 became fulfilled
  644. });
  645. ```
  646. An example real-world use case is implementing timeouts:
  647. ```javascript
  648. Promise.race([ajax('foo.json'), timeout(5000)])
  649. ```
  650. @method race
  651. @static
  652. @param {Array} promises array of promises to observe
  653. Useful for tooling.
  654. @return {Promise} a promise which settles in the same way as the first passed
  655. promise to settle.
  656. */
  657. function race(entries) {
  658. /*jshint validthis:true */
  659. var Constructor = this;
  660. if (!isArray(entries)) {
  661. return new Constructor(function (_, reject) {
  662. return reject(new TypeError('You must pass an array to race.'));
  663. });
  664. } else {
  665. return new Constructor(function (resolve, reject) {
  666. var length = entries.length;
  667. for (var i = 0; i < length; i++) {
  668. Constructor.resolve(entries[i]).then(resolve, reject);
  669. }
  670. });
  671. }
  672. }
  673. /**
  674. `Promise.reject` returns a promise rejected with the passed `reason`.
  675. It is shorthand for the following:
  676. ```javascript
  677. let promise = new Promise(function(resolve, reject){
  678. reject(new Error('WHOOPS'));
  679. });
  680. promise.then(function(value){
  681. // Code here doesn't run because the promise is rejected!
  682. }, function(reason){
  683. // reason.message === 'WHOOPS'
  684. });
  685. ```
  686. Instead of writing the above, your code now simply becomes the following:
  687. ```javascript
  688. let promise = Promise.reject(new Error('WHOOPS'));
  689. promise.then(function(value){
  690. // Code here doesn't run because the promise is rejected!
  691. }, function(reason){
  692. // reason.message === 'WHOOPS'
  693. });
  694. ```
  695. @method reject
  696. @static
  697. @param {Any} reason value that the returned promise will be rejected with.
  698. Useful for tooling.
  699. @return {Promise} a promise rejected with the given `reason`.
  700. */
  701. function reject(reason) {
  702. /*jshint validthis:true */
  703. var Constructor = this;
  704. var promise = new Constructor(noop);
  705. _reject(promise, reason);
  706. return promise;
  707. }
  708. function needsResolver() {
  709. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  710. }
  711. function needsNew() {
  712. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  713. }
  714. /**
  715. Promise objects represent the eventual result of an asynchronous operation. The
  716. primary way of interacting with a promise is through its `then` method, which
  717. registers callbacks to receive either a promise's eventual value or the reason
  718. why the promise cannot be fulfilled.
  719. Terminology
  720. -----------
  721. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  722. - `thenable` is an object or function that defines a `then` method.
  723. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  724. - `exception` is a value that is thrown using the throw statement.
  725. - `reason` is a value that indicates why a promise was rejected.
  726. - `settled` the final resting state of a promise, fulfilled or rejected.
  727. A promise can be in one of three states: pending, fulfilled, or rejected.
  728. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  729. state. Promises that are rejected have a rejection reason and are in the
  730. rejected state. A fulfillment value is never a thenable.
  731. Promises can also be said to *resolve* a value. If this value is also a
  732. promise, then the original promise's settled state will match the value's
  733. settled state. So a promise that *resolves* a promise that rejects will
  734. itself reject, and a promise that *resolves* a promise that fulfills will
  735. itself fulfill.
  736. Basic Usage:
  737. ------------
  738. ```js
  739. let promise = new Promise(function(resolve, reject) {
  740. // on success
  741. resolve(value);
  742. // on failure
  743. reject(reason);
  744. });
  745. promise.then(function(value) {
  746. // on fulfillment
  747. }, function(reason) {
  748. // on rejection
  749. });
  750. ```
  751. Advanced Usage:
  752. ---------------
  753. Promises shine when abstracting away asynchronous interactions such as
  754. `XMLHttpRequest`s.
  755. ```js
  756. function getJSON(url) {
  757. return new Promise(function(resolve, reject){
  758. let xhr = new XMLHttpRequest();
  759. xhr.open('GET', url);
  760. xhr.onreadystatechange = handler;
  761. xhr.responseType = 'json';
  762. xhr.setRequestHeader('Accept', 'application/json');
  763. xhr.send();
  764. function handler() {
  765. if (this.readyState === this.DONE) {
  766. if (this.status === 200) {
  767. resolve(this.response);
  768. } else {
  769. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  770. }
  771. }
  772. };
  773. });
  774. }
  775. getJSON('/posts.json').then(function(json) {
  776. // on fulfillment
  777. }, function(reason) {
  778. // on rejection
  779. });
  780. ```
  781. Unlike callbacks, promises are great composable primitives.
  782. ```js
  783. Promise.all([
  784. getJSON('/posts'),
  785. getJSON('/comments')
  786. ]).then(function(values){
  787. values[0] // => postsJSON
  788. values[1] // => commentsJSON
  789. return values;
  790. });
  791. ```
  792. @class Promise
  793. @param {function} resolver
  794. Useful for tooling.
  795. @constructor
  796. */
  797. function Promise(resolver) {
  798. this[PROMISE_ID] = nextId();
  799. this._result = this._state = undefined;
  800. this._subscribers = [];
  801. if (noop !== resolver) {
  802. typeof resolver !== 'function' && needsResolver();
  803. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  804. }
  805. }
  806. Promise.all = all;
  807. Promise.race = race;
  808. Promise.resolve = resolve;
  809. Promise.reject = reject;
  810. Promise._setScheduler = setScheduler;
  811. Promise._setAsap = setAsap;
  812. Promise._asap = asap;
  813. Promise.prototype = {
  814. constructor: Promise,
  815. /**
  816. The primary way of interacting with a promise is through its `then` method,
  817. which registers callbacks to receive either a promise's eventual value or the
  818. reason why the promise cannot be fulfilled.
  819. ```js
  820. findUser().then(function(user){
  821. // user is available
  822. }, function(reason){
  823. // user is unavailable, and you are given the reason why
  824. });
  825. ```
  826. Chaining
  827. --------
  828. The return value of `then` is itself a promise. This second, 'downstream'
  829. promise is resolved with the return value of the first promise's fulfillment
  830. or rejection handler, or rejected if the handler throws an exception.
  831. ```js
  832. findUser().then(function (user) {
  833. return user.name;
  834. }, function (reason) {
  835. return 'default name';
  836. }).then(function (userName) {
  837. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  838. // will be `'default name'`
  839. });
  840. findUser().then(function (user) {
  841. throw new Error('Found user, but still unhappy');
  842. }, function (reason) {
  843. throw new Error('`findUser` rejected and we're unhappy');
  844. }).then(function (value) {
  845. // never reached
  846. }, function (reason) {
  847. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  848. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  849. });
  850. ```
  851. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  852. ```js
  853. findUser().then(function (user) {
  854. throw new PedagogicalException('Upstream error');
  855. }).then(function (value) {
  856. // never reached
  857. }).then(function (value) {
  858. // never reached
  859. }, function (reason) {
  860. // The `PedgagocialException` is propagated all the way down to here
  861. });
  862. ```
  863. Assimilation
  864. ------------
  865. Sometimes the value you want to propagate to a downstream promise can only be
  866. retrieved asynchronously. This can be achieved by returning a promise in the
  867. fulfillment or rejection handler. The downstream promise will then be pending
  868. until the returned promise is settled. This is called *assimilation*.
  869. ```js
  870. findUser().then(function (user) {
  871. return findCommentsByAuthor(user);
  872. }).then(function (comments) {
  873. // The user's comments are now available
  874. });
  875. ```
  876. If the assimliated promise rejects, then the downstream promise will also reject.
  877. ```js
  878. findUser().then(function (user) {
  879. return findCommentsByAuthor(user);
  880. }).then(function (comments) {
  881. // If `findCommentsByAuthor` fulfills, we'll have the value here
  882. }, function (reason) {
  883. // If `findCommentsByAuthor` rejects, we'll have the reason here
  884. });
  885. ```
  886. Simple Example
  887. --------------
  888. Synchronous Example
  889. ```javascript
  890. let result;
  891. try {
  892. result = findResult();
  893. // success
  894. } catch(reason) {
  895. // failure
  896. }
  897. ```
  898. Errback Example
  899. ```js
  900. findResult(function(result, err){
  901. if (err) {
  902. // failure
  903. } else {
  904. // success
  905. }
  906. });
  907. ```
  908. Promise Example;
  909. ```javascript
  910. findResult().then(function(result){
  911. // success
  912. }, function(reason){
  913. // failure
  914. });
  915. ```
  916. Advanced Example
  917. --------------
  918. Synchronous Example
  919. ```javascript
  920. let author, books;
  921. try {
  922. author = findAuthor();
  923. books = findBooksByAuthor(author);
  924. // success
  925. } catch(reason) {
  926. // failure
  927. }
  928. ```
  929. Errback Example
  930. ```js
  931. function foundBooks(books) {
  932. }
  933. function failure(reason) {
  934. }
  935. findAuthor(function(author, err){
  936. if (err) {
  937. failure(err);
  938. // failure
  939. } else {
  940. try {
  941. findBoooksByAuthor(author, function(books, err) {
  942. if (err) {
  943. failure(err);
  944. } else {
  945. try {
  946. foundBooks(books);
  947. } catch(reason) {
  948. failure(reason);
  949. }
  950. }
  951. });
  952. } catch(error) {
  953. failure(err);
  954. }
  955. // success
  956. }
  957. });
  958. ```
  959. Promise Example;
  960. ```javascript
  961. findAuthor().
  962. then(findBooksByAuthor).
  963. then(function(books){
  964. // found books
  965. }).catch(function(reason){
  966. // something went wrong
  967. });
  968. ```
  969. @method then
  970. @param {Function} onFulfilled
  971. @param {Function} onRejected
  972. Useful for tooling.
  973. @return {Promise}
  974. */
  975. then: then,
  976. /**
  977. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  978. as the catch block of a try/catch statement.
  979. ```js
  980. function findAuthor(){
  981. throw new Error('couldn't find that author');
  982. }
  983. // synchronous
  984. try {
  985. findAuthor();
  986. } catch(reason) {
  987. // something went wrong
  988. }
  989. // async with promises
  990. findAuthor().catch(function(reason){
  991. // something went wrong
  992. });
  993. ```
  994. @method catch
  995. @param {Function} onRejection
  996. Useful for tooling.
  997. @return {Promise}
  998. */
  999. 'catch': function _catch(onRejection) {
  1000. return this.then(null, onRejection);
  1001. }
  1002. };
  1003. function polyfill() {
  1004. var local = undefined;
  1005. if (typeof global !== 'undefined') {
  1006. local = global;
  1007. } else if (typeof self !== 'undefined') {
  1008. local = self;
  1009. } else {
  1010. try {
  1011. local = Function('return this')();
  1012. } catch (e) {
  1013. throw new Error('polyfill failed because global object is unavailable in this environment');
  1014. }
  1015. }
  1016. var P = local.Promise;
  1017. if (P) {
  1018. var promiseToString = null;
  1019. try {
  1020. promiseToString = Object.prototype.toString.call(P.resolve());
  1021. } catch (e) {
  1022. // silently ignored
  1023. }
  1024. if (promiseToString === '[object Promise]' && !P.cast) {
  1025. return;
  1026. }
  1027. }
  1028. local.Promise = Promise;
  1029. }
  1030. polyfill();
  1031. // Strange compat..
  1032. Promise.polyfill = polyfill;
  1033. Promise.Promise = Promise;
  1034. return Promise;
  1035. })));
  1036. //# sourceMappingURL=es6-promise.map;
  1037. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  1038. promiseLib.polyfill();
  1039. });
  1040. // This file is injected dependencies by amber-compat-xxx modules.
  1041. // Therefore it is important that it _does_not_have_ define call.
  1042. ;
  1043. define("amber/node-compatibility", ["./es2015-polyfills"], function(){});
  1044. /* ====================================================================
  1045. |
  1046. | Amber Smalltalk
  1047. | http://amber-lang.net
  1048. |
  1049. ======================================================================
  1050. ======================================================================
  1051. |
  1052. | Copyright (c) 2010-2014
  1053. | Nicolas Petton <petton.nicolas@gmail.com>
  1054. |
  1055. | Copyright (c) 2012-2017
  1056. | The Amber team https://lolg.it/org/amber/members
  1057. | Amber contributors (see /CONTRIBUTORS)
  1058. |
  1059. | Amber is released under the MIT license
  1060. |
  1061. | Permission is hereby granted, free of charge, to any person obtaining
  1062. | a copy of this software and associated documentation files (the
  1063. | 'Software'), to deal in the Software without restriction, including
  1064. | without limitation the rights to use, copy, modify, merge, publish,
  1065. | distribute, sublicense, and/or sell copies of the Software, and to
  1066. | permit persons to whom the Software is furnished to do so, subject to
  1067. | the following conditions:
  1068. |
  1069. | The above copyright notice and this permission notice shall be
  1070. | included in all copies or substantial portions of the Software.
  1071. |
  1072. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1073. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1074. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1075. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1076. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1077. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1078. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1079. |
  1080. ==================================================================== */
  1081. //jshint eqnull:true
  1082. define('amber/kernel-fundamentals',['./compatibility'], function () {
  1083. "use strict";
  1084. function inherits (child, parent) {
  1085. child.prototype = Object.create(parent.prototype, {
  1086. constructor: {
  1087. value: child,
  1088. enumerable: false, configurable: true, writable: true
  1089. }
  1090. });
  1091. return child;
  1092. }
  1093. function SmalltalkGlobalsBrik (brikz, st) {
  1094. // jshint evil:true
  1095. var jsGlobals = new Function("return this")();
  1096. var globals = Object.create(jsGlobals);
  1097. globals.SmalltalkSettings = {};
  1098. this.globals = globals;
  1099. }
  1100. function RootBrik (brikz, st) {
  1101. /* Smalltalk foundational objects */
  1102. var coreFns = this.coreFns = {};
  1103. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1104. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1105. Detached roots (eg. wrapped JS classes like Number or Date)
  1106. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1107. function SmalltalkRoot () {
  1108. }
  1109. function SmalltalkProtoObject () {
  1110. }
  1111. function SmalltalkObject () {
  1112. }
  1113. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1114. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1115. this.Root = SmalltalkRoot;
  1116. this.Object = SmalltalkObject;
  1117. }
  1118. OrganizeBrik.deps = ["arraySet", "root"];
  1119. function OrganizeBrik (brikz, st) {
  1120. var SmalltalkObject = brikz.root.Object;
  1121. var coreFns = brikz.root.coreFns;
  1122. var addElement = brikz.arraySet.addElement;
  1123. var removeElement = brikz.arraySet.removeElement;
  1124. function SmalltalkOrganizer () {
  1125. }
  1126. function SmalltalkPackageOrganizer () {
  1127. this.elements = [];
  1128. }
  1129. function SmalltalkClassOrganizer () {
  1130. this.elements = [];
  1131. }
  1132. coreFns.Organizer = inherits(SmalltalkOrganizer, SmalltalkObject);
  1133. coreFns.PackageOrganizer = inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  1134. coreFns.ClassOrganizer = inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  1135. this.setupClassOrganization = function (behaviorBody) {
  1136. behaviorBody.organization = new SmalltalkClassOrganizer();
  1137. behaviorBody.organization.theClass = behaviorBody;
  1138. };
  1139. this.setupPackageOrganization = function (pkg) {
  1140. pkg.organization = new SmalltalkPackageOrganizer();
  1141. };
  1142. this.addOrganizationElement = function (owner, element) {
  1143. addElement(owner.organization.elements, element);
  1144. };
  1145. this.removeOrganizationElement = function (owner, element) {
  1146. removeElement(owner.organization.elements, element);
  1147. };
  1148. }
  1149. SelectorsBrik.deps = ["selectorConversion"];
  1150. function SelectorsBrik (brikz, st) {
  1151. var selectorSet = Object.create(null);
  1152. var selectors = this.selectors = [];
  1153. var selectorPairs = this.selectorPairs = [];
  1154. this.registerSelector = function (stSelector) {
  1155. if (selectorSet[stSelector]) return null;
  1156. var jsSelector = st.st2js(stSelector);
  1157. selectorSet[stSelector] = true;
  1158. selectors.push(stSelector);
  1159. var pair = {st: stSelector, js: jsSelector};
  1160. selectorPairs.push(pair);
  1161. return pair;
  1162. };
  1163. st.allSelectors = function () {
  1164. return selectors;
  1165. };
  1166. }
  1167. PackagesBrik.deps = ["organize", "root"];
  1168. function PackagesBrik (brikz, st) {
  1169. var setupPackageOrganization = brikz.organize.setupPackageOrganization;
  1170. var SmalltalkObject = brikz.root.Object;
  1171. var coreFns = brikz.root.coreFns;
  1172. function SmalltalkPackage () {
  1173. }
  1174. coreFns.Package = inherits(SmalltalkPackage, SmalltalkObject);
  1175. st.packages = {};
  1176. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  1177. function pkg (spec) {
  1178. var that = new SmalltalkPackage();
  1179. that.pkgName = spec.pkgName;
  1180. setupPackageOrganization(that);
  1181. that.properties = spec.properties || {};
  1182. return that;
  1183. }
  1184. /* Add a package to the system, creating a new one if needed.
  1185. If pkgName is null or empty we return nil.
  1186. If package already exists we still update the properties of it. */
  1187. st.addPackage = function (pkgName, properties) {
  1188. if (!pkgName) return null;
  1189. if (!st.packages[pkgName]) {
  1190. st.packages[pkgName] = pkg({
  1191. pkgName: pkgName,
  1192. properties: properties
  1193. });
  1194. } else {
  1195. if (properties) {
  1196. st.packages[pkgName].properties = properties;
  1197. }
  1198. }
  1199. return st.packages[pkgName];
  1200. };
  1201. }
  1202. BehaviorsBrik.deps = ["organize", "root", "smalltalkGlobals", "arraySet"];
  1203. function BehaviorsBrik (brikz, st) {
  1204. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1205. var removeOrganizationElement = brikz.organize.removeOrganizationElement;
  1206. var globals = brikz.smalltalkGlobals.globals;
  1207. var SmalltalkObject = brikz.root.Object;
  1208. var coreFns = brikz.root.coreFns;
  1209. var addElement = brikz.arraySet.addElement;
  1210. var removeElement = brikz.arraySet.removeElement;
  1211. /* Smalltalk classes */
  1212. var classes = [];
  1213. this.buildBehaviorBody = function (pkgName, builder) {
  1214. var pkg = st.packages[pkgName];
  1215. if (!pkg) throw new Error("Missing package " + pkgName);
  1216. var behaviorBody = globals.hasOwnProperty(builder.className) && globals[builder.className];
  1217. if (behaviorBody) {
  1218. builder.updateExisting(behaviorBody, pkg);
  1219. } else {
  1220. behaviorBody = builder.make(pkg);
  1221. }
  1222. addBehaviorBody(behaviorBody);
  1223. return behaviorBody;
  1224. };
  1225. function addBehaviorBody (behaviorBody) {
  1226. globals[behaviorBody.className] = behaviorBody;
  1227. addElement(classes, behaviorBody);
  1228. addOrganizationElement(behaviorBody.pkg, behaviorBody);
  1229. behaviorBody.added();
  1230. }
  1231. function removeBehaviorBody (behaviorBody) {
  1232. behaviorBody.removed();
  1233. removeOrganizationElement(behaviorBody.pkg, behaviorBody);
  1234. removeElement(classes, behaviorBody);
  1235. delete globals[behaviorBody.className];
  1236. }
  1237. this.removeBehaviorBody = removeBehaviorBody;
  1238. /* Create an alias for an existing class */
  1239. st.alias = function (behaviorBody, alias) {
  1240. globals[alias] = behaviorBody;
  1241. };
  1242. /* Answer all registered Smalltalk classes */
  1243. //TODO: remove the function and make smalltalk.classes an array
  1244. st.classes = this.classes = function () {
  1245. return classes;
  1246. };
  1247. }
  1248. MethodsBrik.deps = ["composition", "selectors", "root", "selectorConversion"];
  1249. function MethodsBrik (brikz, st) {
  1250. var registerSelector = brikz.selectors.registerSelector;
  1251. var updateMethod = brikz.composition.updateMethod;
  1252. var SmalltalkObject = brikz.root.Object;
  1253. var coreFns = brikz.root.coreFns;
  1254. function SmalltalkMethod () {
  1255. }
  1256. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1257. /* Smalltalk method object. To add a method to a class,
  1258. use api.addMethod() */
  1259. st.method = function (spec) {
  1260. var that = new SmalltalkMethod();
  1261. var selector = spec.selector;
  1262. that.selector = selector;
  1263. that.jsSelector = st.st2js(selector);
  1264. that.args = spec.args || {};
  1265. that.protocol = spec.protocol;
  1266. that.source = spec.source;
  1267. that.messageSends = spec.messageSends || [];
  1268. that.referencedClasses = spec.referencedClasses || [];
  1269. that.fn = spec.fn;
  1270. return that;
  1271. };
  1272. /* Add/remove a method to/from a class */
  1273. st.addMethod = function (method, behaviorBody) {
  1274. if (method.methodClass != null) {
  1275. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.methodClass);
  1276. }
  1277. method.methodClass = behaviorBody;
  1278. registerNewSelectors(method);
  1279. behaviorBody.localMethods[method.selector] = method;
  1280. updateMethod(method.selector, behaviorBody);
  1281. };
  1282. function registerNewSelectors (method) {
  1283. var newSelectors = [];
  1284. function selectorInUse (stSelector) {
  1285. var pair = registerSelector(stSelector);
  1286. if (pair) {
  1287. newSelectors.push(pair);
  1288. }
  1289. }
  1290. selectorInUse(method.selector);
  1291. method.messageSends.forEach(selectorInUse);
  1292. if (st._selectorsAdded) st._selectorsAdded(newSelectors);
  1293. }
  1294. st.removeMethod = function (method, behaviorBody) {
  1295. if (behaviorBody.localMethods[method.selector] !== method) return;
  1296. delete behaviorBody.localMethods[method.selector];
  1297. updateMethod(method.selector, behaviorBody);
  1298. };
  1299. }
  1300. MethodCompositionBrik.deps = ["organize"];
  1301. function MethodCompositionBrik (brikz, st) {
  1302. var setupClassOrganization = brikz.organize.setupClassOrganization;
  1303. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1304. this.setupMethods = function (behaviorBody) {
  1305. setupClassOrganization(behaviorBody);
  1306. behaviorBody.traitComposition = [];
  1307. behaviorBody.localMethods = Object.create(null);
  1308. behaviorBody.methods = Object.create(null);
  1309. };
  1310. function addMethod (method, behaviorBody) {
  1311. behaviorBody.methods[method.selector] = method;
  1312. // During the bootstrap, #addCompiledMethod is not used.
  1313. // Therefore we populate the organizer here too
  1314. addOrganizationElement(behaviorBody, method.protocol);
  1315. behaviorBody.methodAdded(method);
  1316. }
  1317. function removeMethod (method, behaviorBody) {
  1318. delete behaviorBody.methods[method.selector];
  1319. behaviorBody.methodRemoved(method);
  1320. // Do *not* delete protocols from here.
  1321. // This is handled by #removeCompiledMethod
  1322. }
  1323. function aliased (selector, method) {
  1324. if (method.selector === selector) return method;
  1325. var result = st.method({
  1326. selector: selector,
  1327. args: method.args,
  1328. protocol: method.protocol,
  1329. source: '"Aliased as ' + selector + '"\n' + method.source,
  1330. messageSends: method.messageSends,
  1331. referencesClasses: method.referencedClasses,
  1332. fn: method.fn
  1333. });
  1334. result.methodClass = method.methodClass;
  1335. return result;
  1336. }
  1337. function deleteKeysFrom (keys, obj) {
  1338. keys.forEach(function (each) {
  1339. delete obj[each];
  1340. });
  1341. }
  1342. function fillTraitTransformation (traitTransformation, obj) {
  1343. // assert(Object.getOwnProperties(obj).length === 0)
  1344. var traitMethods = traitTransformation.trait.methods;
  1345. Object.keys(traitMethods).forEach(function (selector) {
  1346. obj[selector] = traitMethods[selector];
  1347. });
  1348. var traitAliases = traitTransformation.aliases;
  1349. if (traitAliases) {
  1350. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1351. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1352. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1353. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1354. });
  1355. }
  1356. var traitExclusions = traitTransformation.exclusions;
  1357. if (traitExclusions) {
  1358. deleteKeysFrom(traitExclusions, obj);
  1359. }
  1360. return obj;
  1361. }
  1362. function buildCompositionChain (traitComposition) {
  1363. return traitComposition.reduce(function (soFar, each) {
  1364. return fillTraitTransformation(each, Object.create(soFar));
  1365. }, null);
  1366. }
  1367. st.setTraitComposition = function (traitComposition, behaviorBody) {
  1368. var oldLocalMethods = behaviorBody.localMethods,
  1369. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1370. Object.keys(oldLocalMethods).forEach(function (selector) {
  1371. newLocalMethods[selector] = oldLocalMethods[selector];
  1372. });
  1373. behaviorBody.localMethods = newLocalMethods;
  1374. for (var selector in newLocalMethods) {
  1375. updateMethod(selector, behaviorBody);
  1376. }
  1377. for (var selector in oldLocalMethods) {
  1378. updateMethod(selector, behaviorBody);
  1379. }
  1380. behaviorBody.traitComposition.forEach(function (each) {
  1381. each.trait.removeUser(behaviorBody);
  1382. });
  1383. behaviorBody.traitComposition = traitComposition;
  1384. behaviorBody.traitComposition.forEach(function (each) {
  1385. each.trait.addUser(behaviorBody);
  1386. });
  1387. };
  1388. function updateMethod (selector, behaviorBody) {
  1389. var oldMethod = behaviorBody.methods[selector],
  1390. newMethod = behaviorBody.localMethods[selector];
  1391. if (oldMethod == null && newMethod == null) {
  1392. console.warn("Removal of nonexistent method " + behaviorBody + " >> " + selector);
  1393. return;
  1394. }
  1395. if (newMethod === oldMethod) return;
  1396. if (newMethod != null) addMethod(newMethod, behaviorBody);
  1397. else removeMethod(oldMethod, behaviorBody);
  1398. }
  1399. this.updateMethod = updateMethod;
  1400. function aliasesOfSelector (selector, traitAliases) {
  1401. if (!traitAliases) return [selector];
  1402. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  1403. return traitAliases[aliasSelector] === selector
  1404. });
  1405. if (!traitAliases[selector]) result.push(selector);
  1406. return result;
  1407. }
  1408. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  1409. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1410. changes.forEach(function (aliasSelector) {
  1411. obj[aliasSelector] = aliased(aliasSelector, method);
  1412. });
  1413. var traitExclusions = traitTransformation.exclusions;
  1414. if (traitExclusions) {
  1415. deleteKeysFrom(traitExclusions, obj);
  1416. }
  1417. return changes;
  1418. }
  1419. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  1420. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1421. deleteKeysFrom(changes, obj);
  1422. return changes;
  1423. }
  1424. function traitMethodChanged (selector, method, trait, behaviorBody) {
  1425. var traitComposition = behaviorBody.traitComposition,
  1426. chain = behaviorBody.localMethods,
  1427. changes = [];
  1428. for (var i = traitComposition.length - 1; i >= 0; --i) {
  1429. chain = Object.getPrototypeOf(chain);
  1430. var traitTransformation = traitComposition[i];
  1431. if (traitTransformation.trait !== trait) continue;
  1432. changes.push.apply(changes, method ?
  1433. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  1434. applyTraitMethodDeletion(selector, traitTransformation, chain));
  1435. }
  1436. // assert(chain === null);
  1437. changes.forEach(function (each) {
  1438. updateMethod(each, behaviorBody);
  1439. });
  1440. }
  1441. this.traitMethodChanged = traitMethodChanged;
  1442. }
  1443. function ArraySetBrik (brikz, st) {
  1444. st.addElement = this.addElement = function (array, el) {
  1445. if (typeof el === 'undefined') {
  1446. return;
  1447. }
  1448. if (array.indexOf(el) === -1) {
  1449. array.push(el);
  1450. }
  1451. };
  1452. st.removeElement = this.removeElement = function (array, el) {
  1453. var i = array.indexOf(el);
  1454. if (i !== -1) {
  1455. array.splice(i, 1);
  1456. }
  1457. };
  1458. }
  1459. function SelectorConversionBrik (brikz, st) {
  1460. /* Convert a Smalltalk selector into a JS selector */
  1461. st.st2js = function (string) {
  1462. return '_' + string
  1463. .replace(/:/g, '_')
  1464. .replace(/[\&]/g, '_and')
  1465. .replace(/[\|]/g, '_or')
  1466. .replace(/[+]/g, '_plus')
  1467. .replace(/-/g, '_minus')
  1468. .replace(/[*]/g, '_star')
  1469. .replace(/[\/]/g, '_slash')
  1470. .replace(/[\\]/g, '_backslash')
  1471. .replace(/[\~]/g, '_tild')
  1472. .replace(/%/g, '_percent')
  1473. .replace(/>/g, '_gt')
  1474. .replace(/</g, '_lt')
  1475. .replace(/=/g, '_eq')
  1476. .replace(/,/g, '_comma')
  1477. .replace(/[@]/g, '_at');
  1478. };
  1479. /* Convert a string to a valid smalltalk selector.
  1480. if you modify the following functions, also change st2js
  1481. accordingly */
  1482. st.js2st = function (selector) {
  1483. if (selector.match(/^__/)) {
  1484. return binaryJsToSt(selector);
  1485. } else {
  1486. return keywordJsToSt(selector);
  1487. }
  1488. };
  1489. function keywordJsToSt (selector) {
  1490. return selector.replace(/^_/, '').replace(/_/g, ':');
  1491. }
  1492. function binaryJsToSt (selector) {
  1493. return selector
  1494. .replace(/^_/, '')
  1495. .replace(/_and/g, '&')
  1496. .replace(/_or/g, '|')
  1497. .replace(/_plus/g, '+')
  1498. .replace(/_minus/g, '-')
  1499. .replace(/_star/g, '*')
  1500. .replace(/_slash/g, '/')
  1501. .replace(/_backslash/g, '\\')
  1502. .replace(/_tild/g, '~')
  1503. .replace(/_percent/g, '%')
  1504. .replace(/_gt/g, '>')
  1505. .replace(/_lt/g, '<')
  1506. .replace(/_eq/g, '=')
  1507. .replace(/_comma/g, ',')
  1508. .replace(/_at/g, '@');
  1509. }
  1510. st.st2prop = function (stSelector) {
  1511. var colonPosition = stSelector.indexOf(':');
  1512. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1513. };
  1514. }
  1515. /* Making smalltalk that has basic building blocks */
  1516. function configureWithFundamentals (brikz) {
  1517. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1518. brikz.root = RootBrik;
  1519. brikz.arraySet = ArraySetBrik;
  1520. brikz.organize = OrganizeBrik;
  1521. brikz.selectorConversion = SelectorConversionBrik;
  1522. brikz.selectors = SelectorsBrik;
  1523. brikz.packages = PackagesBrik;
  1524. brikz.composition = MethodCompositionBrik;
  1525. brikz.behaviors = BehaviorsBrik;
  1526. brikz.methods = MethodsBrik;
  1527. brikz.rebuild();
  1528. }
  1529. return configureWithFundamentals;
  1530. });
  1531. /* ====================================================================
  1532. |
  1533. | Amber Smalltalk
  1534. | http://amber-lang.net
  1535. |
  1536. ======================================================================
  1537. ======================================================================
  1538. |
  1539. | Copyright (c) 2010-2014
  1540. | Nicolas Petton <petton.nicolas@gmail.com>
  1541. |
  1542. | Copyright (c) 2012-2017
  1543. | The Amber team https://lolg.it/org/amber/members
  1544. | Amber contributors (see /CONTRIBUTORS)
  1545. |
  1546. | Amber is released under the MIT license
  1547. |
  1548. | Permission is hereby granted, free of charge, to any person obtaining
  1549. | a copy of this software and associated documentation files (the
  1550. | 'Software'), to deal in the Software without restriction, including
  1551. | without limitation the rights to use, copy, modify, merge, publish,
  1552. | distribute, sublicense, and/or sell copies of the Software, and to
  1553. | permit persons to whom the Software is furnished to do so, subject to
  1554. | the following conditions:
  1555. |
  1556. | The above copyright notice and this permission notice shall be
  1557. | included in all copies or substantial portions of the Software.
  1558. |
  1559. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1560. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1561. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1562. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1563. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1564. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1565. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1566. |
  1567. ==================================================================== */
  1568. //jshint eqnull:true
  1569. define('amber/kernel-language',['./compatibility'], function () {
  1570. "use strict";
  1571. function inherits (child, parent) {
  1572. child.prototype = Object.create(parent.prototype, {
  1573. constructor: {
  1574. value: child,
  1575. enumerable: false, configurable: true, writable: true
  1576. }
  1577. });
  1578. return child;
  1579. }
  1580. function defineMethod (klass, name, method) {
  1581. Object.defineProperty(klass.prototype, name, {
  1582. value: method,
  1583. enumerable: false, configurable: true, writable: true
  1584. });
  1585. }
  1586. TraitsBrik.deps = ["behaviors", "composition", "arraySet", "root"];
  1587. function TraitsBrik (brikz, st) {
  1588. var coreFns = brikz.root.coreFns;
  1589. var SmalltalkObject = brikz.root.Object;
  1590. var setupMethods = brikz.composition.setupMethods;
  1591. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1592. var buildBehaviorBody = brikz.behaviors.buildBehaviorBody;
  1593. var addElement = brikz.arraySet.addElement;
  1594. var removeElement = brikz.arraySet.removeElement;
  1595. function SmalltalkTrait () {
  1596. }
  1597. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1598. SmalltalkTrait.prototype.trait = true;
  1599. defineMethod(SmalltalkTrait, "toString", function () {
  1600. return 'Smalltalk Trait ' + this.className;
  1601. });
  1602. defineMethod(SmalltalkTrait, "added", function () {
  1603. if (st._traitAdded) st._traitAdded(this);
  1604. });
  1605. defineMethod(SmalltalkTrait, "removed", function () {
  1606. if (st._traitRemoved) st._traitRemoved(this);
  1607. });
  1608. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1609. var self = this;
  1610. this.traitUsers.forEach(function (each) {
  1611. traitMethodChanged(method.selector, method, self, each);
  1612. });
  1613. if (st._traitMethodAdded) st._traitMethodAdded(method, this);
  1614. });
  1615. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1616. var self = this;
  1617. this.traitUsers.forEach(function (each) {
  1618. traitMethodChanged(method.selector, null, self, each);
  1619. });
  1620. if (st._traitMethodRemoved) st._traitMethodRemoved(method, this);
  1621. });
  1622. defineMethod(SmalltalkTrait, "addUser", function (behaviorBody) {
  1623. addElement(this.traitUsers, behaviorBody);
  1624. });
  1625. defineMethod(SmalltalkTrait, "removeUser", function (behaviorBody) {
  1626. removeElement(this.traitUsers, behaviorBody);
  1627. });
  1628. function traitBuilder (className) {
  1629. return {
  1630. className: className,
  1631. make: function (pkg) {
  1632. var that = new SmalltalkTrait();
  1633. that.className = className;
  1634. that.pkg = pkg;
  1635. that.traitUsers = [];
  1636. setupMethods(that);
  1637. return that;
  1638. },
  1639. updateExisting: function (trait, pkg) {
  1640. if (pkg) trait.pkg = pkg;
  1641. }
  1642. };
  1643. }
  1644. st.addTrait = function (className, pkgName) {
  1645. return buildBehaviorBody(pkgName, traitBuilder(className));
  1646. };
  1647. }
  1648. ClassesBrik.deps = ["root", "behaviors", "composition", "arraySet", "smalltalkGlobals"];
  1649. function ClassesBrik (brikz, st) {
  1650. var SmalltalkRoot = brikz.root.Root;
  1651. var coreFns = brikz.root.coreFns;
  1652. var globals = brikz.smalltalkGlobals.globals;
  1653. var SmalltalkObject = brikz.root.Object;
  1654. var buildBehaviorBody = brikz.behaviors.buildBehaviorBody;
  1655. var setupMethods = brikz.composition.setupMethods;
  1656. var removeBehaviorBody = brikz.behaviors.removeBehaviorBody;
  1657. var addElement = brikz.arraySet.addElement;
  1658. var removeElement = brikz.arraySet.removeElement;
  1659. function SmalltalkBehavior () {
  1660. }
  1661. function SmalltalkClass () {
  1662. }
  1663. function SmalltalkMetaclass () {
  1664. }
  1665. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  1666. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  1667. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1668. // Fake root class of the system.
  1669. // Effective superclass of all classes created with `nil subclass: ...`.
  1670. var nilAsClass = this.nilAsClass = {
  1671. fn: SmalltalkRoot,
  1672. a$cls: {fn: SmalltalkClass},
  1673. klass: {fn: SmalltalkClass}
  1674. };
  1675. SmalltalkMetaclass.prototype.meta = true;
  1676. defineMethod(SmalltalkClass, "toString", function () {
  1677. return 'Smalltalk ' + this.className;
  1678. });
  1679. defineMethod(SmalltalkMetaclass, "toString", function () {
  1680. return 'Smalltalk Metaclass ' + this.instanceClass.className;
  1681. });
  1682. defineMethod(SmalltalkClass, "added", function () {
  1683. addSubclass(this);
  1684. if (st._classAdded) st._classAdded(this);
  1685. });
  1686. defineMethod(SmalltalkClass, "removed", function () {
  1687. if (st._classRemoved) st._classRemoved(this);
  1688. removeSubclass(this);
  1689. });
  1690. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  1691. if (st._methodAdded) st._methodAdded(method, this);
  1692. });
  1693. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  1694. if (st._methodRemoved) st._methodRemoved(method, this);
  1695. });
  1696. this.bootstrapHierarchy = function () {
  1697. var nilSubclasses = [globals.ProtoObject];
  1698. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  1699. nilSubclasses.forEach(function (each) {
  1700. each.a$cls.superclass = globals.Class;
  1701. addSubclass(each.a$cls);
  1702. });
  1703. };
  1704. /* Smalltalk class creation. A class is an instance of an automatically
  1705. created metaclass object. Newly created classes (not their metaclass)
  1706. should be added to the system, see smalltalk.addClass().
  1707. Superclass linking is *not* handled here, see api.initialize() */
  1708. function classBuilder (className, superclass, iVarNames, fn) {
  1709. var logicalSuperclass = superclass;
  1710. if (superclass == null || superclass.a$nil) {
  1711. superclass = nilAsClass;
  1712. logicalSuperclass = null;
  1713. }
  1714. function klass (pkg) {
  1715. var that = metaclass().instanceClass;
  1716. that.superclass = logicalSuperclass;
  1717. that.fn = fn || inherits(function () {
  1718. }, superclass.fn);
  1719. that.iVarNames = iVarNames || [];
  1720. that.className = className;
  1721. that.pkg = pkg;
  1722. that.subclasses = [];
  1723. setupMethods(that);
  1724. return that;
  1725. }
  1726. function metaclass () {
  1727. var that = new SmalltalkMetaclass();
  1728. that.superclass = superclass.a$cls;
  1729. that.fn = inherits(function () {
  1730. }, that.superclass.fn);
  1731. that.iVarNames = [];
  1732. that.instanceClass = new that.fn();
  1733. wireKlass(that);
  1734. setupMethods(that);
  1735. return that;
  1736. }
  1737. return {
  1738. className: className,
  1739. make: klass,
  1740. updateExisting: function (klass, pkg) {
  1741. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  1742. if (iVarNames) klass.iVarNames = iVarNames;
  1743. if (pkg) klass.pkg = pkg;
  1744. } else throw new Error("Incompatible change of class: " + klass.className);
  1745. }
  1746. };
  1747. }
  1748. function wireKlass (klass) {
  1749. Object.defineProperty(klass.fn.prototype, "a$cls", {
  1750. value: klass,
  1751. enumerable: false, configurable: true, writable: true
  1752. });
  1753. Object.defineProperty(klass.fn.prototype, "klass", {
  1754. value: klass,
  1755. enumerable: false, configurable: true, writable: true
  1756. });
  1757. }
  1758. this.wireKlass = wireKlass;
  1759. /* Add a class to the system, creating a new one if needed.
  1760. A Package is lazily created if one with given name does not exist. */
  1761. st.addClass = function (className, superclass, iVarNames, pkgName) {
  1762. // While subclassing nil is allowed, it might be an error, so
  1763. // warn about it.
  1764. if (typeof superclass == 'undefined' || superclass && superclass.a$nil) {
  1765. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1766. }
  1767. return buildBehaviorBody(pkgName, classBuilder(className, superclass, iVarNames, coreFns[className]));
  1768. };
  1769. st.removeClass = removeBehaviorBody;
  1770. function addSubclass (klass) {
  1771. if (klass.superclass) {
  1772. addElement(klass.superclass.subclasses, klass);
  1773. }
  1774. }
  1775. function removeSubclass (klass) {
  1776. if (klass.superclass) {
  1777. removeElement(klass.superclass.subclasses, klass);
  1778. }
  1779. }
  1780. function metaSubclasses (metaclass) {
  1781. return metaclass.instanceClass.subclasses
  1782. .filter(function (each) {
  1783. return !each.meta;
  1784. })
  1785. .map(function (each) {
  1786. return each.a$cls;
  1787. });
  1788. }
  1789. st.metaSubclasses = metaSubclasses;
  1790. st.traverseClassTree = function (klass, fn) {
  1791. var queue = [klass], sentinel = {};
  1792. for (var i = 0; i < queue.length; ++i) {
  1793. var item = queue[i];
  1794. if (fn(item, sentinel) === sentinel) continue;
  1795. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1796. queue.push.apply(queue, subclasses);
  1797. }
  1798. };
  1799. }
  1800. NilBrik.deps = ["root"];
  1801. function NilBrik (brikz, st) {
  1802. var SmalltalkObject = brikz.root.Object;
  1803. var coreFns = brikz.root.coreFns;
  1804. function SmalltalkNil () {
  1805. }
  1806. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1807. this.nilAsReceiver = new SmalltalkNil();
  1808. this.nilAsValue = this.nilAsReceiver; // TODO null
  1809. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1810. // nil objects from one environment to another, doing
  1811. // `anObject == nil` (in JavaScript) does not always answer
  1812. // true as the referenced nil object might come from the other
  1813. // environment.
  1814. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1815. value: true,
  1816. enumerable: false, configurable: false, writable: false
  1817. });
  1818. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1819. value: true,
  1820. enumerable: false, configurable: false, writable: false
  1821. });
  1822. }
  1823. /* Defines asReceiver to be present at load time */
  1824. /* (logically it belongs more to PrimitiveBrik) */
  1825. AsReceiverBrik.deps = ["nil"];
  1826. function AsReceiverBrik (brikz, st) {
  1827. var nilAsReceiver = brikz.nil.nilAsReceiver;
  1828. /**
  1829. * This function is used all over the compiled amber code.
  1830. * It takes any value (JavaScript or Smalltalk)
  1831. * and returns a proper Amber Smalltalk receiver.
  1832. *
  1833. * null or undefined -> nilAsReceiver,
  1834. * object having Smalltalk signature -> unchanged,
  1835. * otherwise wrapped foreign (JS) object
  1836. */
  1837. this.asReceiver = function (o) {
  1838. if (o == null) return nilAsReceiver;
  1839. else if (o.a$cls != null) return o;
  1840. else return st.wrapJavaScript(o);
  1841. };
  1842. }
  1843. /* Making smalltalk that can load */
  1844. function configureWithHierarchy (brikz) {
  1845. brikz.traits = TraitsBrik;
  1846. brikz.classes = ClassesBrik;
  1847. brikz.nil = NilBrik;
  1848. brikz.asReceiver = AsReceiverBrik;
  1849. brikz.rebuild();
  1850. }
  1851. return configureWithHierarchy;
  1852. });
  1853. /* ====================================================================
  1854. |
  1855. | Amber Smalltalk
  1856. | http://amber-lang.net
  1857. |
  1858. ======================================================================
  1859. ======================================================================
  1860. |
  1861. | Copyright (c) 2010-2014
  1862. | Nicolas Petton <petton.nicolas@gmail.com>
  1863. |
  1864. | Copyright (c) 2012-2017
  1865. | The Amber team https://lolg.it/org/amber/members
  1866. | Amber contributors (see /CONTRIBUTORS)
  1867. |
  1868. | Amber is released under the MIT license
  1869. |
  1870. | Permission is hereby granted, free of charge, to any person obtaining
  1871. | a copy of this software and associated documentation files (the
  1872. | 'Software'), to deal in the Software without restriction, including
  1873. | without limitation the rights to use, copy, modify, merge, publish,
  1874. | distribute, sublicense, and/or sell copies of the Software, and to
  1875. | permit persons to whom the Software is furnished to do so, subject to
  1876. | the following conditions:
  1877. |
  1878. | The above copyright notice and this permission notice shall be
  1879. | included in all copies or substantial portions of the Software.
  1880. |
  1881. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1882. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1883. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1884. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1885. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1886. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1887. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1888. |
  1889. ==================================================================== */
  1890. //jshint eqnull:true
  1891. define('amber/boot',[
  1892. 'require', './brikz', './kernel-fundamentals', './kernel-language', './compatibility'
  1893. ], function (require, Brikz, configureWithFundamentals, configureWithHierarchy) {
  1894. "use strict";
  1895. require(['./kernel-runtime']); // preload
  1896. SmalltalkInitBrik.deps = ["classes"];
  1897. function SmalltalkInitBrik (brikz, st) {
  1898. var bootstrapHierarchy = brikz.classes.bootstrapHierarchy;
  1899. var initialized = false;
  1900. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  1901. require(['./kernel-runtime'], resolve, reject);
  1902. });
  1903. /* Smalltalk initialization. Called on page load */
  1904. st.initialize = function () {
  1905. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  1906. if (initialized) return;
  1907. bootstrapHierarchy();
  1908. configureWithRuntime(brikz);
  1909. initialized = true;
  1910. });
  1911. };
  1912. }
  1913. /* Adds AMD and requirejs related methods to the api */
  1914. function AMDBrik (brikz, st) {
  1915. st.amdRequire = require;
  1916. st.defaultTransportType = st.defaultTransportType || "amd";
  1917. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1918. }
  1919. var api = {};
  1920. var brikz = new Brikz(api);
  1921. configureWithFundamentals(brikz);
  1922. configureWithHierarchy(brikz);
  1923. brikz.stInit = SmalltalkInitBrik;
  1924. brikz.amd = AMDBrik;
  1925. brikz.rebuild();
  1926. return {
  1927. api: api,
  1928. nil/* TODO deprecate */: brikz.nil.nilAsReceiver,
  1929. nilAsReceiver: brikz.nil.nilAsReceiver,
  1930. nilAsValue: brikz.nil.nilAsValue,
  1931. dnu/* TODO deprecate */: brikz.classes.nilAsClass,
  1932. nilAsClass: brikz.classes.nilAsClass,
  1933. globals: brikz.smalltalkGlobals.globals,
  1934. asReceiver: brikz.asReceiver.asReceiver
  1935. };
  1936. });
  1937. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  1938. var globals = boot.globals,
  1939. exports = {},
  1940. api = boot.api,
  1941. nil = boot.nilAsReceiver;
  1942. // API
  1943. exports.popupHelios = function () {
  1944. require(['helios/index'], function (helios) {
  1945. helios.popup();
  1946. }, function (err) {
  1947. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1948. });
  1949. };
  1950. Object.defineProperty(exports, "api", {
  1951. value: api,
  1952. enumerable: true, configurable: true, writable: false
  1953. });
  1954. Object.defineProperty(exports, "globals", {
  1955. value: globals,
  1956. enumerable: true, configurable: true, writable: false
  1957. });
  1958. Object.defineProperty(exports, "nil", {
  1959. value: nil,
  1960. enumerable: true, configurable: true, writable: false
  1961. });
  1962. function mixinToSettings (source) {
  1963. var settings = globals.SmalltalkSettings;
  1964. Object.keys(source).forEach(function (key) {
  1965. settings[key] = source[key];
  1966. });
  1967. }
  1968. function settingsInLocalStorage () {
  1969. //jshint evil:true
  1970. var global = new Function('return this')(),
  1971. storage = 'localStorage' in global && global.localStorage;
  1972. if (storage) {
  1973. var fromStorage;
  1974. try {
  1975. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1976. } catch (ex) {
  1977. // pass
  1978. }
  1979. mixinToSettings(fromStorage || {});
  1980. if (typeof window !== "undefined") {
  1981. requirejs(['jquery'], function ($) {
  1982. $(window).on('beforeunload', function () {
  1983. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1984. });
  1985. });
  1986. }
  1987. }
  1988. }
  1989. exports.initialize = function (options) {
  1990. return Promise.resolve()
  1991. .then(function () {
  1992. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1993. })
  1994. .then(settingsInLocalStorage)
  1995. .then(function () {
  1996. return options || {};
  1997. })
  1998. .then(mixinToSettings)
  1999. .then(function () {
  2000. return api.initialize();
  2001. });
  2002. };
  2003. // Exports
  2004. return exports;
  2005. });
  2006. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2007. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  2008. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2009. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2010. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  2011. $core.addPackage("Kernel-Helpers");
  2012. $core.packages["Kernel-Helpers"].innerEval = function (expr) { return eval(expr); };
  2013. $core.packages["Kernel-Helpers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2014. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2015. $core.addMethod(
  2016. $core.method({
  2017. selector: "subclass:",
  2018. protocol: "class creation",
  2019. fn: function (aString){
  2020. var self=this,$self=this;
  2021. return $core.withContext(function($ctx1) {
  2022. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2023. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2024. },
  2025. args: ["aString"],
  2026. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2027. referencedClasses: [],
  2028. messageSends: ["subclass:instanceVariableNames:package:"]
  2029. }),
  2030. $globals.TSubclassable);
  2031. $core.addMethod(
  2032. $core.method({
  2033. selector: "subclass:instanceVariableNames:",
  2034. protocol: "class creation",
  2035. fn: function (aString,anotherString){
  2036. var self=this,$self=this;
  2037. return $core.withContext(function($ctx1) {
  2038. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2039. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2040. },
  2041. args: ["aString", "anotherString"],
  2042. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2043. referencedClasses: [],
  2044. messageSends: ["subclass:instanceVariableNames:package:"]
  2045. }),
  2046. $globals.TSubclassable);
  2047. $core.addMethod(
  2048. $core.method({
  2049. selector: "subclass:instanceVariableNames:category:",
  2050. protocol: "class creation",
  2051. fn: function (aString,aString2,aString3){
  2052. var self=this,$self=this;
  2053. return $core.withContext(function($ctx1) {
  2054. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2055. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2056. },
  2057. args: ["aString", "aString2", "aString3"],
  2058. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2059. referencedClasses: [],
  2060. messageSends: ["subclass:instanceVariableNames:package:"]
  2061. }),
  2062. $globals.TSubclassable);
  2063. $core.addMethod(
  2064. $core.method({
  2065. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2066. protocol: "class creation",
  2067. fn: function (aString,aString2,classVars,pools,aString3){
  2068. var self=this,$self=this;
  2069. return $core.withContext(function($ctx1) {
  2070. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2071. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2072. },
  2073. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2074. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2075. referencedClasses: [],
  2076. messageSends: ["subclass:instanceVariableNames:package:"]
  2077. }),
  2078. $globals.TSubclassable);
  2079. $core.addMethod(
  2080. $core.method({
  2081. selector: "subclass:instanceVariableNames:package:",
  2082. protocol: "class creation",
  2083. fn: function (aString,aString2,aString3){
  2084. var self=this,$self=this;
  2085. return $core.withContext(function($ctx1) {
  2086. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2087. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2088. },
  2089. args: ["aString", "aString2", "aString3"],
  2090. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2091. referencedClasses: ["ClassBuilder"],
  2092. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2093. }),
  2094. $globals.TSubclassable);
  2095. $core.addMethod(
  2096. $core.method({
  2097. selector: "subclass:uses:",
  2098. protocol: "class creation",
  2099. fn: function (aString,aTraitCompositionDescription){
  2100. var self=this,$self=this;
  2101. return $core.withContext(function($ctx1) {
  2102. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2103. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2104. },
  2105. args: ["aString", "aTraitCompositionDescription"],
  2106. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2107. referencedClasses: [],
  2108. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2109. }),
  2110. $globals.TSubclassable);
  2111. $core.addMethod(
  2112. $core.method({
  2113. selector: "subclass:uses:instanceVariableNames:",
  2114. protocol: "class creation",
  2115. fn: function (aString,aTraitCompositionDescription,anotherString){
  2116. var self=this,$self=this;
  2117. return $core.withContext(function($ctx1) {
  2118. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2119. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2120. },
  2121. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2122. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString package: nil",
  2123. referencedClasses: [],
  2124. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2125. }),
  2126. $globals.TSubclassable);
  2127. $core.addMethod(
  2128. $core.method({
  2129. selector: "subclass:uses:instanceVariableNames:category:",
  2130. protocol: "class creation",
  2131. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2132. var self=this,$self=this;
  2133. return $core.withContext(function($ctx1) {
  2134. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2135. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2136. },
  2137. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2138. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  2139. referencedClasses: [],
  2140. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2141. }),
  2142. $globals.TSubclassable);
  2143. $core.addMethod(
  2144. $core.method({
  2145. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2146. protocol: "class creation",
  2147. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2148. var self=this,$self=this;
  2149. return $core.withContext(function($ctx1) {
  2150. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2151. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2152. },
  2153. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2154. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  2155. referencedClasses: [],
  2156. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2157. }),
  2158. $globals.TSubclassable);
  2159. $core.addMethod(
  2160. $core.method({
  2161. selector: "subclass:uses:instanceVariableNames:package:",
  2162. protocol: "class creation",
  2163. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2164. var self=this,$self=this;
  2165. var cls;
  2166. return $core.withContext(function($ctx1) {
  2167. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2168. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2169. return cls;
  2170. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2171. },
  2172. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2173. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3\x0a\x09| cls |\x0a\x09cls := self subclass: aString instanceVariableNames: aString2 package: aString3.\x0a\x09cls setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ cls",
  2174. referencedClasses: [],
  2175. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2176. }),
  2177. $globals.TSubclassable);
  2178. });
  2179. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2180. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  2181. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2182. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2183. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  2184. $core.addPackage("Kernel-Objects");
  2185. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2186. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2187. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2188. $globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.";
  2189. $core.addMethod(
  2190. $core.method({
  2191. selector: "=",
  2192. protocol: "comparing",
  2193. fn: function (anObject){
  2194. var self=this,$self=this;
  2195. return $core.withContext(function($ctx1) {
  2196. return $self.__eq_eq(anObject);
  2197. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2198. },
  2199. args: ["anObject"],
  2200. source: "= anObject\x0a\x09^ self == anObject",
  2201. referencedClasses: [],
  2202. messageSends: ["=="]
  2203. }),
  2204. $globals.ProtoObject);
  2205. $core.addMethod(
  2206. $core.method({
  2207. selector: "==",
  2208. protocol: "comparing",
  2209. fn: function (anObject){
  2210. var self=this,$self=this;
  2211. return $core.withContext(function($ctx1) {
  2212. return $self._class() === $recv(anObject)._class() && $self._isSameInstanceAs_(anObject);
  2213. return self;
  2214. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2215. },
  2216. args: ["anObject"],
  2217. source: "== anObject\x0a<inlineJS:\x0a\x09'return $self._class() === $recv(anObject)._class() && $self._isSameInstanceAs_(anObject)'>",
  2218. referencedClasses: [],
  2219. messageSends: []
  2220. }),
  2221. $globals.ProtoObject);
  2222. $core.addMethod(
  2223. $core.method({
  2224. selector: "asJSON",
  2225. protocol: "converting",
  2226. fn: function (){
  2227. var self=this,$self=this;
  2228. return $core.withContext(function($ctx1) {
  2229. $self._deprecatedAPI_("Use #asJavaScriptObject instead.");
  2230. return $self._asJavaScriptObject();
  2231. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.ProtoObject)});
  2232. },
  2233. args: [],
  2234. source: "asJSON\x0a\x09self deprecatedAPI: 'Use #asJavaScriptObject instead.'.\x0a\x09^ self asJavaScriptObject",
  2235. referencedClasses: [],
  2236. messageSends: ["deprecatedAPI:", "asJavaScriptObject"]
  2237. }),
  2238. $globals.ProtoObject);
  2239. $core.addMethod(
  2240. $core.method({
  2241. selector: "asJavascript",
  2242. protocol: "converting",
  2243. fn: function (){
  2244. var self=this,$self=this;
  2245. return $core.withContext(function($ctx1) {
  2246. $self._deprecatedAPI_("Use #asJavaScriptSource instead.");
  2247. return $self._asJavaScriptSource();
  2248. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.ProtoObject)});
  2249. },
  2250. args: [],
  2251. source: "asJavascript\x0a\x09self deprecatedAPI: 'Use #asJavaScriptSource instead.'.\x0a\x09^ self asJavaScriptSource",
  2252. referencedClasses: [],
  2253. messageSends: ["deprecatedAPI:", "asJavaScriptSource"]
  2254. }),
  2255. $globals.ProtoObject);
  2256. $core.addMethod(
  2257. $core.method({
  2258. selector: "asString",
  2259. protocol: "converting",
  2260. fn: function (){
  2261. var self=this,$self=this;
  2262. return $core.withContext(function($ctx1) {
  2263. return $self._printString();
  2264. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2265. },
  2266. args: [],
  2267. source: "asString\x0a\x09^ self printString",
  2268. referencedClasses: [],
  2269. messageSends: ["printString"]
  2270. }),
  2271. $globals.ProtoObject);
  2272. $core.addMethod(
  2273. $core.method({
  2274. selector: "class",
  2275. protocol: "accessing",
  2276. fn: function (){
  2277. var self=this,$self=this;
  2278. return $core.withContext(function($ctx1) {
  2279. return $self.a$cls;
  2280. return self;
  2281. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2282. },
  2283. args: [],
  2284. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2285. referencedClasses: [],
  2286. messageSends: []
  2287. }),
  2288. $globals.ProtoObject);
  2289. $core.addMethod(
  2290. $core.method({
  2291. selector: "doesNotUnderstand:",
  2292. protocol: "error handling",
  2293. fn: function (aMessage){
  2294. var self=this,$self=this;
  2295. return $core.withContext(function($ctx1) {
  2296. var $1;
  2297. $1=$recv($globals.MessageNotUnderstood)._new();
  2298. $recv($1)._receiver_(self);
  2299. $recv($1)._message_(aMessage);
  2300. $recv($1)._signal();
  2301. return self;
  2302. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2303. },
  2304. args: ["aMessage"],
  2305. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2306. referencedClasses: ["MessageNotUnderstood"],
  2307. messageSends: ["receiver:", "new", "message:", "signal"]
  2308. }),
  2309. $globals.ProtoObject);
  2310. $core.addMethod(
  2311. $core.method({
  2312. selector: "evaluate:on:",
  2313. protocol: "evaluating",
  2314. fn: function (aString,anEvaluator){
  2315. var self=this,$self=this;
  2316. return $core.withContext(function($ctx1) {
  2317. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2318. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2319. },
  2320. args: ["aString", "anEvaluator"],
  2321. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2322. referencedClasses: [],
  2323. messageSends: ["evaluate:receiver:"]
  2324. }),
  2325. $globals.ProtoObject);
  2326. $core.addMethod(
  2327. $core.method({
  2328. selector: "identityHash",
  2329. protocol: "accessing",
  2330. fn: function (){
  2331. var self=this,$self=this;
  2332. return $core.withContext(function($ctx1) {
  2333. var hash=self.identityHash;
  2334. if (hash) return hash;
  2335. hash=$core.nextId();
  2336. Object.defineProperty(self, 'identityHash', {value:hash});
  2337. return hash;
  2338. ;
  2339. return self;
  2340. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2341. },
  2342. args: [],
  2343. source: "identityHash\x0a\x09<inlineJS: '\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, ''identityHash'', {value:hash});\x0a\x09\x09return hash;\x0a\x09'>",
  2344. referencedClasses: [],
  2345. messageSends: []
  2346. }),
  2347. $globals.ProtoObject);
  2348. $core.addMethod(
  2349. $core.method({
  2350. selector: "ifNil:",
  2351. protocol: "testing",
  2352. fn: function (aBlock){
  2353. var self=this,$self=this;
  2354. return self;
  2355. },
  2356. args: ["aBlock"],
  2357. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2358. referencedClasses: [],
  2359. messageSends: []
  2360. }),
  2361. $globals.ProtoObject);
  2362. $core.addMethod(
  2363. $core.method({
  2364. selector: "ifNil:ifNotNil:",
  2365. protocol: "testing",
  2366. fn: function (aBlock,anotherBlock){
  2367. var self=this,$self=this;
  2368. return $core.withContext(function($ctx1) {
  2369. return $recv(anotherBlock)._value_(self);
  2370. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2371. },
  2372. args: ["aBlock", "anotherBlock"],
  2373. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2374. referencedClasses: [],
  2375. messageSends: ["value:"]
  2376. }),
  2377. $globals.ProtoObject);
  2378. $core.addMethod(
  2379. $core.method({
  2380. selector: "ifNotNil:",
  2381. protocol: "testing",
  2382. fn: function (aBlock){
  2383. var self=this,$self=this;
  2384. return $core.withContext(function($ctx1) {
  2385. return $recv(aBlock)._value_(self);
  2386. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2387. },
  2388. args: ["aBlock"],
  2389. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2390. referencedClasses: [],
  2391. messageSends: ["value:"]
  2392. }),
  2393. $globals.ProtoObject);
  2394. $core.addMethod(
  2395. $core.method({
  2396. selector: "ifNotNil:ifNil:",
  2397. protocol: "testing",
  2398. fn: function (aBlock,anotherBlock){
  2399. var self=this,$self=this;
  2400. return $core.withContext(function($ctx1) {
  2401. return $recv(aBlock)._value_(self);
  2402. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2403. },
  2404. args: ["aBlock", "anotherBlock"],
  2405. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2406. referencedClasses: [],
  2407. messageSends: ["value:"]
  2408. }),
  2409. $globals.ProtoObject);
  2410. $core.addMethod(
  2411. $core.method({
  2412. selector: "initialize",
  2413. protocol: "initialization",
  2414. fn: function (){
  2415. var self=this,$self=this;
  2416. return self;
  2417. },
  2418. args: [],
  2419. source: "initialize",
  2420. referencedClasses: [],
  2421. messageSends: []
  2422. }),
  2423. $globals.ProtoObject);
  2424. $core.addMethod(
  2425. $core.method({
  2426. selector: "inspect",
  2427. protocol: "inspecting",
  2428. fn: function (){
  2429. var self=this,$self=this;
  2430. return $core.withContext(function($ctx1) {
  2431. $recv($globals.Inspector)._inspect_(self);
  2432. return self;
  2433. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2434. },
  2435. args: [],
  2436. source: "inspect\x0a\x09Inspector inspect: self",
  2437. referencedClasses: ["Inspector"],
  2438. messageSends: ["inspect:"]
  2439. }),
  2440. $globals.ProtoObject);
  2441. $core.addMethod(
  2442. $core.method({
  2443. selector: "inspectOn:",
  2444. protocol: "inspecting",
  2445. fn: function (anInspector){
  2446. var self=this,$self=this;
  2447. return self;
  2448. },
  2449. args: ["anInspector"],
  2450. source: "inspectOn: anInspector",
  2451. referencedClasses: [],
  2452. messageSends: []
  2453. }),
  2454. $globals.ProtoObject);
  2455. $core.addMethod(
  2456. $core.method({
  2457. selector: "instVarAt:",
  2458. protocol: "accessing",
  2459. fn: function (aString){
  2460. var self=this,$self=this;
  2461. return $core.withContext(function($ctx1) {
  2462. return $self['@'+aString];
  2463. return self;
  2464. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2465. },
  2466. args: ["aString"],
  2467. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2468. referencedClasses: [],
  2469. messageSends: []
  2470. }),
  2471. $globals.ProtoObject);
  2472. $core.addMethod(
  2473. $core.method({
  2474. selector: "instVarAt:put:",
  2475. protocol: "accessing",
  2476. fn: function (aString,anObject){
  2477. var self=this,$self=this;
  2478. return $core.withContext(function($ctx1) {
  2479. $self['@' + aString] = anObject;
  2480. return self;
  2481. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2482. },
  2483. args: ["aString", "anObject"],
  2484. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2485. referencedClasses: [],
  2486. messageSends: []
  2487. }),
  2488. $globals.ProtoObject);
  2489. $core.addMethod(
  2490. $core.method({
  2491. selector: "isKindOf:",
  2492. protocol: "testing",
  2493. fn: function (aClass){
  2494. var self=this,$self=this;
  2495. return $core.withContext(function($ctx1) {
  2496. var $1;
  2497. $1=$self._isMemberOf_(aClass);
  2498. if($core.assert($1)){
  2499. return true;
  2500. } else {
  2501. return $recv($self._class())._inheritsFrom_(aClass);
  2502. }
  2503. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2504. },
  2505. args: ["aClass"],
  2506. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2507. referencedClasses: [],
  2508. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2509. }),
  2510. $globals.ProtoObject);
  2511. $core.addMethod(
  2512. $core.method({
  2513. selector: "isNil",
  2514. protocol: "testing",
  2515. fn: function (){
  2516. var self=this,$self=this;
  2517. return false;
  2518. },
  2519. args: [],
  2520. source: "isNil\x0a\x09^ false",
  2521. referencedClasses: [],
  2522. messageSends: []
  2523. }),
  2524. $globals.ProtoObject);
  2525. $core.addMethod(
  2526. $core.method({
  2527. selector: "isSameInstanceAs:",
  2528. protocol: "comparing",
  2529. fn: function (anObject){
  2530. var self=this,$self=this;
  2531. return $core.withContext(function($ctx1) {
  2532. var $1;
  2533. $1=$self._identityHash();
  2534. $ctx1.sendIdx["identityHash"]=1;
  2535. return $recv($1).__eq($recv(anObject)._identityHash());
  2536. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  2537. },
  2538. args: ["anObject"],
  2539. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  2540. referencedClasses: [],
  2541. messageSends: ["=", "identityHash"]
  2542. }),
  2543. $globals.ProtoObject);
  2544. $core.addMethod(
  2545. $core.method({
  2546. selector: "notNil",
  2547. protocol: "testing",
  2548. fn: function (){
  2549. var self=this,$self=this;
  2550. return $core.withContext(function($ctx1) {
  2551. return $recv($self._isNil())._not();
  2552. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2553. },
  2554. args: [],
  2555. source: "notNil\x0a\x09^ self isNil not",
  2556. referencedClasses: [],
  2557. messageSends: ["not", "isNil"]
  2558. }),
  2559. $globals.ProtoObject);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "perform:",
  2563. protocol: "message handling",
  2564. fn: function (aString){
  2565. var self=this,$self=this;
  2566. return $core.withContext(function($ctx1) {
  2567. return $self._perform_withArguments_(aString,[]);
  2568. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2569. },
  2570. args: ["aString"],
  2571. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2572. referencedClasses: [],
  2573. messageSends: ["perform:withArguments:"]
  2574. }),
  2575. $globals.ProtoObject);
  2576. $core.addMethod(
  2577. $core.method({
  2578. selector: "perform:withArguments:",
  2579. protocol: "message handling",
  2580. fn: function (aString,aCollection){
  2581. var self=this,$self=this;
  2582. return $core.withContext(function($ctx1) {
  2583. return $core.send2(self, aString, aCollection);
  2584. return self;
  2585. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2586. },
  2587. args: ["aString", "aCollection"],
  2588. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2589. referencedClasses: [],
  2590. messageSends: []
  2591. }),
  2592. $globals.ProtoObject);
  2593. $core.addMethod(
  2594. $core.method({
  2595. selector: "printOn:",
  2596. protocol: "printing",
  2597. fn: function (aStream){
  2598. var self=this,$self=this;
  2599. return $core.withContext(function($ctx1) {
  2600. var $5,$4,$3,$2,$1;
  2601. $5=$self._class();
  2602. $ctx1.sendIdx["class"]=1;
  2603. $4=$recv($5)._name();
  2604. $ctx1.sendIdx["name"]=1;
  2605. $3=$recv($4)._first();
  2606. $2=$recv($3)._isVowel();
  2607. if($core.assert($2)){
  2608. $1="an ";
  2609. } else {
  2610. $1="a ";
  2611. }
  2612. $recv(aStream)._nextPutAll_($1);
  2613. $ctx1.sendIdx["nextPutAll:"]=1;
  2614. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  2615. return self;
  2616. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2617. },
  2618. args: ["aStream"],
  2619. source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  2620. referencedClasses: [],
  2621. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2622. }),
  2623. $globals.ProtoObject);
  2624. $core.addMethod(
  2625. $core.method({
  2626. selector: "printString",
  2627. protocol: "printing",
  2628. fn: function (){
  2629. var self=this,$self=this;
  2630. return $core.withContext(function($ctx1) {
  2631. return $recv($globals.String)._streamContents_((function(str){
  2632. return $core.withContext(function($ctx2) {
  2633. return $self._printOn_(str);
  2634. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2635. }));
  2636. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2637. },
  2638. args: [],
  2639. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2640. referencedClasses: ["String"],
  2641. messageSends: ["streamContents:", "printOn:"]
  2642. }),
  2643. $globals.ProtoObject);
  2644. $core.addMethod(
  2645. $core.method({
  2646. selector: "yourself",
  2647. protocol: "accessing",
  2648. fn: function (){
  2649. var self=this,$self=this;
  2650. return self;
  2651. },
  2652. args: [],
  2653. source: "yourself\x0a\x09^ self",
  2654. referencedClasses: [],
  2655. messageSends: []
  2656. }),
  2657. $globals.ProtoObject);
  2658. $core.addMethod(
  2659. $core.method({
  2660. selector: "~=",
  2661. protocol: "comparing",
  2662. fn: function (anObject){
  2663. var self=this,$self=this;
  2664. return $core.withContext(function($ctx1) {
  2665. var $1;
  2666. $1=$recv($self.__eq(anObject)).__eq(false);
  2667. $ctx1.sendIdx["="]=1;
  2668. return $1;
  2669. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  2670. },
  2671. args: ["anObject"],
  2672. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  2673. referencedClasses: [],
  2674. messageSends: ["="]
  2675. }),
  2676. $globals.ProtoObject);
  2677. $core.addMethod(
  2678. $core.method({
  2679. selector: "~~",
  2680. protocol: "comparing",
  2681. fn: function (anObject){
  2682. var self=this,$self=this;
  2683. return $core.withContext(function($ctx1) {
  2684. return $recv($self.__eq_eq(anObject)).__eq(false);
  2685. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  2686. },
  2687. args: ["anObject"],
  2688. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  2689. referencedClasses: [],
  2690. messageSends: ["=", "=="]
  2691. }),
  2692. $globals.ProtoObject);
  2693. $core.addMethod(
  2694. $core.method({
  2695. selector: "initialize",
  2696. protocol: "initialization",
  2697. fn: function (){
  2698. var self=this,$self=this;
  2699. return self;
  2700. },
  2701. args: [],
  2702. source: "initialize",
  2703. referencedClasses: [],
  2704. messageSends: []
  2705. }),
  2706. $globals.ProtoObject.a$cls);
  2707. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  2708. $globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), 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.";
  2709. $core.addMethod(
  2710. $core.method({
  2711. selector: "->",
  2712. protocol: "converting",
  2713. fn: function (anObject){
  2714. var self=this,$self=this;
  2715. return $core.withContext(function($ctx1) {
  2716. return $recv($globals.Association)._key_value_(self,anObject);
  2717. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  2718. },
  2719. args: ["anObject"],
  2720. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  2721. referencedClasses: ["Association"],
  2722. messageSends: ["key:value:"]
  2723. }),
  2724. $globals.Object);
  2725. $core.addMethod(
  2726. $core.method({
  2727. selector: "asJSONString",
  2728. protocol: "converting",
  2729. fn: function (){
  2730. var self=this,$self=this;
  2731. return $core.withContext(function($ctx1) {
  2732. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  2733. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  2734. },
  2735. args: [],
  2736. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  2737. referencedClasses: ["JSON"],
  2738. messageSends: ["stringify:", "asJavaScriptObject"]
  2739. }),
  2740. $globals.Object);
  2741. $core.addMethod(
  2742. $core.method({
  2743. selector: "asJavaScriptObject",
  2744. protocol: "converting",
  2745. fn: function (){
  2746. var self=this,$self=this;
  2747. var variables;
  2748. return $core.withContext(function($ctx1) {
  2749. variables=$recv($globals.HashedCollection)._new();
  2750. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  2751. return $core.withContext(function($ctx2) {
  2752. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  2753. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2754. }));
  2755. return variables;
  2756. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  2757. },
  2758. args: [],
  2759. source: "asJavaScriptObject\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJavaScriptObject ].\x0a\x09^ variables",
  2760. referencedClasses: ["HashedCollection"],
  2761. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  2762. }),
  2763. $globals.Object);
  2764. $core.addMethod(
  2765. $core.method({
  2766. selector: "asJavaScriptSource",
  2767. protocol: "converting",
  2768. fn: function (){
  2769. var self=this,$self=this;
  2770. return $core.withContext(function($ctx1) {
  2771. return $self._asString();
  2772. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  2773. },
  2774. args: [],
  2775. source: "asJavaScriptSource\x0a\x09^ self asString",
  2776. referencedClasses: [],
  2777. messageSends: ["asString"]
  2778. }),
  2779. $globals.Object);
  2780. $core.addMethod(
  2781. $core.method({
  2782. selector: "basicAt:",
  2783. protocol: "accessing",
  2784. fn: function (aString){
  2785. var self=this,$self=this;
  2786. return $core.withContext(function($ctx1) {
  2787. return self[aString];
  2788. return self;
  2789. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  2790. },
  2791. args: ["aString"],
  2792. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  2793. referencedClasses: [],
  2794. messageSends: []
  2795. }),
  2796. $globals.Object);
  2797. $core.addMethod(
  2798. $core.method({
  2799. selector: "basicAt:put:",
  2800. protocol: "accessing",
  2801. fn: function (aString,anObject){
  2802. var self=this,$self=this;
  2803. return $core.withContext(function($ctx1) {
  2804. return self[aString] = anObject;
  2805. return self;
  2806. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  2807. },
  2808. args: ["aString", "anObject"],
  2809. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  2810. referencedClasses: [],
  2811. messageSends: []
  2812. }),
  2813. $globals.Object);
  2814. $core.addMethod(
  2815. $core.method({
  2816. selector: "basicDelete:",
  2817. protocol: "accessing",
  2818. fn: function (aString){
  2819. var self=this,$self=this;
  2820. return $core.withContext(function($ctx1) {
  2821. delete self[aString]; return aString;
  2822. return self;
  2823. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  2824. },
  2825. args: ["aString"],
  2826. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  2827. referencedClasses: [],
  2828. messageSends: []
  2829. }),
  2830. $globals.Object);
  2831. $core.addMethod(
  2832. $core.method({
  2833. selector: "basicPerform:",
  2834. protocol: "message handling",
  2835. fn: function (aString){
  2836. var self=this,$self=this;
  2837. return $core.withContext(function($ctx1) {
  2838. return $self._basicPerform_withArguments_(aString,[]);
  2839. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  2840. },
  2841. args: ["aString"],
  2842. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  2843. referencedClasses: [],
  2844. messageSends: ["basicPerform:withArguments:"]
  2845. }),
  2846. $globals.Object);
  2847. $core.addMethod(
  2848. $core.method({
  2849. selector: "basicPerform:withArguments:",
  2850. protocol: "message handling",
  2851. fn: function (aString,aCollection){
  2852. var self=this,$self=this;
  2853. return $core.withContext(function($ctx1) {
  2854. return self[aString].apply(self, aCollection);;
  2855. return self;
  2856. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  2857. },
  2858. args: ["aString", "aCollection"],
  2859. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  2860. referencedClasses: [],
  2861. messageSends: []
  2862. }),
  2863. $globals.Object);
  2864. $core.addMethod(
  2865. $core.method({
  2866. selector: "browse",
  2867. protocol: "browsing",
  2868. fn: function (){
  2869. var self=this,$self=this;
  2870. return $core.withContext(function($ctx1) {
  2871. $recv($globals.Finder)._findClass_($self._class());
  2872. return self;
  2873. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  2874. },
  2875. args: [],
  2876. source: "browse\x0a\x09Finder findClass: self class",
  2877. referencedClasses: ["Finder"],
  2878. messageSends: ["findClass:", "class"]
  2879. }),
  2880. $globals.Object);
  2881. $core.addMethod(
  2882. $core.method({
  2883. selector: "copy",
  2884. protocol: "copying",
  2885. fn: function (){
  2886. var self=this,$self=this;
  2887. return $core.withContext(function($ctx1) {
  2888. return $recv($self._shallowCopy())._postCopy();
  2889. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  2890. },
  2891. args: [],
  2892. source: "copy\x0a\x09^ self shallowCopy postCopy",
  2893. referencedClasses: [],
  2894. messageSends: ["postCopy", "shallowCopy"]
  2895. }),
  2896. $globals.Object);
  2897. $core.addMethod(
  2898. $core.method({
  2899. selector: "deepCopy",
  2900. protocol: "copying",
  2901. fn: function (){
  2902. var self=this,$self=this;
  2903. return $core.withContext(function($ctx1) {
  2904. var copy = self.a$cls._new();
  2905. Object.keys(self).forEach(function (i) {
  2906. if(/^@.+/.test(i)) {
  2907. copy[i] = $recv(self[i])._deepCopy();
  2908. }
  2909. });
  2910. return copy;
  2911. ;
  2912. return self;
  2913. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  2914. },
  2915. args: [],
  2916. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = $recv(self[i])._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  2917. referencedClasses: [],
  2918. messageSends: []
  2919. }),
  2920. $globals.Object);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "deprecatedAPI",
  2924. protocol: "error handling",
  2925. fn: function (){
  2926. var self=this,$self=this;
  2927. return $core.withContext(function($ctx1) {
  2928. var $1,$6,$5,$4,$8,$7,$3,$2;
  2929. $1=console;
  2930. $6=$core.getThisContext()._home();
  2931. $ctx1.sendIdx["home"]=1;
  2932. $5=$recv($6)._asString();
  2933. $ctx1.sendIdx["asString"]=1;
  2934. $4=$recv($5).__comma(" is deprecated! (in ");
  2935. $8=$recv($core.getThisContext()._home())._home();
  2936. $ctx1.sendIdx["home"]=2;
  2937. $7=$recv($8)._asString();
  2938. $3=$recv($4).__comma($7);
  2939. $ctx1.sendIdx[","]=2;
  2940. $2=$recv($3).__comma(")");
  2941. $ctx1.sendIdx[","]=1;
  2942. $recv($1)._warn_($2);
  2943. return self;
  2944. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  2945. },
  2946. args: [],
  2947. 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, ')'.",
  2948. referencedClasses: [],
  2949. messageSends: ["warn:", ",", "asString", "home"]
  2950. }),
  2951. $globals.Object);
  2952. $core.addMethod(
  2953. $core.method({
  2954. selector: "deprecatedAPI:",
  2955. protocol: "error handling",
  2956. fn: function (aString){
  2957. var self=this,$self=this;
  2958. return $core.withContext(function($ctx1) {
  2959. var $1,$6,$5,$4,$8,$7,$3,$2;
  2960. $1=console;
  2961. $6=$core.getThisContext()._home();
  2962. $ctx1.sendIdx["home"]=1;
  2963. $5=$recv($6)._asString();
  2964. $ctx1.sendIdx["asString"]=1;
  2965. $4=$recv($5).__comma(" is deprecated! (in ");
  2966. $8=$recv($core.getThisContext()._home())._home();
  2967. $ctx1.sendIdx["home"]=2;
  2968. $7=$recv($8)._asString();
  2969. $3=$recv($4).__comma($7);
  2970. $ctx1.sendIdx[","]=2;
  2971. $2=$recv($3).__comma(")");
  2972. $ctx1.sendIdx[","]=1;
  2973. $recv($1)._warn_($2);
  2974. $ctx1.sendIdx["warn:"]=1;
  2975. $recv(console)._warn_(aString);
  2976. return self;
  2977. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  2978. },
  2979. args: ["aString"],
  2980. source: "deprecatedAPI: aString\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, ')'.\x0a\x09console warn: aString",
  2981. referencedClasses: [],
  2982. messageSends: ["warn:", ",", "asString", "home"]
  2983. }),
  2984. $globals.Object);
  2985. $core.addMethod(
  2986. $core.method({
  2987. selector: "error:",
  2988. protocol: "error handling",
  2989. fn: function (aString){
  2990. var self=this,$self=this;
  2991. return $core.withContext(function($ctx1) {
  2992. $recv($globals.Error)._signal_(aString);
  2993. return self;
  2994. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  2995. },
  2996. args: ["aString"],
  2997. source: "error: aString\x0a\x09Error signal: aString",
  2998. referencedClasses: ["Error"],
  2999. messageSends: ["signal:"]
  3000. }),
  3001. $globals.Object);
  3002. $core.addMethod(
  3003. $core.method({
  3004. selector: "halt",
  3005. protocol: "error handling",
  3006. fn: function (){
  3007. var self=this,$self=this;
  3008. return $core.withContext(function($ctx1) {
  3009. $recv($globals.Halt)._signal();
  3010. return self;
  3011. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3012. },
  3013. args: [],
  3014. source: "halt\x0a\x09Halt signal",
  3015. referencedClasses: ["Halt"],
  3016. messageSends: ["signal"]
  3017. }),
  3018. $globals.Object);
  3019. $core.addMethod(
  3020. $core.method({
  3021. selector: "in:",
  3022. protocol: "evaluating",
  3023. fn: function (aValuable){
  3024. var self=this,$self=this;
  3025. return $core.withContext(function($ctx1) {
  3026. return $recv(aValuable)._value_(self);
  3027. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3028. },
  3029. args: ["aValuable"],
  3030. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3031. referencedClasses: [],
  3032. messageSends: ["value:"]
  3033. }),
  3034. $globals.Object);
  3035. $core.addMethod(
  3036. $core.method({
  3037. selector: "isBehavior",
  3038. protocol: "testing",
  3039. fn: function (){
  3040. var self=this,$self=this;
  3041. return false;
  3042. },
  3043. args: [],
  3044. source: "isBehavior\x0a\x09^ false",
  3045. referencedClasses: [],
  3046. messageSends: []
  3047. }),
  3048. $globals.Object);
  3049. $core.addMethod(
  3050. $core.method({
  3051. selector: "isBoolean",
  3052. protocol: "testing",
  3053. fn: function (){
  3054. var self=this,$self=this;
  3055. return false;
  3056. },
  3057. args: [],
  3058. source: "isBoolean\x0a\x09^ false",
  3059. referencedClasses: [],
  3060. messageSends: []
  3061. }),
  3062. $globals.Object);
  3063. $core.addMethod(
  3064. $core.method({
  3065. selector: "isClass",
  3066. protocol: "testing",
  3067. fn: function (){
  3068. var self=this,$self=this;
  3069. return false;
  3070. },
  3071. args: [],
  3072. source: "isClass\x0a\x09^ false",
  3073. referencedClasses: [],
  3074. messageSends: []
  3075. }),
  3076. $globals.Object);
  3077. $core.addMethod(
  3078. $core.method({
  3079. selector: "isCompiledMethod",
  3080. protocol: "testing",
  3081. fn: function (){
  3082. var self=this,$self=this;
  3083. return false;
  3084. },
  3085. args: [],
  3086. source: "isCompiledMethod\x0a\x09^ false",
  3087. referencedClasses: [],
  3088. messageSends: []
  3089. }),
  3090. $globals.Object);
  3091. $core.addMethod(
  3092. $core.method({
  3093. selector: "isImmutable",
  3094. protocol: "testing",
  3095. fn: function (){
  3096. var self=this,$self=this;
  3097. return false;
  3098. },
  3099. args: [],
  3100. source: "isImmutable\x0a\x09^ false",
  3101. referencedClasses: [],
  3102. messageSends: []
  3103. }),
  3104. $globals.Object);
  3105. $core.addMethod(
  3106. $core.method({
  3107. selector: "isMemberOf:",
  3108. protocol: "testing",
  3109. fn: function (aClass){
  3110. var self=this,$self=this;
  3111. return $core.withContext(function($ctx1) {
  3112. return $recv($self._class()).__eq(aClass);
  3113. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3114. },
  3115. args: ["aClass"],
  3116. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3117. referencedClasses: [],
  3118. messageSends: ["=", "class"]
  3119. }),
  3120. $globals.Object);
  3121. $core.addMethod(
  3122. $core.method({
  3123. selector: "isMetaclass",
  3124. protocol: "testing",
  3125. fn: function (){
  3126. var self=this,$self=this;
  3127. return false;
  3128. },
  3129. args: [],
  3130. source: "isMetaclass\x0a\x09^ false",
  3131. referencedClasses: [],
  3132. messageSends: []
  3133. }),
  3134. $globals.Object);
  3135. $core.addMethod(
  3136. $core.method({
  3137. selector: "isNumber",
  3138. protocol: "testing",
  3139. fn: function (){
  3140. var self=this,$self=this;
  3141. return false;
  3142. },
  3143. args: [],
  3144. source: "isNumber\x0a\x09^ false",
  3145. referencedClasses: [],
  3146. messageSends: []
  3147. }),
  3148. $globals.Object);
  3149. $core.addMethod(
  3150. $core.method({
  3151. selector: "isPackage",
  3152. protocol: "testing",
  3153. fn: function (){
  3154. var self=this,$self=this;
  3155. return false;
  3156. },
  3157. args: [],
  3158. source: "isPackage\x0a\x09^ false",
  3159. referencedClasses: [],
  3160. messageSends: []
  3161. }),
  3162. $globals.Object);
  3163. $core.addMethod(
  3164. $core.method({
  3165. selector: "isParseFailure",
  3166. protocol: "testing",
  3167. fn: function (){
  3168. var self=this,$self=this;
  3169. return false;
  3170. },
  3171. args: [],
  3172. source: "isParseFailure\x0a\x09^ false",
  3173. referencedClasses: [],
  3174. messageSends: []
  3175. }),
  3176. $globals.Object);
  3177. $core.addMethod(
  3178. $core.method({
  3179. selector: "isString",
  3180. protocol: "testing",
  3181. fn: function (){
  3182. var self=this,$self=this;
  3183. return false;
  3184. },
  3185. args: [],
  3186. source: "isString\x0a\x09^ false",
  3187. referencedClasses: [],
  3188. messageSends: []
  3189. }),
  3190. $globals.Object);
  3191. $core.addMethod(
  3192. $core.method({
  3193. selector: "isSymbol",
  3194. protocol: "testing",
  3195. fn: function (){
  3196. var self=this,$self=this;
  3197. return false;
  3198. },
  3199. args: [],
  3200. source: "isSymbol\x0a\x09^ false",
  3201. referencedClasses: [],
  3202. messageSends: []
  3203. }),
  3204. $globals.Object);
  3205. $core.addMethod(
  3206. $core.method({
  3207. selector: "postCopy",
  3208. protocol: "copying",
  3209. fn: function (){
  3210. var self=this,$self=this;
  3211. return self;
  3212. },
  3213. args: [],
  3214. source: "postCopy",
  3215. referencedClasses: [],
  3216. messageSends: []
  3217. }),
  3218. $globals.Object);
  3219. $core.addMethod(
  3220. $core.method({
  3221. selector: "putOn:",
  3222. protocol: "streaming",
  3223. fn: function (aStream){
  3224. var self=this,$self=this;
  3225. return $core.withContext(function($ctx1) {
  3226. $recv(aStream)._nextPut_(self);
  3227. return self;
  3228. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3229. },
  3230. args: ["aStream"],
  3231. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3232. referencedClasses: [],
  3233. messageSends: ["nextPut:"]
  3234. }),
  3235. $globals.Object);
  3236. $core.addMethod(
  3237. $core.method({
  3238. selector: "respondsTo:",
  3239. protocol: "testing",
  3240. fn: function (aSelector){
  3241. var self=this,$self=this;
  3242. return $core.withContext(function($ctx1) {
  3243. return $recv($self._class())._canUnderstand_(aSelector);
  3244. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3245. },
  3246. args: ["aSelector"],
  3247. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3248. referencedClasses: [],
  3249. messageSends: ["canUnderstand:", "class"]
  3250. }),
  3251. $globals.Object);
  3252. $core.addMethod(
  3253. $core.method({
  3254. selector: "shallowCopy",
  3255. protocol: "copying",
  3256. fn: function (){
  3257. var self=this,$self=this;
  3258. return $core.withContext(function($ctx1) {
  3259. var copy = self.a$cls._new();
  3260. Object.keys(self).forEach(function(i) {
  3261. if(/^@.+/.test(i)) {
  3262. copy[i] = self[i];
  3263. }
  3264. });
  3265. return copy;
  3266. ;
  3267. return self;
  3268. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3269. },
  3270. args: [],
  3271. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3272. referencedClasses: [],
  3273. messageSends: []
  3274. }),
  3275. $globals.Object);
  3276. $core.addMethod(
  3277. $core.method({
  3278. selector: "shouldNotImplement",
  3279. protocol: "error handling",
  3280. fn: function (){
  3281. var self=this,$self=this;
  3282. return $core.withContext(function($ctx1) {
  3283. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3284. return self;
  3285. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3286. },
  3287. args: [],
  3288. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3289. referencedClasses: [],
  3290. messageSends: ["error:", ",", "name", "class"]
  3291. }),
  3292. $globals.Object);
  3293. $core.addMethod(
  3294. $core.method({
  3295. selector: "size",
  3296. protocol: "accessing",
  3297. fn: function (){
  3298. var self=this,$self=this;
  3299. return $core.withContext(function($ctx1) {
  3300. $self._error_("Object not indexable");
  3301. return self;
  3302. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3303. },
  3304. args: [],
  3305. source: "size\x0a\x09self error: 'Object not indexable'",
  3306. referencedClasses: [],
  3307. messageSends: ["error:"]
  3308. }),
  3309. $globals.Object);
  3310. $core.addMethod(
  3311. $core.method({
  3312. selector: "subclassResponsibility",
  3313. protocol: "error handling",
  3314. fn: function (){
  3315. var self=this,$self=this;
  3316. return $core.withContext(function($ctx1) {
  3317. $self._error_("This method is a responsibility of a subclass");
  3318. return self;
  3319. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3320. },
  3321. args: [],
  3322. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3323. referencedClasses: [],
  3324. messageSends: ["error:"]
  3325. }),
  3326. $globals.Object);
  3327. $core.addMethod(
  3328. $core.method({
  3329. selector: "value",
  3330. protocol: "evaluating",
  3331. fn: function (){
  3332. var self=this,$self=this;
  3333. return $core.withContext(function($ctx1) {
  3334. return self.valueOf();
  3335. return self;
  3336. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3337. },
  3338. args: [],
  3339. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3340. referencedClasses: [],
  3341. messageSends: []
  3342. }),
  3343. $globals.Object);
  3344. $core.addMethod(
  3345. $core.method({
  3346. selector: "accessorProtocolWith:",
  3347. protocol: "helios",
  3348. fn: function (aGenerator){
  3349. var self=this,$self=this;
  3350. return $core.withContext(function($ctx1) {
  3351. $recv(aGenerator)._accessorProtocolForObject();
  3352. return self;
  3353. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3354. },
  3355. args: ["aGenerator"],
  3356. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3357. referencedClasses: [],
  3358. messageSends: ["accessorProtocolForObject"]
  3359. }),
  3360. $globals.Object.a$cls);
  3361. $core.addMethod(
  3362. $core.method({
  3363. selector: "accessorsSourceCodesWith:",
  3364. protocol: "helios",
  3365. fn: function (aGenerator){
  3366. var self=this,$self=this;
  3367. return $core.withContext(function($ctx1) {
  3368. $recv(aGenerator)._accessorsForObject();
  3369. return self;
  3370. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3371. },
  3372. args: ["aGenerator"],
  3373. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3374. referencedClasses: [],
  3375. messageSends: ["accessorsForObject"]
  3376. }),
  3377. $globals.Object.a$cls);
  3378. $core.addMethod(
  3379. $core.method({
  3380. selector: "initialize",
  3381. protocol: "initialization",
  3382. fn: function (){
  3383. var self=this,$self=this;
  3384. return self;
  3385. },
  3386. args: [],
  3387. source: "initialize\x0a\x09\x22no op\x22",
  3388. referencedClasses: [],
  3389. messageSends: []
  3390. }),
  3391. $globals.Object.a$cls);
  3392. $core.addMethod(
  3393. $core.method({
  3394. selector: "initializeProtocolWith:",
  3395. protocol: "helios",
  3396. fn: function (aGenerator){
  3397. var self=this,$self=this;
  3398. return $core.withContext(function($ctx1) {
  3399. $recv(aGenerator)._initializeProtocolForObject();
  3400. return self;
  3401. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3402. },
  3403. args: ["aGenerator"],
  3404. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3405. referencedClasses: [],
  3406. messageSends: ["initializeProtocolForObject"]
  3407. }),
  3408. $globals.Object.a$cls);
  3409. $core.addMethod(
  3410. $core.method({
  3411. selector: "initializeSourceCodesWith:",
  3412. protocol: "helios",
  3413. fn: function (aGenerator){
  3414. var self=this,$self=this;
  3415. return $core.withContext(function($ctx1) {
  3416. $recv(aGenerator)._initializeForObject();
  3417. return self;
  3418. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3419. },
  3420. args: ["aGenerator"],
  3421. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3422. referencedClasses: [],
  3423. messageSends: ["initializeForObject"]
  3424. }),
  3425. $globals.Object.a$cls);
  3426. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3427. $globals.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: [ ... ]";
  3428. $core.addMethod(
  3429. $core.method({
  3430. selector: "&",
  3431. protocol: "controlling",
  3432. fn: function (aBoolean){
  3433. var self=this,$self=this;
  3434. return $core.withContext(function($ctx1) {
  3435. if(self == true) {
  3436. return aBoolean;
  3437. } else {
  3438. return false;
  3439. }
  3440. ;
  3441. return self;
  3442. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3443. },
  3444. args: ["aBoolean"],
  3445. source: "& aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09'>",
  3446. referencedClasses: [],
  3447. messageSends: []
  3448. }),
  3449. $globals.Boolean);
  3450. $core.addMethod(
  3451. $core.method({
  3452. selector: "==",
  3453. protocol: "comparing",
  3454. fn: function (aBoolean){
  3455. var self=this,$self=this;
  3456. return $core.withContext(function($ctx1) {
  3457. if (typeof aBoolean === "boolean") return self.valueOf() === aBoolean;
  3458. else if (aBoolean != null && typeof aBoolean === "object") return self.valueOf() === aBoolean.valueOf();
  3459. else return false;;
  3460. return self;
  3461. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3462. },
  3463. args: ["aBoolean"],
  3464. source: "== aBoolean\x0a<inlineJS: '\x0a\x09if (typeof aBoolean === \x22boolean\x22) return self.valueOf() === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return self.valueOf() === aBoolean.valueOf();\x0a\x09else return false;\x0a'>",
  3465. referencedClasses: [],
  3466. messageSends: []
  3467. }),
  3468. $globals.Boolean);
  3469. $core.addMethod(
  3470. $core.method({
  3471. selector: "and:",
  3472. protocol: "controlling",
  3473. fn: function (aBlock){
  3474. var self=this,$self=this;
  3475. return $core.withContext(function($ctx1) {
  3476. if($core.assert(self)){
  3477. return $recv(aBlock)._value();
  3478. } else {
  3479. return false;
  3480. }
  3481. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3482. },
  3483. args: ["aBlock"],
  3484. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3485. referencedClasses: [],
  3486. messageSends: ["ifTrue:ifFalse:", "value"]
  3487. }),
  3488. $globals.Boolean);
  3489. $core.addMethod(
  3490. $core.method({
  3491. selector: "asBit",
  3492. protocol: "converting",
  3493. fn: function (){
  3494. var self=this,$self=this;
  3495. return $core.withContext(function($ctx1) {
  3496. if($core.assert(self)){
  3497. return (1);
  3498. } else {
  3499. return (0);
  3500. }
  3501. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3502. },
  3503. args: [],
  3504. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3505. referencedClasses: [],
  3506. messageSends: ["ifTrue:ifFalse:"]
  3507. }),
  3508. $globals.Boolean);
  3509. $core.addMethod(
  3510. $core.method({
  3511. selector: "asJavaScriptObject",
  3512. protocol: "converting",
  3513. fn: function (){
  3514. var self=this,$self=this;
  3515. return self;
  3516. },
  3517. args: [],
  3518. source: "asJavaScriptObject\x0a\x09^ self",
  3519. referencedClasses: [],
  3520. messageSends: []
  3521. }),
  3522. $globals.Boolean);
  3523. $core.addMethod(
  3524. $core.method({
  3525. selector: "asString",
  3526. protocol: "converting",
  3527. fn: function (){
  3528. var self=this,$self=this;
  3529. return $core.withContext(function($ctx1) {
  3530. return self.toString();
  3531. return self;
  3532. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3533. },
  3534. args: [],
  3535. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3536. referencedClasses: [],
  3537. messageSends: []
  3538. }),
  3539. $globals.Boolean);
  3540. $core.addMethod(
  3541. $core.method({
  3542. selector: "deepCopy",
  3543. protocol: "copying",
  3544. fn: function (){
  3545. var self=this,$self=this;
  3546. return self;
  3547. },
  3548. args: [],
  3549. source: "deepCopy\x0a\x09^ self",
  3550. referencedClasses: [],
  3551. messageSends: []
  3552. }),
  3553. $globals.Boolean);
  3554. $core.addMethod(
  3555. $core.method({
  3556. selector: "ifFalse:",
  3557. protocol: "controlling",
  3558. fn: function (aBlock){
  3559. var self=this,$self=this;
  3560. return $core.withContext(function($ctx1) {
  3561. return $self._ifTrue_ifFalse_((function(){
  3562. }),aBlock);
  3563. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3564. },
  3565. args: ["aBlock"],
  3566. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3567. referencedClasses: [],
  3568. messageSends: ["ifTrue:ifFalse:"]
  3569. }),
  3570. $globals.Boolean);
  3571. $core.addMethod(
  3572. $core.method({
  3573. selector: "ifFalse:ifTrue:",
  3574. protocol: "controlling",
  3575. fn: function (aBlock,anotherBlock){
  3576. var self=this,$self=this;
  3577. return $core.withContext(function($ctx1) {
  3578. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3579. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3580. },
  3581. args: ["aBlock", "anotherBlock"],
  3582. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3583. referencedClasses: [],
  3584. messageSends: ["ifTrue:ifFalse:"]
  3585. }),
  3586. $globals.Boolean);
  3587. $core.addMethod(
  3588. $core.method({
  3589. selector: "ifTrue:",
  3590. protocol: "controlling",
  3591. fn: function (aBlock){
  3592. var self=this,$self=this;
  3593. return $core.withContext(function($ctx1) {
  3594. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3595. }));
  3596. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3597. },
  3598. args: ["aBlock"],
  3599. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3600. referencedClasses: [],
  3601. messageSends: ["ifTrue:ifFalse:"]
  3602. }),
  3603. $globals.Boolean);
  3604. $core.addMethod(
  3605. $core.method({
  3606. selector: "ifTrue:ifFalse:",
  3607. protocol: "controlling",
  3608. fn: function (aBlock,anotherBlock){
  3609. var self=this,$self=this;
  3610. return $core.withContext(function($ctx1) {
  3611. if(self == true) {
  3612. return aBlock._value();
  3613. } else {
  3614. return anotherBlock._value();
  3615. }
  3616. ;
  3617. return self;
  3618. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3619. },
  3620. args: ["aBlock", "anotherBlock"],
  3621. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09'>",
  3622. referencedClasses: [],
  3623. messageSends: []
  3624. }),
  3625. $globals.Boolean);
  3626. $core.addMethod(
  3627. $core.method({
  3628. selector: "isBoolean",
  3629. protocol: "testing",
  3630. fn: function (){
  3631. var self=this,$self=this;
  3632. return true;
  3633. },
  3634. args: [],
  3635. source: "isBoolean\x0a\x09^ true",
  3636. referencedClasses: [],
  3637. messageSends: []
  3638. }),
  3639. $globals.Boolean);
  3640. $core.addMethod(
  3641. $core.method({
  3642. selector: "isImmutable",
  3643. protocol: "testing",
  3644. fn: function (){
  3645. var self=this,$self=this;
  3646. return true;
  3647. },
  3648. args: [],
  3649. source: "isImmutable\x0a\x09^ true",
  3650. referencedClasses: [],
  3651. messageSends: []
  3652. }),
  3653. $globals.Boolean);
  3654. $core.addMethod(
  3655. $core.method({
  3656. selector: "not",
  3657. protocol: "controlling",
  3658. fn: function (){
  3659. var self=this,$self=this;
  3660. return $core.withContext(function($ctx1) {
  3661. return $self.__eq(false);
  3662. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  3663. },
  3664. args: [],
  3665. source: "not\x0a\x09^ self = false",
  3666. referencedClasses: [],
  3667. messageSends: ["="]
  3668. }),
  3669. $globals.Boolean);
  3670. $core.addMethod(
  3671. $core.method({
  3672. selector: "or:",
  3673. protocol: "controlling",
  3674. fn: function (aBlock){
  3675. var self=this,$self=this;
  3676. return $core.withContext(function($ctx1) {
  3677. if($core.assert(self)){
  3678. return true;
  3679. } else {
  3680. return $recv(aBlock)._value();
  3681. }
  3682. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  3683. },
  3684. args: ["aBlock"],
  3685. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  3686. referencedClasses: [],
  3687. messageSends: ["ifTrue:ifFalse:", "value"]
  3688. }),
  3689. $globals.Boolean);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "printOn:",
  3693. protocol: "printing",
  3694. fn: function (aStream){
  3695. var self=this,$self=this;
  3696. return $core.withContext(function($ctx1) {
  3697. $recv(aStream)._nextPutAll_($self._asString());
  3698. return self;
  3699. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  3700. },
  3701. args: ["aStream"],
  3702. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3703. referencedClasses: [],
  3704. messageSends: ["nextPutAll:", "asString"]
  3705. }),
  3706. $globals.Boolean);
  3707. $core.addMethod(
  3708. $core.method({
  3709. selector: "shallowCopy",
  3710. protocol: "copying",
  3711. fn: function (){
  3712. var self=this,$self=this;
  3713. return self;
  3714. },
  3715. args: [],
  3716. source: "shallowCopy\x0a\x09^ self",
  3717. referencedClasses: [],
  3718. messageSends: []
  3719. }),
  3720. $globals.Boolean);
  3721. $core.addMethod(
  3722. $core.method({
  3723. selector: "|",
  3724. protocol: "controlling",
  3725. fn: function (aBoolean){
  3726. var self=this,$self=this;
  3727. return $core.withContext(function($ctx1) {
  3728. if(self == true) {
  3729. return true;
  3730. } else {
  3731. return aBoolean;
  3732. }
  3733. ;
  3734. return self;
  3735. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  3736. },
  3737. args: ["aBoolean"],
  3738. source: "| aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09'>",
  3739. referencedClasses: [],
  3740. messageSends: []
  3741. }),
  3742. $globals.Boolean);
  3743. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  3744. $globals.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.).";
  3745. $core.addMethod(
  3746. $core.method({
  3747. selector: "+",
  3748. protocol: "arithmetic",
  3749. fn: function (aDate){
  3750. var self=this,$self=this;
  3751. return $core.withContext(function($ctx1) {
  3752. return self + aDate;
  3753. return self;
  3754. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  3755. },
  3756. args: ["aDate"],
  3757. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  3758. referencedClasses: [],
  3759. messageSends: []
  3760. }),
  3761. $globals.Date);
  3762. $core.addMethod(
  3763. $core.method({
  3764. selector: "-",
  3765. protocol: "arithmetic",
  3766. fn: function (aDate){
  3767. var self=this,$self=this;
  3768. return $core.withContext(function($ctx1) {
  3769. return self - aDate;
  3770. return self;
  3771. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  3772. },
  3773. args: ["aDate"],
  3774. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  3775. referencedClasses: [],
  3776. messageSends: []
  3777. }),
  3778. $globals.Date);
  3779. $core.addMethod(
  3780. $core.method({
  3781. selector: "<",
  3782. protocol: "comparing",
  3783. fn: function (aDate){
  3784. var self=this,$self=this;
  3785. return $core.withContext(function($ctx1) {
  3786. return self < aDate;
  3787. return self;
  3788. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  3789. },
  3790. args: ["aDate"],
  3791. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  3792. referencedClasses: [],
  3793. messageSends: []
  3794. }),
  3795. $globals.Date);
  3796. $core.addMethod(
  3797. $core.method({
  3798. selector: "<=",
  3799. protocol: "comparing",
  3800. fn: function (aDate){
  3801. var self=this,$self=this;
  3802. return $core.withContext(function($ctx1) {
  3803. return self <= aDate;
  3804. return self;
  3805. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  3806. },
  3807. args: ["aDate"],
  3808. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  3809. referencedClasses: [],
  3810. messageSends: []
  3811. }),
  3812. $globals.Date);
  3813. $core.addMethod(
  3814. $core.method({
  3815. selector: "=",
  3816. protocol: "comparing",
  3817. fn: function (aDate){
  3818. var self=this,$self=this;
  3819. return $core.withContext(function($ctx1) {
  3820. var $2,$1,$3;
  3821. $2=$recv(aDate)._class();
  3822. $ctx1.sendIdx["class"]=1;
  3823. $1=$recv($2).__eq_eq($self._class());
  3824. $ctx1.sendIdx["=="]=1;
  3825. return $recv($1)._and_((function(){
  3826. return $core.withContext(function($ctx2) {
  3827. $3=$self._asMilliseconds();
  3828. $ctx2.sendIdx["asMilliseconds"]=1;
  3829. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  3830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3831. }));
  3832. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  3833. },
  3834. args: ["aDate"],
  3835. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  3836. referencedClasses: [],
  3837. messageSends: ["and:", "==", "class", "asMilliseconds"]
  3838. }),
  3839. $globals.Date);
  3840. $core.addMethod(
  3841. $core.method({
  3842. selector: ">",
  3843. protocol: "comparing",
  3844. fn: function (aDate){
  3845. var self=this,$self=this;
  3846. return $core.withContext(function($ctx1) {
  3847. return self > aDate;
  3848. return self;
  3849. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  3850. },
  3851. args: ["aDate"],
  3852. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  3853. referencedClasses: [],
  3854. messageSends: []
  3855. }),
  3856. $globals.Date);
  3857. $core.addMethod(
  3858. $core.method({
  3859. selector: ">=",
  3860. protocol: "comparing",
  3861. fn: function (aDate){
  3862. var self=this,$self=this;
  3863. return $core.withContext(function($ctx1) {
  3864. return self >= aDate;
  3865. return self;
  3866. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  3867. },
  3868. args: ["aDate"],
  3869. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  3870. referencedClasses: [],
  3871. messageSends: []
  3872. }),
  3873. $globals.Date);
  3874. $core.addMethod(
  3875. $core.method({
  3876. selector: "asDateString",
  3877. protocol: "converting",
  3878. fn: function (){
  3879. var self=this,$self=this;
  3880. return $core.withContext(function($ctx1) {
  3881. return self.toDateString();
  3882. return self;
  3883. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  3884. },
  3885. args: [],
  3886. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  3887. referencedClasses: [],
  3888. messageSends: []
  3889. }),
  3890. $globals.Date);
  3891. $core.addMethod(
  3892. $core.method({
  3893. selector: "asLocaleString",
  3894. protocol: "converting",
  3895. fn: function (){
  3896. var self=this,$self=this;
  3897. return $core.withContext(function($ctx1) {
  3898. return self.toLocaleString();
  3899. return self;
  3900. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  3901. },
  3902. args: [],
  3903. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  3904. referencedClasses: [],
  3905. messageSends: []
  3906. }),
  3907. $globals.Date);
  3908. $core.addMethod(
  3909. $core.method({
  3910. selector: "asMilliseconds",
  3911. protocol: "converting",
  3912. fn: function (){
  3913. var self=this,$self=this;
  3914. return $core.withContext(function($ctx1) {
  3915. return $self._time();
  3916. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  3917. },
  3918. args: [],
  3919. source: "asMilliseconds\x0a\x09^ self time",
  3920. referencedClasses: [],
  3921. messageSends: ["time"]
  3922. }),
  3923. $globals.Date);
  3924. $core.addMethod(
  3925. $core.method({
  3926. selector: "asNumber",
  3927. protocol: "converting",
  3928. fn: function (){
  3929. var self=this,$self=this;
  3930. return $core.withContext(function($ctx1) {
  3931. return $self._asMilliseconds();
  3932. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  3933. },
  3934. args: [],
  3935. source: "asNumber\x0a\x09^ self asMilliseconds",
  3936. referencedClasses: [],
  3937. messageSends: ["asMilliseconds"]
  3938. }),
  3939. $globals.Date);
  3940. $core.addMethod(
  3941. $core.method({
  3942. selector: "asString",
  3943. protocol: "converting",
  3944. fn: function (){
  3945. var self=this,$self=this;
  3946. return $core.withContext(function($ctx1) {
  3947. return self.toString();
  3948. return self;
  3949. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  3950. },
  3951. args: [],
  3952. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3953. referencedClasses: [],
  3954. messageSends: []
  3955. }),
  3956. $globals.Date);
  3957. $core.addMethod(
  3958. $core.method({
  3959. selector: "asTimeString",
  3960. protocol: "converting",
  3961. fn: function (){
  3962. var self=this,$self=this;
  3963. return $core.withContext(function($ctx1) {
  3964. return self.toTimeString();
  3965. return self;
  3966. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  3967. },
  3968. args: [],
  3969. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  3970. referencedClasses: [],
  3971. messageSends: []
  3972. }),
  3973. $globals.Date);
  3974. $core.addMethod(
  3975. $core.method({
  3976. selector: "day",
  3977. protocol: "accessing",
  3978. fn: function (){
  3979. var self=this,$self=this;
  3980. return $core.withContext(function($ctx1) {
  3981. return $self._dayOfWeek();
  3982. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  3983. },
  3984. args: [],
  3985. source: "day\x0a\x09^ self dayOfWeek",
  3986. referencedClasses: [],
  3987. messageSends: ["dayOfWeek"]
  3988. }),
  3989. $globals.Date);
  3990. $core.addMethod(
  3991. $core.method({
  3992. selector: "day:",
  3993. protocol: "accessing",
  3994. fn: function (aNumber){
  3995. var self=this,$self=this;
  3996. return $core.withContext(function($ctx1) {
  3997. $self._dayOfWeek_(aNumber);
  3998. return self;
  3999. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4000. },
  4001. args: ["aNumber"],
  4002. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4003. referencedClasses: [],
  4004. messageSends: ["dayOfWeek:"]
  4005. }),
  4006. $globals.Date);
  4007. $core.addMethod(
  4008. $core.method({
  4009. selector: "dayOfMonth",
  4010. protocol: "accessing",
  4011. fn: function (){
  4012. var self=this,$self=this;
  4013. return $core.withContext(function($ctx1) {
  4014. return self.getDate();
  4015. return self;
  4016. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4017. },
  4018. args: [],
  4019. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4020. referencedClasses: [],
  4021. messageSends: []
  4022. }),
  4023. $globals.Date);
  4024. $core.addMethod(
  4025. $core.method({
  4026. selector: "dayOfMonth:",
  4027. protocol: "accessing",
  4028. fn: function (aNumber){
  4029. var self=this,$self=this;
  4030. return $core.withContext(function($ctx1) {
  4031. self.setDate(aNumber);
  4032. return self;
  4033. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4034. },
  4035. args: ["aNumber"],
  4036. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4037. referencedClasses: [],
  4038. messageSends: []
  4039. }),
  4040. $globals.Date);
  4041. $core.addMethod(
  4042. $core.method({
  4043. selector: "dayOfWeek",
  4044. protocol: "accessing",
  4045. fn: function (){
  4046. var self=this,$self=this;
  4047. return $core.withContext(function($ctx1) {
  4048. return self.getDay() + 1;
  4049. return self;
  4050. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4051. },
  4052. args: [],
  4053. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4054. referencedClasses: [],
  4055. messageSends: []
  4056. }),
  4057. $globals.Date);
  4058. $core.addMethod(
  4059. $core.method({
  4060. selector: "dayOfWeek:",
  4061. protocol: "accessing",
  4062. fn: function (aNumber){
  4063. var self=this,$self=this;
  4064. return $core.withContext(function($ctx1) {
  4065. return self.setDay(aNumber - 1);
  4066. return self;
  4067. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4068. },
  4069. args: ["aNumber"],
  4070. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4071. referencedClasses: [],
  4072. messageSends: []
  4073. }),
  4074. $globals.Date);
  4075. $core.addMethod(
  4076. $core.method({
  4077. selector: "hours",
  4078. protocol: "accessing",
  4079. fn: function (){
  4080. var self=this,$self=this;
  4081. return $core.withContext(function($ctx1) {
  4082. return self.getHours();
  4083. return self;
  4084. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4085. },
  4086. args: [],
  4087. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4088. referencedClasses: [],
  4089. messageSends: []
  4090. }),
  4091. $globals.Date);
  4092. $core.addMethod(
  4093. $core.method({
  4094. selector: "hours:",
  4095. protocol: "accessing",
  4096. fn: function (aNumber){
  4097. var self=this,$self=this;
  4098. return $core.withContext(function($ctx1) {
  4099. self.setHours(aNumber);
  4100. return self;
  4101. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4102. },
  4103. args: ["aNumber"],
  4104. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4105. referencedClasses: [],
  4106. messageSends: []
  4107. }),
  4108. $globals.Date);
  4109. $core.addMethod(
  4110. $core.method({
  4111. selector: "milliseconds",
  4112. protocol: "accessing",
  4113. fn: function (){
  4114. var self=this,$self=this;
  4115. return $core.withContext(function($ctx1) {
  4116. return self.getMilliseconds();
  4117. return self;
  4118. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4119. },
  4120. args: [],
  4121. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4122. referencedClasses: [],
  4123. messageSends: []
  4124. }),
  4125. $globals.Date);
  4126. $core.addMethod(
  4127. $core.method({
  4128. selector: "milliseconds:",
  4129. protocol: "accessing",
  4130. fn: function (aNumber){
  4131. var self=this,$self=this;
  4132. return $core.withContext(function($ctx1) {
  4133. self.setMilliseconds(aNumber);
  4134. return self;
  4135. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4136. },
  4137. args: ["aNumber"],
  4138. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4139. referencedClasses: [],
  4140. messageSends: []
  4141. }),
  4142. $globals.Date);
  4143. $core.addMethod(
  4144. $core.method({
  4145. selector: "minutes",
  4146. protocol: "accessing",
  4147. fn: function (){
  4148. var self=this,$self=this;
  4149. return $core.withContext(function($ctx1) {
  4150. return self.getMinutes();
  4151. return self;
  4152. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4153. },
  4154. args: [],
  4155. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4156. referencedClasses: [],
  4157. messageSends: []
  4158. }),
  4159. $globals.Date);
  4160. $core.addMethod(
  4161. $core.method({
  4162. selector: "minutes:",
  4163. protocol: "accessing",
  4164. fn: function (aNumber){
  4165. var self=this,$self=this;
  4166. return $core.withContext(function($ctx1) {
  4167. self.setMinutes(aNumber);
  4168. return self;
  4169. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4170. },
  4171. args: ["aNumber"],
  4172. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4173. referencedClasses: [],
  4174. messageSends: []
  4175. }),
  4176. $globals.Date);
  4177. $core.addMethod(
  4178. $core.method({
  4179. selector: "month",
  4180. protocol: "accessing",
  4181. fn: function (){
  4182. var self=this,$self=this;
  4183. return $core.withContext(function($ctx1) {
  4184. return self.getMonth() + 1;
  4185. return self;
  4186. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4187. },
  4188. args: [],
  4189. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4190. referencedClasses: [],
  4191. messageSends: []
  4192. }),
  4193. $globals.Date);
  4194. $core.addMethod(
  4195. $core.method({
  4196. selector: "month:",
  4197. protocol: "accessing",
  4198. fn: function (aNumber){
  4199. var self=this,$self=this;
  4200. return $core.withContext(function($ctx1) {
  4201. self.setMonth(aNumber - 1);
  4202. return self;
  4203. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4204. },
  4205. args: ["aNumber"],
  4206. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4207. referencedClasses: [],
  4208. messageSends: []
  4209. }),
  4210. $globals.Date);
  4211. $core.addMethod(
  4212. $core.method({
  4213. selector: "printOn:",
  4214. protocol: "printing",
  4215. fn: function (aStream){
  4216. var self=this,$self=this;
  4217. return $core.withContext(function($ctx1) {
  4218. $recv(aStream)._nextPutAll_($self._asString());
  4219. return self;
  4220. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4221. },
  4222. args: ["aStream"],
  4223. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4224. referencedClasses: [],
  4225. messageSends: ["nextPutAll:", "asString"]
  4226. }),
  4227. $globals.Date);
  4228. $core.addMethod(
  4229. $core.method({
  4230. selector: "seconds",
  4231. protocol: "accessing",
  4232. fn: function (){
  4233. var self=this,$self=this;
  4234. return $core.withContext(function($ctx1) {
  4235. return self.getSeconds();
  4236. return self;
  4237. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4238. },
  4239. args: [],
  4240. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4241. referencedClasses: [],
  4242. messageSends: []
  4243. }),
  4244. $globals.Date);
  4245. $core.addMethod(
  4246. $core.method({
  4247. selector: "seconds:",
  4248. protocol: "accessing",
  4249. fn: function (aNumber){
  4250. var self=this,$self=this;
  4251. return $core.withContext(function($ctx1) {
  4252. self.setSeconds(aNumber);
  4253. return self;
  4254. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4255. },
  4256. args: ["aNumber"],
  4257. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4258. referencedClasses: [],
  4259. messageSends: []
  4260. }),
  4261. $globals.Date);
  4262. $core.addMethod(
  4263. $core.method({
  4264. selector: "time",
  4265. protocol: "accessing",
  4266. fn: function (){
  4267. var self=this,$self=this;
  4268. return $core.withContext(function($ctx1) {
  4269. return self.getTime();
  4270. return self;
  4271. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4272. },
  4273. args: [],
  4274. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4275. referencedClasses: [],
  4276. messageSends: []
  4277. }),
  4278. $globals.Date);
  4279. $core.addMethod(
  4280. $core.method({
  4281. selector: "time:",
  4282. protocol: "accessing",
  4283. fn: function (aNumber){
  4284. var self=this,$self=this;
  4285. return $core.withContext(function($ctx1) {
  4286. self.setTime(aNumber);
  4287. return self;
  4288. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4289. },
  4290. args: ["aNumber"],
  4291. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4292. referencedClasses: [],
  4293. messageSends: []
  4294. }),
  4295. $globals.Date);
  4296. $core.addMethod(
  4297. $core.method({
  4298. selector: "year",
  4299. protocol: "accessing",
  4300. fn: function (){
  4301. var self=this,$self=this;
  4302. return $core.withContext(function($ctx1) {
  4303. return self.getFullYear();
  4304. return self;
  4305. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4306. },
  4307. args: [],
  4308. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4309. referencedClasses: [],
  4310. messageSends: []
  4311. }),
  4312. $globals.Date);
  4313. $core.addMethod(
  4314. $core.method({
  4315. selector: "year:",
  4316. protocol: "accessing",
  4317. fn: function (aNumber){
  4318. var self=this,$self=this;
  4319. return $core.withContext(function($ctx1) {
  4320. self.setFullYear(aNumber);
  4321. return self;
  4322. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4323. },
  4324. args: ["aNumber"],
  4325. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4326. referencedClasses: [],
  4327. messageSends: []
  4328. }),
  4329. $globals.Date);
  4330. $core.addMethod(
  4331. $core.method({
  4332. selector: "classTag",
  4333. protocol: "accessing",
  4334. fn: function (){
  4335. var self=this,$self=this;
  4336. return "magnitude";
  4337. },
  4338. args: [],
  4339. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  4340. referencedClasses: [],
  4341. messageSends: []
  4342. }),
  4343. $globals.Date.a$cls);
  4344. $core.addMethod(
  4345. $core.method({
  4346. selector: "fromMilliseconds:",
  4347. protocol: "instance creation",
  4348. fn: function (aNumber){
  4349. var self=this,$self=this;
  4350. return $core.withContext(function($ctx1) {
  4351. return $self._new_(aNumber);
  4352. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4353. },
  4354. args: ["aNumber"],
  4355. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4356. referencedClasses: [],
  4357. messageSends: ["new:"]
  4358. }),
  4359. $globals.Date.a$cls);
  4360. $core.addMethod(
  4361. $core.method({
  4362. selector: "fromSeconds:",
  4363. protocol: "instance creation",
  4364. fn: function (aNumber){
  4365. var self=this,$self=this;
  4366. return $core.withContext(function($ctx1) {
  4367. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4368. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4369. },
  4370. args: ["aNumber"],
  4371. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4372. referencedClasses: [],
  4373. messageSends: ["fromMilliseconds:", "*"]
  4374. }),
  4375. $globals.Date.a$cls);
  4376. $core.addMethod(
  4377. $core.method({
  4378. selector: "fromString:",
  4379. protocol: "instance creation",
  4380. fn: function (aString){
  4381. var self=this,$self=this;
  4382. return $core.withContext(function($ctx1) {
  4383. return $self._new_(aString);
  4384. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4385. },
  4386. args: ["aString"],
  4387. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4388. referencedClasses: [],
  4389. messageSends: ["new:"]
  4390. }),
  4391. $globals.Date.a$cls);
  4392. $core.addMethod(
  4393. $core.method({
  4394. selector: "millisecondsToRun:",
  4395. protocol: "instance creation",
  4396. fn: function (aBlock){
  4397. var self=this,$self=this;
  4398. var t;
  4399. return $core.withContext(function($ctx1) {
  4400. t=$recv($globals.Date)._now();
  4401. $ctx1.sendIdx["now"]=1;
  4402. $recv(aBlock)._value();
  4403. return $recv($recv($globals.Date)._now()).__minus(t);
  4404. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4405. },
  4406. args: ["aBlock"],
  4407. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4408. referencedClasses: ["Date"],
  4409. messageSends: ["now", "value", "-"]
  4410. }),
  4411. $globals.Date.a$cls);
  4412. $core.addMethod(
  4413. $core.method({
  4414. selector: "new:",
  4415. protocol: "instance creation",
  4416. fn: function (anObject){
  4417. var self=this,$self=this;
  4418. return $core.withContext(function($ctx1) {
  4419. return new Date(anObject);
  4420. return self;
  4421. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4422. },
  4423. args: ["anObject"],
  4424. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4425. referencedClasses: [],
  4426. messageSends: []
  4427. }),
  4428. $globals.Date.a$cls);
  4429. $core.addMethod(
  4430. $core.method({
  4431. selector: "now",
  4432. protocol: "instance creation",
  4433. fn: function (){
  4434. var self=this,$self=this;
  4435. return $core.withContext(function($ctx1) {
  4436. return $self._today();
  4437. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4438. },
  4439. args: [],
  4440. source: "now\x0a\x09^ self today",
  4441. referencedClasses: [],
  4442. messageSends: ["today"]
  4443. }),
  4444. $globals.Date.a$cls);
  4445. $core.addMethod(
  4446. $core.method({
  4447. selector: "today",
  4448. protocol: "instance creation",
  4449. fn: function (){
  4450. var self=this,$self=this;
  4451. return $core.withContext(function($ctx1) {
  4452. return $self._new();
  4453. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4454. },
  4455. args: [],
  4456. source: "today\x0a\x09^ self new",
  4457. referencedClasses: [],
  4458. messageSends: ["new"]
  4459. }),
  4460. $globals.Date.a$cls);
  4461. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4462. $globals.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 ].";
  4463. $core.addMethod(
  4464. $core.method({
  4465. selector: "&",
  4466. protocol: "converting",
  4467. fn: function (aNumber){
  4468. var self=this,$self=this;
  4469. return $core.withContext(function($ctx1) {
  4470. return self & aNumber;
  4471. return self;
  4472. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4473. },
  4474. args: ["aNumber"],
  4475. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4476. referencedClasses: [],
  4477. messageSends: []
  4478. }),
  4479. $globals.Number);
  4480. $core.addMethod(
  4481. $core.method({
  4482. selector: "*",
  4483. protocol: "arithmetic",
  4484. fn: function (aNumber){
  4485. var self=this,$self=this;
  4486. return $core.withContext(function($ctx1) {
  4487. return self * aNumber;
  4488. return self;
  4489. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4490. },
  4491. args: ["aNumber"],
  4492. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4493. referencedClasses: [],
  4494. messageSends: []
  4495. }),
  4496. $globals.Number);
  4497. $core.addMethod(
  4498. $core.method({
  4499. selector: "**",
  4500. protocol: "mathematical functions",
  4501. fn: function (exponent){
  4502. var self=this,$self=this;
  4503. return $core.withContext(function($ctx1) {
  4504. return $self._raisedTo_(exponent);
  4505. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4506. },
  4507. args: ["exponent"],
  4508. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4509. referencedClasses: [],
  4510. messageSends: ["raisedTo:"]
  4511. }),
  4512. $globals.Number);
  4513. $core.addMethod(
  4514. $core.method({
  4515. selector: "+",
  4516. protocol: "arithmetic",
  4517. fn: function (aNumber){
  4518. var self=this,$self=this;
  4519. return $core.withContext(function($ctx1) {
  4520. return self + aNumber;
  4521. return self;
  4522. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4523. },
  4524. args: ["aNumber"],
  4525. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4526. referencedClasses: [],
  4527. messageSends: []
  4528. }),
  4529. $globals.Number);
  4530. $core.addMethod(
  4531. $core.method({
  4532. selector: "-",
  4533. protocol: "arithmetic",
  4534. fn: function (aNumber){
  4535. var self=this,$self=this;
  4536. return $core.withContext(function($ctx1) {
  4537. return self - aNumber;
  4538. return self;
  4539. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4540. },
  4541. args: ["aNumber"],
  4542. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4543. referencedClasses: [],
  4544. messageSends: []
  4545. }),
  4546. $globals.Number);
  4547. $core.addMethod(
  4548. $core.method({
  4549. selector: "/",
  4550. protocol: "arithmetic",
  4551. fn: function (aNumber){
  4552. var self=this,$self=this;
  4553. return $core.withContext(function($ctx1) {
  4554. return self / aNumber;
  4555. return self;
  4556. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4557. },
  4558. args: ["aNumber"],
  4559. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4560. referencedClasses: [],
  4561. messageSends: []
  4562. }),
  4563. $globals.Number);
  4564. $core.addMethod(
  4565. $core.method({
  4566. selector: "//",
  4567. protocol: "arithmetic",
  4568. fn: function (aNumber){
  4569. var self=this,$self=this;
  4570. return $core.withContext(function($ctx1) {
  4571. return $recv($self.__slash(aNumber))._floor();
  4572. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4573. },
  4574. args: ["aNumber"],
  4575. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4576. referencedClasses: [],
  4577. messageSends: ["floor", "/"]
  4578. }),
  4579. $globals.Number);
  4580. $core.addMethod(
  4581. $core.method({
  4582. selector: "<",
  4583. protocol: "comparing",
  4584. fn: function (aNumber){
  4585. var self=this,$self=this;
  4586. return $core.withContext(function($ctx1) {
  4587. return self < aNumber;
  4588. return self;
  4589. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4590. },
  4591. args: ["aNumber"],
  4592. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4593. referencedClasses: [],
  4594. messageSends: []
  4595. }),
  4596. $globals.Number);
  4597. $core.addMethod(
  4598. $core.method({
  4599. selector: "<=",
  4600. protocol: "comparing",
  4601. fn: function (aNumber){
  4602. var self=this,$self=this;
  4603. return $core.withContext(function($ctx1) {
  4604. return self <= aNumber;
  4605. return self;
  4606. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4607. },
  4608. args: ["aNumber"],
  4609. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4610. referencedClasses: [],
  4611. messageSends: []
  4612. }),
  4613. $globals.Number);
  4614. $core.addMethod(
  4615. $core.method({
  4616. selector: "==",
  4617. protocol: "comparing",
  4618. fn: function (aNumber){
  4619. var self=this,$self=this;
  4620. return $core.withContext(function($ctx1) {
  4621. if (typeof aNumber === "number") return Number(self) === aNumber;
  4622. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4623. else return false;;
  4624. return self;
  4625. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4626. },
  4627. args: ["aNumber"],
  4628. source: "== aNumber\x0a<inlineJS: '\x0a\x09if (typeof aNumber === \x22number\x22) return Number(self) === aNumber;\x0a\x09else if (aNumber != null && typeof aNumber === \x22object\x22) return Number(self) === aNumber.valueOf();\x0a\x09else return false;\x0a'>",
  4629. referencedClasses: [],
  4630. messageSends: []
  4631. }),
  4632. $globals.Number);
  4633. $core.addMethod(
  4634. $core.method({
  4635. selector: ">",
  4636. protocol: "comparing",
  4637. fn: function (aNumber){
  4638. var self=this,$self=this;
  4639. return $core.withContext(function($ctx1) {
  4640. return self > aNumber;
  4641. return self;
  4642. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4643. },
  4644. args: ["aNumber"],
  4645. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  4646. referencedClasses: [],
  4647. messageSends: []
  4648. }),
  4649. $globals.Number);
  4650. $core.addMethod(
  4651. $core.method({
  4652. selector: ">=",
  4653. protocol: "comparing",
  4654. fn: function (aNumber){
  4655. var self=this,$self=this;
  4656. return $core.withContext(function($ctx1) {
  4657. return self >= aNumber;
  4658. return self;
  4659. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  4660. },
  4661. args: ["aNumber"],
  4662. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  4663. referencedClasses: [],
  4664. messageSends: []
  4665. }),
  4666. $globals.Number);
  4667. $core.addMethod(
  4668. $core.method({
  4669. selector: "@",
  4670. protocol: "converting",
  4671. fn: function (aNumber){
  4672. var self=this,$self=this;
  4673. return $core.withContext(function($ctx1) {
  4674. return $recv($globals.Point)._x_y_(self,aNumber);
  4675. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  4676. },
  4677. args: ["aNumber"],
  4678. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4679. referencedClasses: ["Point"],
  4680. messageSends: ["x:y:"]
  4681. }),
  4682. $globals.Number);
  4683. $core.addMethod(
  4684. $core.method({
  4685. selector: "\x5c\x5c",
  4686. protocol: "arithmetic",
  4687. fn: function (aNumber){
  4688. var self=this,$self=this;
  4689. return $core.withContext(function($ctx1) {
  4690. return self % aNumber;
  4691. return self;
  4692. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  4693. },
  4694. args: ["aNumber"],
  4695. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  4696. referencedClasses: [],
  4697. messageSends: []
  4698. }),
  4699. $globals.Number);
  4700. $core.addMethod(
  4701. $core.method({
  4702. selector: "abs",
  4703. protocol: "arithmetic",
  4704. fn: function (){
  4705. var self=this,$self=this;
  4706. return $core.withContext(function($ctx1) {
  4707. return Math.abs(self);;
  4708. return self;
  4709. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  4710. },
  4711. args: [],
  4712. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  4713. referencedClasses: [],
  4714. messageSends: []
  4715. }),
  4716. $globals.Number);
  4717. $core.addMethod(
  4718. $core.method({
  4719. selector: "arcCos",
  4720. protocol: "mathematical functions",
  4721. fn: function (){
  4722. var self=this,$self=this;
  4723. return $core.withContext(function($ctx1) {
  4724. return Math.acos(self);;
  4725. return self;
  4726. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  4727. },
  4728. args: [],
  4729. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  4730. referencedClasses: [],
  4731. messageSends: []
  4732. }),
  4733. $globals.Number);
  4734. $core.addMethod(
  4735. $core.method({
  4736. selector: "arcSin",
  4737. protocol: "mathematical functions",
  4738. fn: function (){
  4739. var self=this,$self=this;
  4740. return $core.withContext(function($ctx1) {
  4741. return Math.asin(self);;
  4742. return self;
  4743. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  4744. },
  4745. args: [],
  4746. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  4747. referencedClasses: [],
  4748. messageSends: []
  4749. }),
  4750. $globals.Number);
  4751. $core.addMethod(
  4752. $core.method({
  4753. selector: "arcTan",
  4754. protocol: "mathematical functions",
  4755. fn: function (){
  4756. var self=this,$self=this;
  4757. return $core.withContext(function($ctx1) {
  4758. return Math.atan(self);;
  4759. return self;
  4760. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  4761. },
  4762. args: [],
  4763. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  4764. referencedClasses: [],
  4765. messageSends: []
  4766. }),
  4767. $globals.Number);
  4768. $core.addMethod(
  4769. $core.method({
  4770. selector: "asJavaScriptObject",
  4771. protocol: "converting",
  4772. fn: function (){
  4773. var self=this,$self=this;
  4774. return self;
  4775. },
  4776. args: [],
  4777. source: "asJavaScriptObject\x0a\x09^ self",
  4778. referencedClasses: [],
  4779. messageSends: []
  4780. }),
  4781. $globals.Number);
  4782. $core.addMethod(
  4783. $core.method({
  4784. selector: "asJavaScriptSource",
  4785. protocol: "converting",
  4786. fn: function (){
  4787. var self=this,$self=this;
  4788. return $core.withContext(function($ctx1) {
  4789. var $1;
  4790. $1=$recv("(".__comma($self._printString())).__comma(")");
  4791. $ctx1.sendIdx[","]=1;
  4792. return $1;
  4793. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  4794. },
  4795. args: [],
  4796. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  4797. referencedClasses: [],
  4798. messageSends: [",", "printString"]
  4799. }),
  4800. $globals.Number);
  4801. $core.addMethod(
  4802. $core.method({
  4803. selector: "asNumber",
  4804. protocol: "converting",
  4805. fn: function (){
  4806. var self=this,$self=this;
  4807. return self;
  4808. },
  4809. args: [],
  4810. source: "asNumber\x0a\x09^ self",
  4811. referencedClasses: [],
  4812. messageSends: []
  4813. }),
  4814. $globals.Number);
  4815. $core.addMethod(
  4816. $core.method({
  4817. selector: "asPoint",
  4818. protocol: "converting",
  4819. fn: function (){
  4820. var self=this,$self=this;
  4821. return $core.withContext(function($ctx1) {
  4822. return $recv($globals.Point)._x_y_(self,self);
  4823. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  4824. },
  4825. args: [],
  4826. source: "asPoint\x0a\x09^ Point x: self y: self",
  4827. referencedClasses: ["Point"],
  4828. messageSends: ["x:y:"]
  4829. }),
  4830. $globals.Number);
  4831. $core.addMethod(
  4832. $core.method({
  4833. selector: "asString",
  4834. protocol: "converting",
  4835. fn: function (){
  4836. var self=this,$self=this;
  4837. return $core.withContext(function($ctx1) {
  4838. return String(self);
  4839. return self;
  4840. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  4841. },
  4842. args: [],
  4843. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  4844. referencedClasses: [],
  4845. messageSends: []
  4846. }),
  4847. $globals.Number);
  4848. $core.addMethod(
  4849. $core.method({
  4850. selector: "atRandom",
  4851. protocol: "converting",
  4852. fn: function (){
  4853. var self=this,$self=this;
  4854. return $core.withContext(function($ctx1) {
  4855. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  4856. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  4857. },
  4858. args: [],
  4859. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4860. referencedClasses: ["Random"],
  4861. messageSends: ["+", "truncated", "*", "next", "new"]
  4862. }),
  4863. $globals.Number);
  4864. $core.addMethod(
  4865. $core.method({
  4866. selector: "ceiling",
  4867. protocol: "converting",
  4868. fn: function (){
  4869. var self=this,$self=this;
  4870. return $core.withContext(function($ctx1) {
  4871. return Math.ceil(self);;
  4872. return self;
  4873. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  4874. },
  4875. args: [],
  4876. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  4877. referencedClasses: [],
  4878. messageSends: []
  4879. }),
  4880. $globals.Number);
  4881. $core.addMethod(
  4882. $core.method({
  4883. selector: "copy",
  4884. protocol: "copying",
  4885. fn: function (){
  4886. var self=this,$self=this;
  4887. return self;
  4888. },
  4889. args: [],
  4890. source: "copy\x0a\x09^ self",
  4891. referencedClasses: [],
  4892. messageSends: []
  4893. }),
  4894. $globals.Number);
  4895. $core.addMethod(
  4896. $core.method({
  4897. selector: "cos",
  4898. protocol: "mathematical functions",
  4899. fn: function (){
  4900. var self=this,$self=this;
  4901. return $core.withContext(function($ctx1) {
  4902. return Math.cos(self);;
  4903. return self;
  4904. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  4905. },
  4906. args: [],
  4907. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  4908. referencedClasses: [],
  4909. messageSends: []
  4910. }),
  4911. $globals.Number);
  4912. $core.addMethod(
  4913. $core.method({
  4914. selector: "deepCopy",
  4915. protocol: "copying",
  4916. fn: function (){
  4917. var self=this,$self=this;
  4918. return $core.withContext(function($ctx1) {
  4919. return $self._copy();
  4920. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  4921. },
  4922. args: [],
  4923. source: "deepCopy\x0a\x09^ self copy",
  4924. referencedClasses: [],
  4925. messageSends: ["copy"]
  4926. }),
  4927. $globals.Number);
  4928. $core.addMethod(
  4929. $core.method({
  4930. selector: "even",
  4931. protocol: "testing",
  4932. fn: function (){
  4933. var self=this,$self=this;
  4934. return $core.withContext(function($ctx1) {
  4935. return (0).__eq($self.__backslash_backslash((2)));
  4936. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  4937. },
  4938. args: [],
  4939. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4940. referencedClasses: [],
  4941. messageSends: ["=", "\x5c\x5c"]
  4942. }),
  4943. $globals.Number);
  4944. $core.addMethod(
  4945. $core.method({
  4946. selector: "floor",
  4947. protocol: "converting",
  4948. fn: function (){
  4949. var self=this,$self=this;
  4950. return $core.withContext(function($ctx1) {
  4951. return Math.floor(self);;
  4952. return self;
  4953. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  4954. },
  4955. args: [],
  4956. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  4957. referencedClasses: [],
  4958. messageSends: []
  4959. }),
  4960. $globals.Number);
  4961. $core.addMethod(
  4962. $core.method({
  4963. selector: "isImmutable",
  4964. protocol: "testing",
  4965. fn: function (){
  4966. var self=this,$self=this;
  4967. return true;
  4968. },
  4969. args: [],
  4970. source: "isImmutable\x0a\x09^ true",
  4971. referencedClasses: [],
  4972. messageSends: []
  4973. }),
  4974. $globals.Number);
  4975. $core.addMethod(
  4976. $core.method({
  4977. selector: "isNumber",
  4978. protocol: "testing",
  4979. fn: function (){
  4980. var self=this,$self=this;
  4981. return true;
  4982. },
  4983. args: [],
  4984. source: "isNumber\x0a\x09^ true",
  4985. referencedClasses: [],
  4986. messageSends: []
  4987. }),
  4988. $globals.Number);
  4989. $core.addMethod(
  4990. $core.method({
  4991. selector: "isZero",
  4992. protocol: "testing",
  4993. fn: function (){
  4994. var self=this,$self=this;
  4995. return $core.withContext(function($ctx1) {
  4996. return $self.__eq((0));
  4997. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  4998. },
  4999. args: [],
  5000. source: "isZero\x0a\x09^ self = 0",
  5001. referencedClasses: [],
  5002. messageSends: ["="]
  5003. }),
  5004. $globals.Number);
  5005. $core.addMethod(
  5006. $core.method({
  5007. selector: "ln",
  5008. protocol: "mathematical functions",
  5009. fn: function (){
  5010. var self=this,$self=this;
  5011. return $core.withContext(function($ctx1) {
  5012. return Math.log(self);;
  5013. return self;
  5014. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5015. },
  5016. args: [],
  5017. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5018. referencedClasses: [],
  5019. messageSends: []
  5020. }),
  5021. $globals.Number);
  5022. $core.addMethod(
  5023. $core.method({
  5024. selector: "log",
  5025. protocol: "mathematical functions",
  5026. fn: function (){
  5027. var self=this,$self=this;
  5028. return $core.withContext(function($ctx1) {
  5029. return Math.log(self) / Math.LN10;;
  5030. return self;
  5031. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5032. },
  5033. args: [],
  5034. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5035. referencedClasses: [],
  5036. messageSends: []
  5037. }),
  5038. $globals.Number);
  5039. $core.addMethod(
  5040. $core.method({
  5041. selector: "log:",
  5042. protocol: "mathematical functions",
  5043. fn: function (aNumber){
  5044. var self=this,$self=this;
  5045. return $core.withContext(function($ctx1) {
  5046. return Math.log(self) / Math.log(aNumber);;
  5047. return self;
  5048. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5049. },
  5050. args: ["aNumber"],
  5051. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5052. referencedClasses: [],
  5053. messageSends: []
  5054. }),
  5055. $globals.Number);
  5056. $core.addMethod(
  5057. $core.method({
  5058. selector: "max:",
  5059. protocol: "arithmetic",
  5060. fn: function (aNumber){
  5061. var self=this,$self=this;
  5062. return $core.withContext(function($ctx1) {
  5063. return Math.max(self, aNumber);;
  5064. return self;
  5065. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5066. },
  5067. args: ["aNumber"],
  5068. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5069. referencedClasses: [],
  5070. messageSends: []
  5071. }),
  5072. $globals.Number);
  5073. $core.addMethod(
  5074. $core.method({
  5075. selector: "min:",
  5076. protocol: "arithmetic",
  5077. fn: function (aNumber){
  5078. var self=this,$self=this;
  5079. return $core.withContext(function($ctx1) {
  5080. return Math.min(self, aNumber);;
  5081. return self;
  5082. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5083. },
  5084. args: ["aNumber"],
  5085. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5086. referencedClasses: [],
  5087. messageSends: []
  5088. }),
  5089. $globals.Number);
  5090. $core.addMethod(
  5091. $core.method({
  5092. selector: "negated",
  5093. protocol: "arithmetic",
  5094. fn: function (){
  5095. var self=this,$self=this;
  5096. return $core.withContext(function($ctx1) {
  5097. return (0).__minus(self);
  5098. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5099. },
  5100. args: [],
  5101. source: "negated\x0a\x09^ 0 - self",
  5102. referencedClasses: [],
  5103. messageSends: ["-"]
  5104. }),
  5105. $globals.Number);
  5106. $core.addMethod(
  5107. $core.method({
  5108. selector: "negative",
  5109. protocol: "testing",
  5110. fn: function (){
  5111. var self=this,$self=this;
  5112. return $core.withContext(function($ctx1) {
  5113. return $self.__lt((0));
  5114. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5115. },
  5116. args: [],
  5117. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5118. referencedClasses: [],
  5119. messageSends: ["<"]
  5120. }),
  5121. $globals.Number);
  5122. $core.addMethod(
  5123. $core.method({
  5124. selector: "odd",
  5125. protocol: "testing",
  5126. fn: function (){
  5127. var self=this,$self=this;
  5128. return $core.withContext(function($ctx1) {
  5129. return $recv($self._even())._not();
  5130. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5131. },
  5132. args: [],
  5133. source: "odd\x0a\x09^ self even not",
  5134. referencedClasses: [],
  5135. messageSends: ["not", "even"]
  5136. }),
  5137. $globals.Number);
  5138. $core.addMethod(
  5139. $core.method({
  5140. selector: "positive",
  5141. protocol: "testing",
  5142. fn: function (){
  5143. var self=this,$self=this;
  5144. return $core.withContext(function($ctx1) {
  5145. return $self.__gt_eq((0));
  5146. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5147. },
  5148. args: [],
  5149. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5150. referencedClasses: [],
  5151. messageSends: [">="]
  5152. }),
  5153. $globals.Number);
  5154. $core.addMethod(
  5155. $core.method({
  5156. selector: "printOn:",
  5157. protocol: "printing",
  5158. fn: function (aStream){
  5159. var self=this,$self=this;
  5160. return $core.withContext(function($ctx1) {
  5161. $recv(aStream)._nextPutAll_($self._asString());
  5162. return self;
  5163. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5164. },
  5165. args: ["aStream"],
  5166. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5167. referencedClasses: [],
  5168. messageSends: ["nextPutAll:", "asString"]
  5169. }),
  5170. $globals.Number);
  5171. $core.addMethod(
  5172. $core.method({
  5173. selector: "printShowingDecimalPlaces:",
  5174. protocol: "printing",
  5175. fn: function (placesDesired){
  5176. var self=this,$self=this;
  5177. return $core.withContext(function($ctx1) {
  5178. return self.toFixed(placesDesired);
  5179. return self;
  5180. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5181. },
  5182. args: ["placesDesired"],
  5183. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5184. referencedClasses: [],
  5185. messageSends: []
  5186. }),
  5187. $globals.Number);
  5188. $core.addMethod(
  5189. $core.method({
  5190. selector: "raisedTo:",
  5191. protocol: "mathematical functions",
  5192. fn: function (exponent){
  5193. var self=this,$self=this;
  5194. return $core.withContext(function($ctx1) {
  5195. return Math.pow(self, exponent);;
  5196. return self;
  5197. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5198. },
  5199. args: ["exponent"],
  5200. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5201. referencedClasses: [],
  5202. messageSends: []
  5203. }),
  5204. $globals.Number);
  5205. $core.addMethod(
  5206. $core.method({
  5207. selector: "rounded",
  5208. protocol: "converting",
  5209. fn: function (){
  5210. var self=this,$self=this;
  5211. return $core.withContext(function($ctx1) {
  5212. return Math.round(self);;
  5213. return self;
  5214. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5215. },
  5216. args: [],
  5217. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5218. referencedClasses: [],
  5219. messageSends: []
  5220. }),
  5221. $globals.Number);
  5222. $core.addMethod(
  5223. $core.method({
  5224. selector: "sign",
  5225. protocol: "mathematical functions",
  5226. fn: function (){
  5227. var self=this,$self=this;
  5228. return $core.withContext(function($ctx1) {
  5229. var $1,$2;
  5230. $1=$self._isZero();
  5231. if($core.assert($1)){
  5232. return (0);
  5233. }
  5234. $2=$self._positive();
  5235. if($core.assert($2)){
  5236. return (1);
  5237. } else {
  5238. return (-1);
  5239. }
  5240. return self;
  5241. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5242. },
  5243. args: [],
  5244. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5245. referencedClasses: [],
  5246. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5247. }),
  5248. $globals.Number);
  5249. $core.addMethod(
  5250. $core.method({
  5251. selector: "sin",
  5252. protocol: "mathematical functions",
  5253. fn: function (){
  5254. var self=this,$self=this;
  5255. return $core.withContext(function($ctx1) {
  5256. return Math.sin(self);;
  5257. return self;
  5258. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5259. },
  5260. args: [],
  5261. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5262. referencedClasses: [],
  5263. messageSends: []
  5264. }),
  5265. $globals.Number);
  5266. $core.addMethod(
  5267. $core.method({
  5268. selector: "sqrt",
  5269. protocol: "mathematical functions",
  5270. fn: function (){
  5271. var self=this,$self=this;
  5272. return $core.withContext(function($ctx1) {
  5273. return Math.sqrt(self);
  5274. return self;
  5275. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5276. },
  5277. args: [],
  5278. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5279. referencedClasses: [],
  5280. messageSends: []
  5281. }),
  5282. $globals.Number);
  5283. $core.addMethod(
  5284. $core.method({
  5285. selector: "squared",
  5286. protocol: "mathematical functions",
  5287. fn: function (){
  5288. var self=this,$self=this;
  5289. return $core.withContext(function($ctx1) {
  5290. return $self.__star(self);
  5291. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5292. },
  5293. args: [],
  5294. source: "squared\x0a\x09^ self * self",
  5295. referencedClasses: [],
  5296. messageSends: ["*"]
  5297. }),
  5298. $globals.Number);
  5299. $core.addMethod(
  5300. $core.method({
  5301. selector: "tan",
  5302. protocol: "mathematical functions",
  5303. fn: function (){
  5304. var self=this,$self=this;
  5305. return $core.withContext(function($ctx1) {
  5306. return Math.tan(self);;
  5307. return self;
  5308. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5309. },
  5310. args: [],
  5311. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5312. referencedClasses: [],
  5313. messageSends: []
  5314. }),
  5315. $globals.Number);
  5316. $core.addMethod(
  5317. $core.method({
  5318. selector: "timesRepeat:",
  5319. protocol: "enumerating",
  5320. fn: function (aBlock){
  5321. var self=this,$self=this;
  5322. var count;
  5323. return $core.withContext(function($ctx1) {
  5324. count=(1);
  5325. $recv((function(){
  5326. return $core.withContext(function($ctx2) {
  5327. return $recv(count).__gt(self);
  5328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5329. }))._whileFalse_((function(){
  5330. return $core.withContext(function($ctx2) {
  5331. $recv(aBlock)._value();
  5332. count=$recv(count).__plus((1));
  5333. return count;
  5334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5335. }));
  5336. return self;
  5337. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5338. },
  5339. args: ["aBlock"],
  5340. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5341. referencedClasses: [],
  5342. messageSends: ["whileFalse:", ">", "value", "+"]
  5343. }),
  5344. $globals.Number);
  5345. $core.addMethod(
  5346. $core.method({
  5347. selector: "to:",
  5348. protocol: "converting",
  5349. fn: function (aNumber){
  5350. var self=this,$self=this;
  5351. var array,first,last,count;
  5352. return $core.withContext(function($ctx1) {
  5353. first=$self._truncated();
  5354. $ctx1.sendIdx["truncated"]=1;
  5355. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5356. $ctx1.sendIdx["+"]=1;
  5357. count=(1);
  5358. array=$recv($globals.Array)._new();
  5359. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5360. return $core.withContext(function($ctx2) {
  5361. $recv(array)._at_put_(count,first);
  5362. count=$recv(count).__plus((1));
  5363. $ctx2.sendIdx["+"]=2;
  5364. count;
  5365. first=$recv(first).__plus((1));
  5366. return first;
  5367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5368. }));
  5369. return array;
  5370. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5371. },
  5372. args: ["aNumber"],
  5373. 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",
  5374. referencedClasses: ["Array"],
  5375. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5376. }),
  5377. $globals.Number);
  5378. $core.addMethod(
  5379. $core.method({
  5380. selector: "to:by:",
  5381. protocol: "converting",
  5382. fn: function (stop,step){
  5383. var self=this,$self=this;
  5384. var array,value,pos;
  5385. return $core.withContext(function($ctx1) {
  5386. var $1,$2;
  5387. value=self;
  5388. array=$recv($globals.Array)._new();
  5389. pos=(1);
  5390. $1=$recv(step).__eq((0));
  5391. if($core.assert($1)){
  5392. $self._error_("step must be non-zero");
  5393. }
  5394. $2=$recv(step).__lt((0));
  5395. if($core.assert($2)){
  5396. $recv((function(){
  5397. return $core.withContext(function($ctx2) {
  5398. return $recv(value).__gt_eq(stop);
  5399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5400. }))._whileTrue_((function(){
  5401. return $core.withContext(function($ctx2) {
  5402. $recv(array)._at_put_(pos,value);
  5403. $ctx2.sendIdx["at:put:"]=1;
  5404. pos=$recv(pos).__plus((1));
  5405. $ctx2.sendIdx["+"]=1;
  5406. pos;
  5407. value=$recv(value).__plus(step);
  5408. $ctx2.sendIdx["+"]=2;
  5409. return value;
  5410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5411. }));
  5412. $ctx1.sendIdx["whileTrue:"]=1;
  5413. } else {
  5414. $recv((function(){
  5415. return $core.withContext(function($ctx2) {
  5416. return $recv(value).__lt_eq(stop);
  5417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5418. }))._whileTrue_((function(){
  5419. return $core.withContext(function($ctx2) {
  5420. $recv(array)._at_put_(pos,value);
  5421. pos=$recv(pos).__plus((1));
  5422. $ctx2.sendIdx["+"]=3;
  5423. pos;
  5424. value=$recv(value).__plus(step);
  5425. return value;
  5426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5427. }));
  5428. }
  5429. return array;
  5430. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5431. },
  5432. args: ["stop", "step"],
  5433. 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",
  5434. referencedClasses: ["Array"],
  5435. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5436. }),
  5437. $globals.Number);
  5438. $core.addMethod(
  5439. $core.method({
  5440. selector: "to:by:do:",
  5441. protocol: "enumerating",
  5442. fn: function (stop,step,aBlock){
  5443. var self=this,$self=this;
  5444. var value;
  5445. return $core.withContext(function($ctx1) {
  5446. var $1,$2;
  5447. value=self;
  5448. $1=$recv(step).__eq((0));
  5449. if($core.assert($1)){
  5450. $self._error_("step must be non-zero");
  5451. }
  5452. $2=$recv(step).__lt((0));
  5453. if($core.assert($2)){
  5454. $recv((function(){
  5455. return $core.withContext(function($ctx2) {
  5456. return $recv(value).__gt_eq(stop);
  5457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5458. }))._whileTrue_((function(){
  5459. return $core.withContext(function($ctx2) {
  5460. $recv(aBlock)._value_(value);
  5461. $ctx2.sendIdx["value:"]=1;
  5462. value=$recv(value).__plus(step);
  5463. $ctx2.sendIdx["+"]=1;
  5464. return value;
  5465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5466. }));
  5467. $ctx1.sendIdx["whileTrue:"]=1;
  5468. } else {
  5469. $recv((function(){
  5470. return $core.withContext(function($ctx2) {
  5471. return $recv(value).__lt_eq(stop);
  5472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5473. }))._whileTrue_((function(){
  5474. return $core.withContext(function($ctx2) {
  5475. $recv(aBlock)._value_(value);
  5476. value=$recv(value).__plus(step);
  5477. return value;
  5478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5479. }));
  5480. }
  5481. return self;
  5482. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  5483. },
  5484. args: ["stop", "step", "aBlock"],
  5485. 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 ]]",
  5486. referencedClasses: [],
  5487. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  5488. }),
  5489. $globals.Number);
  5490. $core.addMethod(
  5491. $core.method({
  5492. selector: "to:do:",
  5493. protocol: "enumerating",
  5494. fn: function (stop,aBlock){
  5495. var self=this,$self=this;
  5496. var nextValue;
  5497. return $core.withContext(function($ctx1) {
  5498. nextValue=self;
  5499. $recv((function(){
  5500. return $core.withContext(function($ctx2) {
  5501. return $recv(nextValue).__lt_eq(stop);
  5502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5503. }))._whileTrue_((function(){
  5504. return $core.withContext(function($ctx2) {
  5505. $recv(aBlock)._value_(nextValue);
  5506. nextValue=$recv(nextValue).__plus((1));
  5507. return nextValue;
  5508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5509. }));
  5510. return self;
  5511. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  5512. },
  5513. args: ["stop", "aBlock"],
  5514. 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 ]",
  5515. referencedClasses: [],
  5516. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5517. }),
  5518. $globals.Number);
  5519. $core.addMethod(
  5520. $core.method({
  5521. selector: "truncated",
  5522. protocol: "converting",
  5523. fn: function (){
  5524. var self=this,$self=this;
  5525. return $core.withContext(function($ctx1) {
  5526. if(self >= 0) {
  5527. return Math.floor(self);
  5528. } else {
  5529. return Math.floor(self * (-1)) * (-1);
  5530. };
  5531. ;
  5532. return self;
  5533. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5534. },
  5535. args: [],
  5536. source: "truncated\x0a\x09<inlineJS: '\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'>",
  5537. referencedClasses: [],
  5538. messageSends: []
  5539. }),
  5540. $globals.Number);
  5541. $core.addMethod(
  5542. $core.method({
  5543. selector: "|",
  5544. protocol: "converting",
  5545. fn: function (aNumber){
  5546. var self=this,$self=this;
  5547. return $core.withContext(function($ctx1) {
  5548. return self | aNumber;
  5549. return self;
  5550. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  5551. },
  5552. args: ["aNumber"],
  5553. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5554. referencedClasses: [],
  5555. messageSends: []
  5556. }),
  5557. $globals.Number);
  5558. $core.addMethod(
  5559. $core.method({
  5560. selector: "classTag",
  5561. protocol: "accessing",
  5562. fn: function (){
  5563. var self=this,$self=this;
  5564. return "magnitude";
  5565. },
  5566. args: [],
  5567. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  5568. referencedClasses: [],
  5569. messageSends: []
  5570. }),
  5571. $globals.Number.a$cls);
  5572. $core.addMethod(
  5573. $core.method({
  5574. selector: "e",
  5575. protocol: "instance creation",
  5576. fn: function (){
  5577. var self=this,$self=this;
  5578. return $core.withContext(function($ctx1) {
  5579. return Math.E;;
  5580. return self;
  5581. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  5582. },
  5583. args: [],
  5584. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  5585. referencedClasses: [],
  5586. messageSends: []
  5587. }),
  5588. $globals.Number.a$cls);
  5589. $core.addMethod(
  5590. $core.method({
  5591. selector: "pi",
  5592. protocol: "instance creation",
  5593. fn: function (){
  5594. var self=this,$self=this;
  5595. return $core.withContext(function($ctx1) {
  5596. return Math.PI;
  5597. return self;
  5598. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  5599. },
  5600. args: [],
  5601. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  5602. referencedClasses: [],
  5603. messageSends: []
  5604. }),
  5605. $globals.Number.a$cls);
  5606. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  5607. $globals.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";
  5608. $core.addMethod(
  5609. $core.method({
  5610. selector: "*",
  5611. protocol: "arithmetic",
  5612. fn: function (aPoint){
  5613. var self=this,$self=this;
  5614. return $core.withContext(function($ctx1) {
  5615. var $2,$4,$3,$1,$6,$5;
  5616. $2=$self._x();
  5617. $ctx1.sendIdx["x"]=1;
  5618. $4=$recv(aPoint)._asPoint();
  5619. $ctx1.sendIdx["asPoint"]=1;
  5620. $3=$recv($4)._x();
  5621. $1=$recv($2).__star($3);
  5622. $ctx1.sendIdx["*"]=1;
  5623. $6=$self._y();
  5624. $ctx1.sendIdx["y"]=1;
  5625. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  5626. return $recv($globals.Point)._x_y_($1,$5);
  5627. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  5628. },
  5629. args: ["aPoint"],
  5630. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5631. referencedClasses: ["Point"],
  5632. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5633. }),
  5634. $globals.Point);
  5635. $core.addMethod(
  5636. $core.method({
  5637. selector: "+",
  5638. protocol: "arithmetic",
  5639. fn: function (aPoint){
  5640. var self=this,$self=this;
  5641. return $core.withContext(function($ctx1) {
  5642. var $2,$4,$3,$1,$6,$5;
  5643. $2=$self._x();
  5644. $ctx1.sendIdx["x"]=1;
  5645. $4=$recv(aPoint)._asPoint();
  5646. $ctx1.sendIdx["asPoint"]=1;
  5647. $3=$recv($4)._x();
  5648. $1=$recv($2).__plus($3);
  5649. $ctx1.sendIdx["+"]=1;
  5650. $6=$self._y();
  5651. $ctx1.sendIdx["y"]=1;
  5652. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  5653. return $recv($globals.Point)._x_y_($1,$5);
  5654. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  5655. },
  5656. args: ["aPoint"],
  5657. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5658. referencedClasses: ["Point"],
  5659. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  5660. }),
  5661. $globals.Point);
  5662. $core.addMethod(
  5663. $core.method({
  5664. selector: "-",
  5665. protocol: "arithmetic",
  5666. fn: function (aPoint){
  5667. var self=this,$self=this;
  5668. return $core.withContext(function($ctx1) {
  5669. var $2,$4,$3,$1,$6,$5;
  5670. $2=$self._x();
  5671. $ctx1.sendIdx["x"]=1;
  5672. $4=$recv(aPoint)._asPoint();
  5673. $ctx1.sendIdx["asPoint"]=1;
  5674. $3=$recv($4)._x();
  5675. $1=$recv($2).__minus($3);
  5676. $ctx1.sendIdx["-"]=1;
  5677. $6=$self._y();
  5678. $ctx1.sendIdx["y"]=1;
  5679. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  5680. return $recv($globals.Point)._x_y_($1,$5);
  5681. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  5682. },
  5683. args: ["aPoint"],
  5684. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5685. referencedClasses: ["Point"],
  5686. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  5687. }),
  5688. $globals.Point);
  5689. $core.addMethod(
  5690. $core.method({
  5691. selector: "/",
  5692. protocol: "arithmetic",
  5693. fn: function (aPoint){
  5694. var self=this,$self=this;
  5695. return $core.withContext(function($ctx1) {
  5696. var $2,$4,$3,$1,$6,$5;
  5697. $2=$self._x();
  5698. $ctx1.sendIdx["x"]=1;
  5699. $4=$recv(aPoint)._asPoint();
  5700. $ctx1.sendIdx["asPoint"]=1;
  5701. $3=$recv($4)._x();
  5702. $1=$recv($2).__slash($3);
  5703. $ctx1.sendIdx["/"]=1;
  5704. $6=$self._y();
  5705. $ctx1.sendIdx["y"]=1;
  5706. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  5707. return $recv($globals.Point)._x_y_($1,$5);
  5708. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  5709. },
  5710. args: ["aPoint"],
  5711. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5712. referencedClasses: ["Point"],
  5713. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  5714. }),
  5715. $globals.Point);
  5716. $core.addMethod(
  5717. $core.method({
  5718. selector: "<",
  5719. protocol: "comparing",
  5720. fn: function (aPoint){
  5721. var self=this,$self=this;
  5722. return $core.withContext(function($ctx1) {
  5723. var $2,$1,$3;
  5724. $2=$self._x();
  5725. $ctx1.sendIdx["x"]=1;
  5726. $1=$recv($2).__lt($recv(aPoint)._x());
  5727. $ctx1.sendIdx["<"]=1;
  5728. return $recv($1)._and_((function(){
  5729. return $core.withContext(function($ctx2) {
  5730. $3=$self._y();
  5731. $ctx2.sendIdx["y"]=1;
  5732. return $recv($3).__lt($recv(aPoint)._y());
  5733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5734. }));
  5735. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  5736. },
  5737. args: ["aPoint"],
  5738. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  5739. referencedClasses: [],
  5740. messageSends: ["and:", "<", "x", "y"]
  5741. }),
  5742. $globals.Point);
  5743. $core.addMethod(
  5744. $core.method({
  5745. selector: "<=",
  5746. protocol: "comparing",
  5747. fn: function (aPoint){
  5748. var self=this,$self=this;
  5749. return $core.withContext(function($ctx1) {
  5750. var $2,$1,$3;
  5751. $2=$self._x();
  5752. $ctx1.sendIdx["x"]=1;
  5753. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  5754. $ctx1.sendIdx["<="]=1;
  5755. return $recv($1)._and_((function(){
  5756. return $core.withContext(function($ctx2) {
  5757. $3=$self._y();
  5758. $ctx2.sendIdx["y"]=1;
  5759. return $recv($3).__lt_eq($recv(aPoint)._y());
  5760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5761. }));
  5762. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  5763. },
  5764. args: ["aPoint"],
  5765. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  5766. referencedClasses: [],
  5767. messageSends: ["and:", "<=", "x", "y"]
  5768. }),
  5769. $globals.Point);
  5770. $core.addMethod(
  5771. $core.method({
  5772. selector: "=",
  5773. protocol: "comparing",
  5774. fn: function (aPoint){
  5775. var self=this,$self=this;
  5776. return $core.withContext(function($ctx1) {
  5777. var $2,$1,$4,$3,$6,$5;
  5778. $2=$recv(aPoint)._class();
  5779. $ctx1.sendIdx["class"]=1;
  5780. $1=$recv($2).__eq($self._class());
  5781. $ctx1.sendIdx["="]=1;
  5782. return $recv($1)._and_((function(){
  5783. return $core.withContext(function($ctx2) {
  5784. $4=$recv(aPoint)._x();
  5785. $ctx2.sendIdx["x"]=1;
  5786. $3=$recv($4).__eq($self._x());
  5787. $ctx2.sendIdx["="]=2;
  5788. $6=$recv(aPoint)._y();
  5789. $ctx2.sendIdx["y"]=1;
  5790. $5=$recv($6).__eq($self._y());
  5791. return $recv($3).__and($5);
  5792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5793. }));
  5794. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  5795. },
  5796. args: ["aPoint"],
  5797. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  5798. referencedClasses: [],
  5799. messageSends: ["and:", "=", "class", "&", "x", "y"]
  5800. }),
  5801. $globals.Point);
  5802. $core.addMethod(
  5803. $core.method({
  5804. selector: ">",
  5805. protocol: "comparing",
  5806. fn: function (aPoint){
  5807. var self=this,$self=this;
  5808. return $core.withContext(function($ctx1) {
  5809. var $2,$1,$3;
  5810. $2=$self._x();
  5811. $ctx1.sendIdx["x"]=1;
  5812. $1=$recv($2).__gt($recv(aPoint)._x());
  5813. $ctx1.sendIdx[">"]=1;
  5814. return $recv($1)._and_((function(){
  5815. return $core.withContext(function($ctx2) {
  5816. $3=$self._y();
  5817. $ctx2.sendIdx["y"]=1;
  5818. return $recv($3).__gt($recv(aPoint)._y());
  5819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5820. }));
  5821. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  5822. },
  5823. args: ["aPoint"],
  5824. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  5825. referencedClasses: [],
  5826. messageSends: ["and:", ">", "x", "y"]
  5827. }),
  5828. $globals.Point);
  5829. $core.addMethod(
  5830. $core.method({
  5831. selector: ">=",
  5832. protocol: "comparing",
  5833. fn: function (aPoint){
  5834. var self=this,$self=this;
  5835. return $core.withContext(function($ctx1) {
  5836. var $2,$1,$3;
  5837. $2=$self._x();
  5838. $ctx1.sendIdx["x"]=1;
  5839. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  5840. $ctx1.sendIdx[">="]=1;
  5841. return $recv($1)._and_((function(){
  5842. return $core.withContext(function($ctx2) {
  5843. $3=$self._y();
  5844. $ctx2.sendIdx["y"]=1;
  5845. return $recv($3).__gt_eq($recv(aPoint)._y());
  5846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5847. }));
  5848. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  5849. },
  5850. args: ["aPoint"],
  5851. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  5852. referencedClasses: [],
  5853. messageSends: ["and:", ">=", "x", "y"]
  5854. }),
  5855. $globals.Point);
  5856. $core.addMethod(
  5857. $core.method({
  5858. selector: "asPoint",
  5859. protocol: "converting",
  5860. fn: function (){
  5861. var self=this,$self=this;
  5862. return self;
  5863. },
  5864. args: [],
  5865. source: "asPoint\x0a\x09^ self",
  5866. referencedClasses: [],
  5867. messageSends: []
  5868. }),
  5869. $globals.Point);
  5870. $core.addMethod(
  5871. $core.method({
  5872. selector: "dist:",
  5873. protocol: "transforming",
  5874. fn: function (aPoint){
  5875. var self=this,$self=this;
  5876. var dx,dy;
  5877. return $core.withContext(function($ctx1) {
  5878. var $2,$1;
  5879. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  5880. $ctx1.sendIdx["-"]=1;
  5881. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  5882. $2=$recv(dx).__star(dx);
  5883. $ctx1.sendIdx["*"]=1;
  5884. $1=$recv($2).__plus($recv(dy).__star(dy));
  5885. return $recv($1)._sqrt();
  5886. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  5887. },
  5888. args: ["aPoint"],
  5889. source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt",
  5890. referencedClasses: [],
  5891. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  5892. }),
  5893. $globals.Point);
  5894. $core.addMethod(
  5895. $core.method({
  5896. selector: "printOn:",
  5897. protocol: "printing",
  5898. fn: function (aStream){
  5899. var self=this,$self=this;
  5900. return $core.withContext(function($ctx1) {
  5901. var $1;
  5902. $recv($self["@x"])._printOn_(aStream);
  5903. $ctx1.sendIdx["printOn:"]=1;
  5904. $recv(aStream)._nextPutAll_("@");
  5905. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  5906. return $core.withContext(function($ctx2) {
  5907. return $recv($self["@y"])._negative();
  5908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5909. }));
  5910. if($core.assert($1)){
  5911. $recv(aStream)._space();
  5912. }
  5913. $recv($self["@y"])._printOn_(aStream);
  5914. return self;
  5915. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  5916. },
  5917. args: ["aStream"],
  5918. 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",
  5919. referencedClasses: [],
  5920. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  5921. }),
  5922. $globals.Point);
  5923. $core.addMethod(
  5924. $core.method({
  5925. selector: "translateBy:",
  5926. protocol: "transforming",
  5927. fn: function (delta){
  5928. var self=this,$self=this;
  5929. return $core.withContext(function($ctx1) {
  5930. var $1;
  5931. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  5932. $ctx1.sendIdx["+"]=1;
  5933. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  5934. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  5935. },
  5936. args: ["delta"],
  5937. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  5938. referencedClasses: [],
  5939. messageSends: ["@", "+", "x", "y"]
  5940. }),
  5941. $globals.Point);
  5942. $core.addMethod(
  5943. $core.method({
  5944. selector: "x",
  5945. protocol: "accessing",
  5946. fn: function (){
  5947. var self=this,$self=this;
  5948. return $self["@x"];
  5949. },
  5950. args: [],
  5951. source: "x\x0a\x09^ x",
  5952. referencedClasses: [],
  5953. messageSends: []
  5954. }),
  5955. $globals.Point);
  5956. $core.addMethod(
  5957. $core.method({
  5958. selector: "x:",
  5959. protocol: "accessing",
  5960. fn: function (aNumber){
  5961. var self=this,$self=this;
  5962. $self["@x"]=aNumber;
  5963. return self;
  5964. },
  5965. args: ["aNumber"],
  5966. source: "x: aNumber\x0a\x09x := aNumber",
  5967. referencedClasses: [],
  5968. messageSends: []
  5969. }),
  5970. $globals.Point);
  5971. $core.addMethod(
  5972. $core.method({
  5973. selector: "y",
  5974. protocol: "accessing",
  5975. fn: function (){
  5976. var self=this,$self=this;
  5977. return $self["@y"];
  5978. },
  5979. args: [],
  5980. source: "y\x0a\x09^ y",
  5981. referencedClasses: [],
  5982. messageSends: []
  5983. }),
  5984. $globals.Point);
  5985. $core.addMethod(
  5986. $core.method({
  5987. selector: "y:",
  5988. protocol: "accessing",
  5989. fn: function (aNumber){
  5990. var self=this,$self=this;
  5991. $self["@y"]=aNumber;
  5992. return self;
  5993. },
  5994. args: ["aNumber"],
  5995. source: "y: aNumber\x0a\x09y := aNumber",
  5996. referencedClasses: [],
  5997. messageSends: []
  5998. }),
  5999. $globals.Point);
  6000. $core.addMethod(
  6001. $core.method({
  6002. selector: "classTag",
  6003. protocol: "accessing",
  6004. fn: function (){
  6005. var self=this,$self=this;
  6006. return "magnitude";
  6007. },
  6008. args: [],
  6009. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  6010. referencedClasses: [],
  6011. messageSends: []
  6012. }),
  6013. $globals.Point.a$cls);
  6014. $core.addMethod(
  6015. $core.method({
  6016. selector: "x:y:",
  6017. protocol: "instance creation",
  6018. fn: function (aNumber,anotherNumber){
  6019. var self=this,$self=this;
  6020. return $core.withContext(function($ctx1) {
  6021. var $1;
  6022. $1=$self._new();
  6023. $recv($1)._x_(aNumber);
  6024. $recv($1)._y_(anotherNumber);
  6025. return $recv($1)._yourself();
  6026. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6027. },
  6028. args: ["aNumber", "anotherNumber"],
  6029. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6030. referencedClasses: [],
  6031. messageSends: ["x:", "new", "y:", "yourself"]
  6032. }),
  6033. $globals.Point.a$cls);
  6034. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6035. $globals.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'`.";
  6036. $core.addMethod(
  6037. $core.method({
  6038. selector: "next",
  6039. protocol: "accessing",
  6040. fn: function (){
  6041. var self=this,$self=this;
  6042. return $core.withContext(function($ctx1) {
  6043. return Math.random();
  6044. return self;
  6045. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6046. },
  6047. args: [],
  6048. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6049. referencedClasses: [],
  6050. messageSends: []
  6051. }),
  6052. $globals.Random);
  6053. $core.addMethod(
  6054. $core.method({
  6055. selector: "next:",
  6056. protocol: "accessing",
  6057. fn: function (anInteger){
  6058. var self=this,$self=this;
  6059. return $core.withContext(function($ctx1) {
  6060. return $recv((1)._to_(anInteger))._collect_((function(each){
  6061. return $core.withContext(function($ctx2) {
  6062. return $self._next();
  6063. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6064. }));
  6065. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6066. },
  6067. args: ["anInteger"],
  6068. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6069. referencedClasses: [],
  6070. messageSends: ["collect:", "to:", "next"]
  6071. }),
  6072. $globals.Random);
  6073. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  6074. $globals.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`.";
  6075. $core.addMethod(
  6076. $core.method({
  6077. selector: "asJavaScriptObject",
  6078. protocol: "converting",
  6079. fn: function (){
  6080. var self=this,$self=this;
  6081. return null;
  6082. },
  6083. args: [],
  6084. source: "asJavaScriptObject\x0a\x09^ null",
  6085. referencedClasses: [],
  6086. messageSends: []
  6087. }),
  6088. $globals.UndefinedObject);
  6089. $core.addMethod(
  6090. $core.method({
  6091. selector: "deepCopy",
  6092. protocol: "copying",
  6093. fn: function (){
  6094. var self=this,$self=this;
  6095. return self;
  6096. },
  6097. args: [],
  6098. source: "deepCopy\x0a\x09^ self",
  6099. referencedClasses: [],
  6100. messageSends: []
  6101. }),
  6102. $globals.UndefinedObject);
  6103. $core.addMethod(
  6104. $core.method({
  6105. selector: "identityHash",
  6106. protocol: "accessing",
  6107. fn: function (){
  6108. var self=this,$self=this;
  6109. return "NIL";
  6110. },
  6111. args: [],
  6112. source: "identityHash\x0a\x09^ 'NIL'",
  6113. referencedClasses: [],
  6114. messageSends: []
  6115. }),
  6116. $globals.UndefinedObject);
  6117. $core.addMethod(
  6118. $core.method({
  6119. selector: "ifNil:",
  6120. protocol: "testing",
  6121. fn: function (aBlock){
  6122. var self=this,$self=this;
  6123. return $core.withContext(function($ctx1) {
  6124. return $self._ifNil_ifNotNil_(aBlock,(function(){
  6125. }));
  6126. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  6127. },
  6128. args: ["aBlock"],
  6129. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  6130. referencedClasses: [],
  6131. messageSends: ["ifNil:ifNotNil:"]
  6132. }),
  6133. $globals.UndefinedObject);
  6134. $core.addMethod(
  6135. $core.method({
  6136. selector: "ifNil:ifNotNil:",
  6137. protocol: "testing",
  6138. fn: function (aBlock,anotherBlock){
  6139. var self=this,$self=this;
  6140. return $core.withContext(function($ctx1) {
  6141. return $recv(aBlock)._value();
  6142. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  6143. },
  6144. args: ["aBlock", "anotherBlock"],
  6145. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  6146. referencedClasses: [],
  6147. messageSends: ["value"]
  6148. }),
  6149. $globals.UndefinedObject);
  6150. $core.addMethod(
  6151. $core.method({
  6152. selector: "ifNotNil:",
  6153. protocol: "testing",
  6154. fn: function (aBlock){
  6155. var self=this,$self=this;
  6156. return self;
  6157. },
  6158. args: ["aBlock"],
  6159. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  6160. referencedClasses: [],
  6161. messageSends: []
  6162. }),
  6163. $globals.UndefinedObject);
  6164. $core.addMethod(
  6165. $core.method({
  6166. selector: "ifNotNil:ifNil:",
  6167. protocol: "testing",
  6168. fn: function (aBlock,anotherBlock){
  6169. var self=this,$self=this;
  6170. return $core.withContext(function($ctx1) {
  6171. return $recv(anotherBlock)._value();
  6172. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  6173. },
  6174. args: ["aBlock", "anotherBlock"],
  6175. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  6176. referencedClasses: [],
  6177. messageSends: ["value"]
  6178. }),
  6179. $globals.UndefinedObject);
  6180. $core.addMethod(
  6181. $core.method({
  6182. selector: "isImmutable",
  6183. protocol: "testing",
  6184. fn: function (){
  6185. var self=this,$self=this;
  6186. return true;
  6187. },
  6188. args: [],
  6189. source: "isImmutable\x0a\x09^ true",
  6190. referencedClasses: [],
  6191. messageSends: []
  6192. }),
  6193. $globals.UndefinedObject);
  6194. $core.addMethod(
  6195. $core.method({
  6196. selector: "isNil",
  6197. protocol: "testing",
  6198. fn: function (){
  6199. var self=this,$self=this;
  6200. return true;
  6201. },
  6202. args: [],
  6203. source: "isNil\x0a\x09^ true",
  6204. referencedClasses: [],
  6205. messageSends: []
  6206. }),
  6207. $globals.UndefinedObject);
  6208. $core.addMethod(
  6209. $core.method({
  6210. selector: "notNil",
  6211. protocol: "testing",
  6212. fn: function (){
  6213. var self=this,$self=this;
  6214. return false;
  6215. },
  6216. args: [],
  6217. source: "notNil\x0a\x09^ false",
  6218. referencedClasses: [],
  6219. messageSends: []
  6220. }),
  6221. $globals.UndefinedObject);
  6222. $core.addMethod(
  6223. $core.method({
  6224. selector: "printOn:",
  6225. protocol: "printing",
  6226. fn: function (aStream){
  6227. var self=this,$self=this;
  6228. return $core.withContext(function($ctx1) {
  6229. $recv(aStream)._nextPutAll_("nil");
  6230. return self;
  6231. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  6232. },
  6233. args: ["aStream"],
  6234. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  6235. referencedClasses: [],
  6236. messageSends: ["nextPutAll:"]
  6237. }),
  6238. $globals.UndefinedObject);
  6239. $core.addMethod(
  6240. $core.method({
  6241. selector: "shallowCopy",
  6242. protocol: "copying",
  6243. fn: function (){
  6244. var self=this,$self=this;
  6245. return self;
  6246. },
  6247. args: [],
  6248. source: "shallowCopy\x0a\x09^ self",
  6249. referencedClasses: [],
  6250. messageSends: []
  6251. }),
  6252. $globals.UndefinedObject);
  6253. $core.addMethod(
  6254. $core.method({
  6255. selector: "value",
  6256. protocol: "evaluating",
  6257. fn: function (){
  6258. var self=this,$self=this;
  6259. return $core.withContext(function($ctx1) {
  6260. return null;
  6261. return self;
  6262. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  6263. },
  6264. args: [],
  6265. source: "value\x0a\x09<inlineJS: 'return null'>",
  6266. referencedClasses: [],
  6267. messageSends: []
  6268. }),
  6269. $globals.UndefinedObject);
  6270. $core.addMethod(
  6271. $core.method({
  6272. selector: "new",
  6273. protocol: "instance creation",
  6274. fn: function (){
  6275. var self=this,$self=this;
  6276. return $core.withContext(function($ctx1) {
  6277. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  6278. return self;
  6279. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  6280. },
  6281. args: [],
  6282. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  6283. referencedClasses: [],
  6284. messageSends: ["error:"]
  6285. }),
  6286. $globals.UndefinedObject.a$cls);
  6287. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  6288. });
  6289. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  6290. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  6291. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  6292. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  6293. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  6294. $core.addPackage("Kernel-Collections");
  6295. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  6296. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6297. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  6298. $globals.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:`";
  6299. $core.addMethod(
  6300. $core.method({
  6301. selector: "=",
  6302. protocol: "comparing",
  6303. fn: function (anAssociation){
  6304. var self=this,$self=this;
  6305. return $core.withContext(function($ctx1) {
  6306. var $3,$2,$5,$4,$6,$1;
  6307. $3=$self._class();
  6308. $ctx1.sendIdx["class"]=1;
  6309. $2=$recv($3).__eq($recv(anAssociation)._class());
  6310. $ctx1.sendIdx["="]=1;
  6311. $1=$recv($2)._and_((function(){
  6312. return $core.withContext(function($ctx2) {
  6313. $5=$self._key();
  6314. $ctx2.sendIdx["key"]=1;
  6315. $4=$recv($5).__eq($recv(anAssociation)._key());
  6316. $ctx2.sendIdx["="]=2;
  6317. return $recv($4)._and_((function(){
  6318. return $core.withContext(function($ctx3) {
  6319. $6=$self._value();
  6320. $ctx3.sendIdx["value"]=1;
  6321. return $recv($6).__eq($recv(anAssociation)._value());
  6322. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6323. }));
  6324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6325. }));
  6326. $ctx1.sendIdx["and:"]=1;
  6327. return $1;
  6328. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  6329. },
  6330. args: ["anAssociation"],
  6331. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  6332. referencedClasses: [],
  6333. messageSends: ["and:", "=", "class", "key", "value"]
  6334. }),
  6335. $globals.Association);
  6336. $core.addMethod(
  6337. $core.method({
  6338. selector: "key",
  6339. protocol: "accessing",
  6340. fn: function (){
  6341. var self=this,$self=this;
  6342. return $self["@key"];
  6343. },
  6344. args: [],
  6345. source: "key\x0a\x09^ key",
  6346. referencedClasses: [],
  6347. messageSends: []
  6348. }),
  6349. $globals.Association);
  6350. $core.addMethod(
  6351. $core.method({
  6352. selector: "key:",
  6353. protocol: "accessing",
  6354. fn: function (aKey){
  6355. var self=this,$self=this;
  6356. $self["@key"]=aKey;
  6357. return self;
  6358. },
  6359. args: ["aKey"],
  6360. source: "key: aKey\x0a\x09key := aKey",
  6361. referencedClasses: [],
  6362. messageSends: []
  6363. }),
  6364. $globals.Association);
  6365. $core.addMethod(
  6366. $core.method({
  6367. selector: "printOn:",
  6368. protocol: "printing",
  6369. fn: function (aStream){
  6370. var self=this,$self=this;
  6371. return $core.withContext(function($ctx1) {
  6372. $recv($self._key())._printOn_(aStream);
  6373. $ctx1.sendIdx["printOn:"]=1;
  6374. $recv(aStream)._nextPutAll_(" -> ");
  6375. $recv($self._value())._printOn_(aStream);
  6376. return self;
  6377. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  6378. },
  6379. args: ["aStream"],
  6380. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  6381. referencedClasses: [],
  6382. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  6383. }),
  6384. $globals.Association);
  6385. $core.addMethod(
  6386. $core.method({
  6387. selector: "value",
  6388. protocol: "accessing",
  6389. fn: function (){
  6390. var self=this,$self=this;
  6391. return $self["@value"];
  6392. },
  6393. args: [],
  6394. source: "value\x0a\x09^ value",
  6395. referencedClasses: [],
  6396. messageSends: []
  6397. }),
  6398. $globals.Association);
  6399. $core.addMethod(
  6400. $core.method({
  6401. selector: "value:",
  6402. protocol: "accessing",
  6403. fn: function (aValue){
  6404. var self=this,$self=this;
  6405. $self["@value"]=aValue;
  6406. return self;
  6407. },
  6408. args: ["aValue"],
  6409. source: "value: aValue\x0a\x09value := aValue",
  6410. referencedClasses: [],
  6411. messageSends: []
  6412. }),
  6413. $globals.Association);
  6414. $core.addMethod(
  6415. $core.method({
  6416. selector: "key:value:",
  6417. protocol: "instance creation",
  6418. fn: function (aKey,aValue){
  6419. var self=this,$self=this;
  6420. return $core.withContext(function($ctx1) {
  6421. var $1;
  6422. $1=$self._new();
  6423. $recv($1)._key_(aKey);
  6424. $recv($1)._value_(aValue);
  6425. return $recv($1)._yourself();
  6426. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  6427. },
  6428. args: ["aKey", "aValue"],
  6429. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  6430. referencedClasses: [],
  6431. messageSends: ["key:", "new", "value:", "yourself"]
  6432. }),
  6433. $globals.Association.a$cls);
  6434. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  6435. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  6436. $core.addMethod(
  6437. $core.method({
  6438. selector: "bucketOfElement:",
  6439. protocol: "accessing",
  6440. fn: function (anObject){
  6441. var self=this,$self=this;
  6442. return $core.withContext(function($ctx1) {
  6443. var hash = $self['@hashBlock'](anObject);
  6444. if (!hash) return null;
  6445. var buckets = $self['@buckets'],
  6446. bucket = buckets[hash];
  6447. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  6448. return bucket;
  6449. ;
  6450. return self;
  6451. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  6452. },
  6453. args: ["anObject"],
  6454. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self[''@hashBlock''](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self[''@buckets''],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  6455. referencedClasses: [],
  6456. messageSends: []
  6457. }),
  6458. $globals.BucketStore);
  6459. $core.addMethod(
  6460. $core.method({
  6461. selector: "do:",
  6462. protocol: "enumerating",
  6463. fn: function (aBlock){
  6464. var self=this,$self=this;
  6465. return $core.withContext(function($ctx1) {
  6466. var buckets = $self['@buckets'];
  6467. var keys = Object.keys(buckets);
  6468. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  6469. ;
  6470. return self;
  6471. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  6472. },
  6473. args: ["aBlock"],
  6474. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self[''@buckets''];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  6475. referencedClasses: [],
  6476. messageSends: []
  6477. }),
  6478. $globals.BucketStore);
  6479. $core.addMethod(
  6480. $core.method({
  6481. selector: "hashBlock:",
  6482. protocol: "accessing",
  6483. fn: function (aBlock){
  6484. var self=this,$self=this;
  6485. $self["@hashBlock"]=aBlock;
  6486. return self;
  6487. },
  6488. args: ["aBlock"],
  6489. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  6490. referencedClasses: [],
  6491. messageSends: []
  6492. }),
  6493. $globals.BucketStore);
  6494. $core.addMethod(
  6495. $core.method({
  6496. selector: "initialize",
  6497. protocol: "initialization",
  6498. fn: function (){
  6499. var self=this,$self=this;
  6500. return $core.withContext(function($ctx1) {
  6501. (
  6502. $ctx1.supercall = true,
  6503. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  6504. $ctx1.supercall = false;
  6505. $self._removeAll();
  6506. return self;
  6507. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  6508. },
  6509. args: [],
  6510. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  6511. referencedClasses: [],
  6512. messageSends: ["initialize", "removeAll"]
  6513. }),
  6514. $globals.BucketStore);
  6515. $core.addMethod(
  6516. $core.method({
  6517. selector: "newBucket",
  6518. protocol: "private",
  6519. fn: function (){
  6520. var self=this,$self=this;
  6521. return $core.withContext(function($ctx1) {
  6522. $self._subclassResponsibility();
  6523. return self;
  6524. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  6525. },
  6526. args: [],
  6527. source: "newBucket\x0a\x09self subclassResponsibility",
  6528. referencedClasses: [],
  6529. messageSends: ["subclassResponsibility"]
  6530. }),
  6531. $globals.BucketStore);
  6532. $core.addMethod(
  6533. $core.method({
  6534. selector: "removeAll",
  6535. protocol: "adding/removing",
  6536. fn: function (){
  6537. var self=this,$self=this;
  6538. return $core.withContext(function($ctx1) {
  6539. $self['@buckets'] = Object.create(null);;
  6540. return self;
  6541. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  6542. },
  6543. args: [],
  6544. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  6545. referencedClasses: [],
  6546. messageSends: []
  6547. }),
  6548. $globals.BucketStore);
  6549. $core.addMethod(
  6550. $core.method({
  6551. selector: "hashBlock:",
  6552. protocol: "instance creation",
  6553. fn: function (aBlock){
  6554. var self=this,$self=this;
  6555. return $core.withContext(function($ctx1) {
  6556. var $1;
  6557. $1=$self._new();
  6558. $recv($1)._hashBlock_(aBlock);
  6559. return $recv($1)._yourself();
  6560. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  6561. },
  6562. args: ["aBlock"],
  6563. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  6564. referencedClasses: [],
  6565. messageSends: ["hashBlock:", "new", "yourself"]
  6566. }),
  6567. $globals.BucketStore.a$cls);
  6568. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  6569. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  6570. $core.addMethod(
  6571. $core.method({
  6572. selector: "newBucket",
  6573. protocol: "private",
  6574. fn: function (){
  6575. var self=this,$self=this;
  6576. return [];
  6577. },
  6578. args: [],
  6579. source: "newBucket\x0a\x09^ #()",
  6580. referencedClasses: [],
  6581. messageSends: []
  6582. }),
  6583. $globals.ArrayBucketStore);
  6584. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  6585. $globals.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.";
  6586. $core.addMethod(
  6587. $core.method({
  6588. selector: ",",
  6589. protocol: "copying",
  6590. fn: function (aCollection){
  6591. var self=this,$self=this;
  6592. return $core.withContext(function($ctx1) {
  6593. var $1;
  6594. $1=$self._copy();
  6595. $recv($1)._addAll_(aCollection);
  6596. return $recv($1)._yourself();
  6597. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  6598. },
  6599. args: ["aCollection"],
  6600. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  6601. referencedClasses: [],
  6602. messageSends: ["addAll:", "copy", "yourself"]
  6603. }),
  6604. $globals.Collection);
  6605. $core.addMethod(
  6606. $core.method({
  6607. selector: "add:",
  6608. protocol: "adding/removing",
  6609. fn: function (anObject){
  6610. var self=this,$self=this;
  6611. return $core.withContext(function($ctx1) {
  6612. $self._subclassResponsibility();
  6613. return self;
  6614. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  6615. },
  6616. args: ["anObject"],
  6617. source: "add: anObject\x0a\x09self subclassResponsibility",
  6618. referencedClasses: [],
  6619. messageSends: ["subclassResponsibility"]
  6620. }),
  6621. $globals.Collection);
  6622. $core.addMethod(
  6623. $core.method({
  6624. selector: "addAll:",
  6625. protocol: "adding/removing",
  6626. fn: function (aCollection){
  6627. var self=this,$self=this;
  6628. return $core.withContext(function($ctx1) {
  6629. $recv(aCollection)._do_((function(each){
  6630. return $core.withContext(function($ctx2) {
  6631. return $self._add_(each);
  6632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6633. }));
  6634. return aCollection;
  6635. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  6636. },
  6637. args: ["aCollection"],
  6638. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  6639. referencedClasses: [],
  6640. messageSends: ["do:", "add:"]
  6641. }),
  6642. $globals.Collection);
  6643. $core.addMethod(
  6644. $core.method({
  6645. selector: "allSatisfy:",
  6646. protocol: "enumerating",
  6647. fn: function (aBlock){
  6648. var self=this,$self=this;
  6649. return $core.withContext(function($ctx1) {
  6650. var $1;
  6651. var $early={};
  6652. try {
  6653. $self._do_((function(each){
  6654. return $core.withContext(function($ctx2) {
  6655. $1=$recv(aBlock)._value_(each);
  6656. if(!$core.assert($1)){
  6657. throw $early=[false];
  6658. }
  6659. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6660. }));
  6661. return true;
  6662. }
  6663. catch(e) {if(e===$early)return e[0]; throw e}
  6664. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  6665. },
  6666. args: ["aBlock"],
  6667. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  6668. referencedClasses: [],
  6669. messageSends: ["do:", "ifFalse:", "value:"]
  6670. }),
  6671. $globals.Collection);
  6672. $core.addMethod(
  6673. $core.method({
  6674. selector: "anyOne",
  6675. protocol: "accessing",
  6676. fn: function (){
  6677. var self=this,$self=this;
  6678. return $core.withContext(function($ctx1) {
  6679. var $early={};
  6680. try {
  6681. $self._ifEmpty_((function(){
  6682. return $core.withContext(function($ctx2) {
  6683. return $self._error_("Collection is empty");
  6684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6685. }));
  6686. $self._do_((function(each){
  6687. throw $early=[each];
  6688. }));
  6689. return self;
  6690. }
  6691. catch(e) {if(e===$early)return e[0]; throw e}
  6692. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  6693. },
  6694. args: [],
  6695. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  6696. referencedClasses: [],
  6697. messageSends: ["ifEmpty:", "error:", "do:"]
  6698. }),
  6699. $globals.Collection);
  6700. $core.addMethod(
  6701. $core.method({
  6702. selector: "anySatisfy:",
  6703. protocol: "enumerating",
  6704. fn: function (aBlock){
  6705. var self=this,$self=this;
  6706. return $core.withContext(function($ctx1) {
  6707. var $1;
  6708. var $early={};
  6709. try {
  6710. $self._do_((function(each){
  6711. return $core.withContext(function($ctx2) {
  6712. $1=$recv(aBlock)._value_(each);
  6713. if($core.assert($1)){
  6714. throw $early=[true];
  6715. }
  6716. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6717. }));
  6718. return false;
  6719. }
  6720. catch(e) {if(e===$early)return e[0]; throw e}
  6721. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  6722. },
  6723. args: ["aBlock"],
  6724. source: "anySatisfy: 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",
  6725. referencedClasses: [],
  6726. messageSends: ["do:", "ifTrue:", "value:"]
  6727. }),
  6728. $globals.Collection);
  6729. $core.addMethod(
  6730. $core.method({
  6731. selector: "asArray",
  6732. protocol: "converting",
  6733. fn: function (){
  6734. var self=this,$self=this;
  6735. return $core.withContext(function($ctx1) {
  6736. return $recv($globals.Array)._withAll_(self);
  6737. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  6738. },
  6739. args: [],
  6740. source: "asArray\x0a\x09^ Array withAll: self",
  6741. referencedClasses: ["Array"],
  6742. messageSends: ["withAll:"]
  6743. }),
  6744. $globals.Collection);
  6745. $core.addMethod(
  6746. $core.method({
  6747. selector: "asJavaScriptObject",
  6748. protocol: "converting",
  6749. fn: function (){
  6750. var self=this,$self=this;
  6751. return $core.withContext(function($ctx1) {
  6752. return $recv($self._asArray())._collect_((function(each){
  6753. return $core.withContext(function($ctx2) {
  6754. return $recv(each)._asJavaScriptObject();
  6755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6756. }));
  6757. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  6758. },
  6759. args: [],
  6760. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  6761. referencedClasses: [],
  6762. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  6763. }),
  6764. $globals.Collection);
  6765. $core.addMethod(
  6766. $core.method({
  6767. selector: "asOrderedCollection",
  6768. protocol: "converting",
  6769. fn: function (){
  6770. var self=this,$self=this;
  6771. return $core.withContext(function($ctx1) {
  6772. return $self._asArray();
  6773. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  6774. },
  6775. args: [],
  6776. source: "asOrderedCollection\x0a\x09^ self asArray",
  6777. referencedClasses: [],
  6778. messageSends: ["asArray"]
  6779. }),
  6780. $globals.Collection);
  6781. $core.addMethod(
  6782. $core.method({
  6783. selector: "asSet",
  6784. protocol: "converting",
  6785. fn: function (){
  6786. var self=this,$self=this;
  6787. return $core.withContext(function($ctx1) {
  6788. return $recv($globals.Set)._withAll_(self);
  6789. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  6790. },
  6791. args: [],
  6792. source: "asSet\x0a\x09^ Set withAll: self",
  6793. referencedClasses: ["Set"],
  6794. messageSends: ["withAll:"]
  6795. }),
  6796. $globals.Collection);
  6797. $core.addMethod(
  6798. $core.method({
  6799. selector: "collect:",
  6800. protocol: "enumerating",
  6801. fn: function (aBlock){
  6802. var self=this,$self=this;
  6803. var stream;
  6804. return $core.withContext(function($ctx1) {
  6805. stream=$recv($recv($self._class())._new())._writeStream();
  6806. $self._do_((function(each){
  6807. return $core.withContext(function($ctx2) {
  6808. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  6809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6810. }));
  6811. return $recv(stream)._contents();
  6812. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  6813. },
  6814. args: ["aBlock"],
  6815. 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",
  6816. referencedClasses: [],
  6817. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  6818. }),
  6819. $globals.Collection);
  6820. $core.addMethod(
  6821. $core.method({
  6822. selector: "copyWith:",
  6823. protocol: "copying",
  6824. fn: function (anObject){
  6825. var self=this,$self=this;
  6826. return $core.withContext(function($ctx1) {
  6827. var $1;
  6828. $1=$self._copy();
  6829. $recv($1)._add_(anObject);
  6830. return $recv($1)._yourself();
  6831. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  6832. },
  6833. args: ["anObject"],
  6834. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  6835. referencedClasses: [],
  6836. messageSends: ["add:", "copy", "yourself"]
  6837. }),
  6838. $globals.Collection);
  6839. $core.addMethod(
  6840. $core.method({
  6841. selector: "copyWithAll:",
  6842. protocol: "copying",
  6843. fn: function (aCollection){
  6844. var self=this,$self=this;
  6845. return $core.withContext(function($ctx1) {
  6846. var $1;
  6847. $1=$self._copy();
  6848. $recv($1)._addAll_(aCollection);
  6849. return $recv($1)._yourself();
  6850. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  6851. },
  6852. args: ["aCollection"],
  6853. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  6854. referencedClasses: [],
  6855. messageSends: ["addAll:", "copy", "yourself"]
  6856. }),
  6857. $globals.Collection);
  6858. $core.addMethod(
  6859. $core.method({
  6860. selector: "copyWithout:",
  6861. protocol: "copying",
  6862. fn: function (anObject){
  6863. var self=this,$self=this;
  6864. return $core.withContext(function($ctx1) {
  6865. return $self._reject_((function(each){
  6866. return $core.withContext(function($ctx2) {
  6867. return $recv(each).__eq(anObject);
  6868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6869. }));
  6870. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  6871. },
  6872. args: ["anObject"],
  6873. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  6874. referencedClasses: [],
  6875. messageSends: ["reject:", "="]
  6876. }),
  6877. $globals.Collection);
  6878. $core.addMethod(
  6879. $core.method({
  6880. selector: "copyWithoutAll:",
  6881. protocol: "copying",
  6882. fn: function (aCollection){
  6883. var self=this,$self=this;
  6884. return $core.withContext(function($ctx1) {
  6885. return $self._reject_((function(each){
  6886. return $core.withContext(function($ctx2) {
  6887. return $recv(aCollection)._includes_(each);
  6888. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6889. }));
  6890. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  6891. },
  6892. args: ["aCollection"],
  6893. 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 ]",
  6894. referencedClasses: [],
  6895. messageSends: ["reject:", "includes:"]
  6896. }),
  6897. $globals.Collection);
  6898. $core.addMethod(
  6899. $core.method({
  6900. selector: "deepCopy",
  6901. protocol: "copying",
  6902. fn: function (){
  6903. var self=this,$self=this;
  6904. return $core.withContext(function($ctx1) {
  6905. return $self._collect_((function(each){
  6906. return $core.withContext(function($ctx2) {
  6907. return $recv(each)._deepCopy();
  6908. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6909. }));
  6910. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  6911. },
  6912. args: [],
  6913. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  6914. referencedClasses: [],
  6915. messageSends: ["collect:", "deepCopy"]
  6916. }),
  6917. $globals.Collection);
  6918. $core.addMethod(
  6919. $core.method({
  6920. selector: "detect:",
  6921. protocol: "enumerating",
  6922. fn: function (aBlock){
  6923. var self=this,$self=this;
  6924. return $core.withContext(function($ctx1) {
  6925. return $self._detect_ifNone_(aBlock,(function(){
  6926. return $core.withContext(function($ctx2) {
  6927. return $self._errorNotFound();
  6928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6929. }));
  6930. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  6931. },
  6932. args: ["aBlock"],
  6933. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  6934. referencedClasses: [],
  6935. messageSends: ["detect:ifNone:", "errorNotFound"]
  6936. }),
  6937. $globals.Collection);
  6938. $core.addMethod(
  6939. $core.method({
  6940. selector: "detect:ifNone:",
  6941. protocol: "enumerating",
  6942. fn: function (aBlock,anotherBlock){
  6943. var self=this,$self=this;
  6944. return $core.withContext(function($ctx1) {
  6945. $self._subclassResponsibility();
  6946. return self;
  6947. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  6948. },
  6949. args: ["aBlock", "anotherBlock"],
  6950. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  6951. referencedClasses: [],
  6952. messageSends: ["subclassResponsibility"]
  6953. }),
  6954. $globals.Collection);
  6955. $core.addMethod(
  6956. $core.method({
  6957. selector: "do:",
  6958. protocol: "enumerating",
  6959. fn: function (aBlock){
  6960. var self=this,$self=this;
  6961. return $core.withContext(function($ctx1) {
  6962. $self._subclassResponsibility();
  6963. return self;
  6964. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  6965. },
  6966. args: ["aBlock"],
  6967. source: "do: aBlock\x0a\x09self subclassResponsibility",
  6968. referencedClasses: [],
  6969. messageSends: ["subclassResponsibility"]
  6970. }),
  6971. $globals.Collection);
  6972. $core.addMethod(
  6973. $core.method({
  6974. selector: "do:separatedBy:",
  6975. protocol: "enumerating",
  6976. fn: function (aBlock,anotherBlock){
  6977. var self=this,$self=this;
  6978. var actionBeforeElement;
  6979. return $core.withContext(function($ctx1) {
  6980. actionBeforeElement=(function(){
  6981. actionBeforeElement=anotherBlock;
  6982. return actionBeforeElement;
  6983. });
  6984. $self._do_((function(each){
  6985. return $core.withContext(function($ctx2) {
  6986. $recv(actionBeforeElement)._value();
  6987. return $recv(aBlock)._value_(each);
  6988. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  6989. }));
  6990. return self;
  6991. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  6992. },
  6993. args: ["aBlock", "anotherBlock"],
  6994. 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 ]",
  6995. referencedClasses: [],
  6996. messageSends: ["do:", "value", "value:"]
  6997. }),
  6998. $globals.Collection);
  6999. $core.addMethod(
  7000. $core.method({
  7001. selector: "errorNotFound",
  7002. protocol: "error handling",
  7003. fn: function (){
  7004. var self=this,$self=this;
  7005. return $core.withContext(function($ctx1) {
  7006. $self._error_("Object is not in the collection");
  7007. return self;
  7008. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7009. },
  7010. args: [],
  7011. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7012. referencedClasses: [],
  7013. messageSends: ["error:"]
  7014. }),
  7015. $globals.Collection);
  7016. $core.addMethod(
  7017. $core.method({
  7018. selector: "ifEmpty:",
  7019. protocol: "testing",
  7020. fn: function (aBlock){
  7021. var self=this,$self=this;
  7022. return $core.withContext(function($ctx1) {
  7023. var $1;
  7024. $1=$self._isEmpty();
  7025. if($core.assert($1)){
  7026. return $recv(aBlock)._value();
  7027. } else {
  7028. return self;
  7029. }
  7030. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  7031. },
  7032. args: ["aBlock"],
  7033. 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. \x0a\x09Note 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: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  7034. referencedClasses: [],
  7035. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  7036. }),
  7037. $globals.Collection);
  7038. $core.addMethod(
  7039. $core.method({
  7040. selector: "ifEmpty:ifNotEmpty:",
  7041. protocol: "testing",
  7042. fn: function (aBlock,anotherBlock){
  7043. var self=this,$self=this;
  7044. return $core.withContext(function($ctx1) {
  7045. var $1;
  7046. $1=$self._isEmpty();
  7047. if($core.assert($1)){
  7048. return $recv(aBlock)._value();
  7049. } else {
  7050. return $recv(anotherBlock)._value_(self);
  7051. }
  7052. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7053. },
  7054. args: ["aBlock", "anotherBlock"],
  7055. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  7056. referencedClasses: [],
  7057. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  7058. }),
  7059. $globals.Collection);
  7060. $core.addMethod(
  7061. $core.method({
  7062. selector: "ifNotEmpty:",
  7063. protocol: "testing",
  7064. fn: function (aBlock){
  7065. var self=this,$self=this;
  7066. return $core.withContext(function($ctx1) {
  7067. var $1;
  7068. $1=$self._notEmpty();
  7069. if($core.assert($1)){
  7070. return $recv(aBlock)._value_(self);
  7071. } else {
  7072. return self;
  7073. }
  7074. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  7075. },
  7076. args: ["aBlock"],
  7077. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  7078. referencedClasses: [],
  7079. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  7080. }),
  7081. $globals.Collection);
  7082. $core.addMethod(
  7083. $core.method({
  7084. selector: "ifNotEmpty:ifEmpty:",
  7085. protocol: "testing",
  7086. fn: function (aBlock,anotherBlock){
  7087. var self=this,$self=this;
  7088. return $core.withContext(function($ctx1) {
  7089. var $1;
  7090. $1=$self._notEmpty();
  7091. if($core.assert($1)){
  7092. return $recv(aBlock)._value_(self);
  7093. } else {
  7094. return $recv(anotherBlock)._value();
  7095. }
  7096. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7097. },
  7098. args: ["aBlock", "anotherBlock"],
  7099. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  7100. referencedClasses: [],
  7101. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  7102. }),
  7103. $globals.Collection);
  7104. $core.addMethod(
  7105. $core.method({
  7106. selector: "includes:",
  7107. protocol: "testing",
  7108. fn: function (anObject){
  7109. var self=this,$self=this;
  7110. return $core.withContext(function($ctx1) {
  7111. return $self._anySatisfy_((function(each){
  7112. return $core.withContext(function($ctx2) {
  7113. return $recv(each).__eq(anObject);
  7114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7115. }));
  7116. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  7117. },
  7118. args: ["anObject"],
  7119. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  7120. referencedClasses: [],
  7121. messageSends: ["anySatisfy:", "="]
  7122. }),
  7123. $globals.Collection);
  7124. $core.addMethod(
  7125. $core.method({
  7126. selector: "inject:into:",
  7127. protocol: "enumerating",
  7128. fn: function (anObject,aBlock){
  7129. var self=this,$self=this;
  7130. var result;
  7131. return $core.withContext(function($ctx1) {
  7132. result=anObject;
  7133. $self._do_((function(each){
  7134. return $core.withContext(function($ctx2) {
  7135. result=$recv(aBlock)._value_value_(result,each);
  7136. return result;
  7137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7138. }));
  7139. return result;
  7140. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  7141. },
  7142. args: ["anObject", "aBlock"],
  7143. 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",
  7144. referencedClasses: [],
  7145. messageSends: ["do:", "value:value:"]
  7146. }),
  7147. $globals.Collection);
  7148. $core.addMethod(
  7149. $core.method({
  7150. selector: "intersection:",
  7151. protocol: "enumerating",
  7152. fn: function (aCollection){
  7153. var self=this,$self=this;
  7154. var set,outputSet;
  7155. return $core.withContext(function($ctx1) {
  7156. var $2,$1;
  7157. set=$self._asSet();
  7158. outputSet=$recv($globals.Set)._new();
  7159. $recv(aCollection)._do_((function(each){
  7160. return $core.withContext(function($ctx2) {
  7161. $2=$recv(set)._includes_(each);
  7162. $ctx2.sendIdx["includes:"]=1;
  7163. $1=$recv($2)._and_((function(){
  7164. return $core.withContext(function($ctx3) {
  7165. return $recv($recv(outputSet)._includes_(each))._not();
  7166. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7167. }));
  7168. if($core.assert($1)){
  7169. return $recv(outputSet)._add_(each);
  7170. }
  7171. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7172. }));
  7173. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  7174. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  7175. },
  7176. args: ["aCollection"],
  7177. 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",
  7178. referencedClasses: ["Set"],
  7179. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  7180. }),
  7181. $globals.Collection);
  7182. $core.addMethod(
  7183. $core.method({
  7184. selector: "isEmpty",
  7185. protocol: "testing",
  7186. fn: function (){
  7187. var self=this,$self=this;
  7188. return $core.withContext(function($ctx1) {
  7189. return $recv($self._size()).__eq((0));
  7190. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  7191. },
  7192. args: [],
  7193. source: "isEmpty\x0a\x09^ self size = 0",
  7194. referencedClasses: [],
  7195. messageSends: ["=", "size"]
  7196. }),
  7197. $globals.Collection);
  7198. $core.addMethod(
  7199. $core.method({
  7200. selector: "noneSatisfy:",
  7201. protocol: "enumerating",
  7202. fn: function (aBlock){
  7203. var self=this,$self=this;
  7204. return $core.withContext(function($ctx1) {
  7205. var $1;
  7206. var $early={};
  7207. try {
  7208. $self._do_((function(item){
  7209. return $core.withContext(function($ctx2) {
  7210. $1=$recv(aBlock)._value_(item);
  7211. if($core.assert($1)){
  7212. throw $early=[false];
  7213. }
  7214. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  7215. }));
  7216. return true;
  7217. }
  7218. catch(e) {if(e===$early)return e[0]; throw e}
  7219. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7220. },
  7221. args: ["aBlock"],
  7222. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  7223. referencedClasses: [],
  7224. messageSends: ["do:", "ifTrue:", "value:"]
  7225. }),
  7226. $globals.Collection);
  7227. $core.addMethod(
  7228. $core.method({
  7229. selector: "notEmpty",
  7230. protocol: "testing",
  7231. fn: function (){
  7232. var self=this,$self=this;
  7233. return $core.withContext(function($ctx1) {
  7234. return $recv($self._isEmpty())._not();
  7235. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  7236. },
  7237. args: [],
  7238. source: "notEmpty\x0a\x09^ self isEmpty not",
  7239. referencedClasses: [],
  7240. messageSends: ["not", "isEmpty"]
  7241. }),
  7242. $globals.Collection);
  7243. $core.addMethod(
  7244. $core.method({
  7245. selector: "occurrencesOf:",
  7246. protocol: "accessing",
  7247. fn: function (anObject){
  7248. var self=this,$self=this;
  7249. var tally;
  7250. return $core.withContext(function($ctx1) {
  7251. var $1;
  7252. tally=(0);
  7253. $self._do_((function(each){
  7254. return $core.withContext(function($ctx2) {
  7255. $1=$recv(anObject).__eq(each);
  7256. if($core.assert($1)){
  7257. tally=$recv(tally).__plus((1));
  7258. return tally;
  7259. }
  7260. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7261. }));
  7262. return tally;
  7263. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  7264. },
  7265. args: ["anObject"],
  7266. 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",
  7267. referencedClasses: [],
  7268. messageSends: ["do:", "ifTrue:", "=", "+"]
  7269. }),
  7270. $globals.Collection);
  7271. $core.addMethod(
  7272. $core.method({
  7273. selector: "putOn:",
  7274. protocol: "streaming",
  7275. fn: function (aStream){
  7276. var self=this,$self=this;
  7277. return $core.withContext(function($ctx1) {
  7278. $self._do_((function(each){
  7279. return $core.withContext(function($ctx2) {
  7280. return $recv(each)._putOn_(aStream);
  7281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7282. }));
  7283. return self;
  7284. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  7285. },
  7286. args: ["aStream"],
  7287. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  7288. referencedClasses: [],
  7289. messageSends: ["do:", "putOn:"]
  7290. }),
  7291. $globals.Collection);
  7292. $core.addMethod(
  7293. $core.method({
  7294. selector: "reject:",
  7295. protocol: "enumerating",
  7296. fn: function (aBlock){
  7297. var self=this,$self=this;
  7298. return $core.withContext(function($ctx1) {
  7299. return $self._select_((function(each){
  7300. return $core.withContext(function($ctx2) {
  7301. return $recv($recv(aBlock)._value_(each)).__eq(false);
  7302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7303. }));
  7304. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  7305. },
  7306. args: ["aBlock"],
  7307. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  7308. referencedClasses: [],
  7309. messageSends: ["select:", "=", "value:"]
  7310. }),
  7311. $globals.Collection);
  7312. $core.addMethod(
  7313. $core.method({
  7314. selector: "remove:",
  7315. protocol: "adding/removing",
  7316. fn: function (anObject){
  7317. var self=this,$self=this;
  7318. return $core.withContext(function($ctx1) {
  7319. return $self._remove_ifAbsent_(anObject,(function(){
  7320. return $core.withContext(function($ctx2) {
  7321. return $self._errorNotFound();
  7322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7323. }));
  7324. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  7325. },
  7326. args: ["anObject"],
  7327. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  7328. referencedClasses: [],
  7329. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  7330. }),
  7331. $globals.Collection);
  7332. $core.addMethod(
  7333. $core.method({
  7334. selector: "remove:ifAbsent:",
  7335. protocol: "adding/removing",
  7336. fn: function (anObject,aBlock){
  7337. var self=this,$self=this;
  7338. return $core.withContext(function($ctx1) {
  7339. $self._subclassResponsibility();
  7340. return self;
  7341. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  7342. },
  7343. args: ["anObject", "aBlock"],
  7344. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  7345. referencedClasses: [],
  7346. messageSends: ["subclassResponsibility"]
  7347. }),
  7348. $globals.Collection);
  7349. $core.addMethod(
  7350. $core.method({
  7351. selector: "removeAll",
  7352. protocol: "adding/removing",
  7353. fn: function (){
  7354. var self=this,$self=this;
  7355. return $core.withContext(function($ctx1) {
  7356. $self._subclassResponsibility();
  7357. return self;
  7358. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  7359. },
  7360. args: [],
  7361. source: "removeAll\x0a\x09self subclassResponsibility",
  7362. referencedClasses: [],
  7363. messageSends: ["subclassResponsibility"]
  7364. }),
  7365. $globals.Collection);
  7366. $core.addMethod(
  7367. $core.method({
  7368. selector: "select:",
  7369. protocol: "enumerating",
  7370. fn: function (aBlock){
  7371. var self=this,$self=this;
  7372. var stream;
  7373. return $core.withContext(function($ctx1) {
  7374. var $1;
  7375. stream=$recv($recv($self._class())._new())._writeStream();
  7376. $self._do_((function(each){
  7377. return $core.withContext(function($ctx2) {
  7378. $1=$recv(aBlock)._value_(each);
  7379. if($core.assert($1)){
  7380. return $recv(stream)._nextPut_(each);
  7381. }
  7382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7383. }));
  7384. return $recv(stream)._contents();
  7385. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7386. },
  7387. args: ["aBlock"],
  7388. 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",
  7389. referencedClasses: [],
  7390. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  7391. }),
  7392. $globals.Collection);
  7393. $core.addMethod(
  7394. $core.method({
  7395. selector: "select:thenCollect:",
  7396. protocol: "enumerating",
  7397. fn: function (selectBlock,collectBlock){
  7398. var self=this,$self=this;
  7399. var stream;
  7400. return $core.withContext(function($ctx1) {
  7401. var $1;
  7402. stream=$recv($recv($self._class())._new())._writeStream();
  7403. $self._do_((function(each){
  7404. return $core.withContext(function($ctx2) {
  7405. $1=$recv(selectBlock)._value_(each);
  7406. $ctx2.sendIdx["value:"]=1;
  7407. if($core.assert($1)){
  7408. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  7409. }
  7410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7411. }));
  7412. return $recv(stream)._contents();
  7413. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  7414. },
  7415. args: ["selectBlock", "collectBlock"],
  7416. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  7417. referencedClasses: [],
  7418. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  7419. }),
  7420. $globals.Collection);
  7421. $core.addMethod(
  7422. $core.method({
  7423. selector: "shallowCopy",
  7424. protocol: "copying",
  7425. fn: function (){
  7426. var self=this,$self=this;
  7427. return $core.withContext(function($ctx1) {
  7428. return $self._collect_((function(each){
  7429. return each;
  7430. }));
  7431. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  7432. },
  7433. args: [],
  7434. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  7435. referencedClasses: [],
  7436. messageSends: ["collect:"]
  7437. }),
  7438. $globals.Collection);
  7439. $core.addMethod(
  7440. $core.method({
  7441. selector: "single",
  7442. protocol: "accessing",
  7443. fn: function (){
  7444. var self=this,$self=this;
  7445. return $core.withContext(function($ctx1) {
  7446. var $1;
  7447. $self._ifEmpty_((function(){
  7448. return $core.withContext(function($ctx2) {
  7449. return $self._error_("Collection is empty");
  7450. $ctx2.sendIdx["error:"]=1;
  7451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7452. }));
  7453. $1=$recv($self._size()).__gt((1));
  7454. if($core.assert($1)){
  7455. $self._error_("Collection holds more than one element");
  7456. }
  7457. return $self._anyOne();
  7458. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  7459. },
  7460. args: [],
  7461. source: "single\x0a\x09\x22Answer a single element.\x0a\x09Raise an error if collection holds less or more than one element.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self size > 1 ifTrue: [ self error: 'Collection holds more than one element' ].\x0a\x09^ self anyOne",
  7462. referencedClasses: [],
  7463. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  7464. }),
  7465. $globals.Collection);
  7466. $core.addMethod(
  7467. $core.method({
  7468. selector: "size",
  7469. protocol: "accessing",
  7470. fn: function (){
  7471. var self=this,$self=this;
  7472. return $core.withContext(function($ctx1) {
  7473. $self._subclassResponsibility();
  7474. return self;
  7475. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  7476. },
  7477. args: [],
  7478. source: "size\x0a\x09self subclassResponsibility",
  7479. referencedClasses: [],
  7480. messageSends: ["subclassResponsibility"]
  7481. }),
  7482. $globals.Collection);
  7483. $core.addMethod(
  7484. $core.method({
  7485. selector: "classTag",
  7486. protocol: "accessing",
  7487. fn: function (){
  7488. var self=this,$self=this;
  7489. return "collection";
  7490. },
  7491. args: [],
  7492. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'collection'",
  7493. referencedClasses: [],
  7494. messageSends: []
  7495. }),
  7496. $globals.Collection.a$cls);
  7497. $core.addMethod(
  7498. $core.method({
  7499. selector: "new:",
  7500. protocol: "instance creation",
  7501. fn: function (anInteger){
  7502. var self=this,$self=this;
  7503. return $core.withContext(function($ctx1) {
  7504. return $self._new();
  7505. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  7506. },
  7507. args: ["anInteger"],
  7508. source: "new: anInteger\x0a\x09^ self new",
  7509. referencedClasses: [],
  7510. messageSends: ["new"]
  7511. }),
  7512. $globals.Collection.a$cls);
  7513. $core.addMethod(
  7514. $core.method({
  7515. selector: "with:",
  7516. protocol: "instance creation",
  7517. fn: function (anObject){
  7518. var self=this,$self=this;
  7519. return $core.withContext(function($ctx1) {
  7520. var $1;
  7521. $1=$self._new();
  7522. $recv($1)._add_(anObject);
  7523. return $recv($1)._yourself();
  7524. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  7525. },
  7526. args: ["anObject"],
  7527. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  7528. referencedClasses: [],
  7529. messageSends: ["add:", "new", "yourself"]
  7530. }),
  7531. $globals.Collection.a$cls);
  7532. $core.addMethod(
  7533. $core.method({
  7534. selector: "with:with:",
  7535. protocol: "instance creation",
  7536. fn: function (anObject,anotherObject){
  7537. var self=this,$self=this;
  7538. return $core.withContext(function($ctx1) {
  7539. var $1;
  7540. $1=$self._new();
  7541. $recv($1)._add_(anObject);
  7542. $ctx1.sendIdx["add:"]=1;
  7543. $recv($1)._add_(anotherObject);
  7544. return $recv($1)._yourself();
  7545. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  7546. },
  7547. args: ["anObject", "anotherObject"],
  7548. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  7549. referencedClasses: [],
  7550. messageSends: ["add:", "new", "yourself"]
  7551. }),
  7552. $globals.Collection.a$cls);
  7553. $core.addMethod(
  7554. $core.method({
  7555. selector: "with:with:with:",
  7556. protocol: "instance creation",
  7557. fn: function (firstObject,secondObject,thirdObject){
  7558. var self=this,$self=this;
  7559. return $core.withContext(function($ctx1) {
  7560. var $1;
  7561. $1=$self._new();
  7562. $recv($1)._add_(firstObject);
  7563. $ctx1.sendIdx["add:"]=1;
  7564. $recv($1)._add_(secondObject);
  7565. $ctx1.sendIdx["add:"]=2;
  7566. $recv($1)._add_(thirdObject);
  7567. return $recv($1)._yourself();
  7568. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  7569. },
  7570. args: ["firstObject", "secondObject", "thirdObject"],
  7571. 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",
  7572. referencedClasses: [],
  7573. messageSends: ["add:", "new", "yourself"]
  7574. }),
  7575. $globals.Collection.a$cls);
  7576. $core.addMethod(
  7577. $core.method({
  7578. selector: "withAll:",
  7579. protocol: "instance creation",
  7580. fn: function (aCollection){
  7581. var self=this,$self=this;
  7582. return $core.withContext(function($ctx1) {
  7583. var $1;
  7584. $1=$self._new();
  7585. $recv($1)._addAll_(aCollection);
  7586. return $recv($1)._yourself();
  7587. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  7588. },
  7589. args: ["aCollection"],
  7590. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7591. referencedClasses: [],
  7592. messageSends: ["addAll:", "new", "yourself"]
  7593. }),
  7594. $globals.Collection.a$cls);
  7595. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  7596. $globals.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.";
  7597. $core.addMethod(
  7598. $core.method({
  7599. selector: "at:",
  7600. protocol: "accessing",
  7601. fn: function (anIndex){
  7602. var self=this,$self=this;
  7603. return $core.withContext(function($ctx1) {
  7604. return $self._at_ifAbsent_(anIndex,(function(){
  7605. return $core.withContext(function($ctx2) {
  7606. return $self._errorNotFound();
  7607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7608. }));
  7609. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  7610. },
  7611. args: ["anIndex"],
  7612. 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 ]",
  7613. referencedClasses: [],
  7614. messageSends: ["at:ifAbsent:", "errorNotFound"]
  7615. }),
  7616. $globals.IndexableCollection);
  7617. $core.addMethod(
  7618. $core.method({
  7619. selector: "at:ifAbsent:",
  7620. protocol: "accessing",
  7621. fn: function (anIndex,aBlock){
  7622. var self=this,$self=this;
  7623. return $core.withContext(function($ctx1) {
  7624. $self._subclassResponsibility();
  7625. return self;
  7626. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  7627. },
  7628. args: ["anIndex", "aBlock"],
  7629. 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 subclassResponsibility",
  7630. referencedClasses: [],
  7631. messageSends: ["subclassResponsibility"]
  7632. }),
  7633. $globals.IndexableCollection);
  7634. $core.addMethod(
  7635. $core.method({
  7636. selector: "at:ifAbsentPut:",
  7637. protocol: "accessing",
  7638. fn: function (aKey,aBlock){
  7639. var self=this,$self=this;
  7640. return $core.withContext(function($ctx1) {
  7641. return $self._at_ifAbsent_(aKey,(function(){
  7642. return $core.withContext(function($ctx2) {
  7643. return $self._at_put_(aKey,$recv(aBlock)._value());
  7644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7645. }));
  7646. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  7647. },
  7648. args: ["aKey", "aBlock"],
  7649. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  7650. referencedClasses: [],
  7651. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  7652. }),
  7653. $globals.IndexableCollection);
  7654. $core.addMethod(
  7655. $core.method({
  7656. selector: "at:ifPresent:",
  7657. protocol: "accessing",
  7658. fn: function (anIndex,aBlock){
  7659. var self=this,$self=this;
  7660. return $core.withContext(function($ctx1) {
  7661. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  7662. return nil;
  7663. }));
  7664. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  7665. },
  7666. args: ["anIndex", "aBlock"],
  7667. 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 ]",
  7668. referencedClasses: [],
  7669. messageSends: ["at:ifPresent:ifAbsent:"]
  7670. }),
  7671. $globals.IndexableCollection);
  7672. $core.addMethod(
  7673. $core.method({
  7674. selector: "at:ifPresent:ifAbsent:",
  7675. protocol: "accessing",
  7676. fn: function (anIndex,aBlock,anotherBlock){
  7677. var self=this,$self=this;
  7678. return $core.withContext(function($ctx1) {
  7679. $self._subclassResponsibility();
  7680. return self;
  7681. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  7682. },
  7683. args: ["anIndex", "aBlock", "anotherBlock"],
  7684. 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",
  7685. referencedClasses: [],
  7686. messageSends: ["subclassResponsibility"]
  7687. }),
  7688. $globals.IndexableCollection);
  7689. $core.addMethod(
  7690. $core.method({
  7691. selector: "at:put:",
  7692. protocol: "accessing",
  7693. fn: function (anIndex,anObject){
  7694. var self=this,$self=this;
  7695. return $core.withContext(function($ctx1) {
  7696. $self._subclassResponsibility();
  7697. return self;
  7698. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  7699. },
  7700. args: ["anIndex", "anObject"],
  7701. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  7702. referencedClasses: [],
  7703. messageSends: ["subclassResponsibility"]
  7704. }),
  7705. $globals.IndexableCollection);
  7706. $core.addMethod(
  7707. $core.method({
  7708. selector: "indexOf:",
  7709. protocol: "accessing",
  7710. fn: function (anObject){
  7711. var self=this,$self=this;
  7712. return $core.withContext(function($ctx1) {
  7713. return $self._indexOf_ifAbsent_(anObject,(function(){
  7714. return $core.withContext(function($ctx2) {
  7715. return $self._errorNotFound();
  7716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7717. }));
  7718. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  7719. },
  7720. args: ["anObject"],
  7721. 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 ]",
  7722. referencedClasses: [],
  7723. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  7724. }),
  7725. $globals.IndexableCollection);
  7726. $core.addMethod(
  7727. $core.method({
  7728. selector: "indexOf:ifAbsent:",
  7729. protocol: "accessing",
  7730. fn: function (anObject,aBlock){
  7731. var self=this,$self=this;
  7732. return $core.withContext(function($ctx1) {
  7733. $self._subclassResponsibility();
  7734. return self;
  7735. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  7736. },
  7737. args: ["anObject", "aBlock"],
  7738. 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",
  7739. referencedClasses: [],
  7740. messageSends: ["subclassResponsibility"]
  7741. }),
  7742. $globals.IndexableCollection);
  7743. $core.addMethod(
  7744. $core.method({
  7745. selector: "with:do:",
  7746. protocol: "enumerating",
  7747. fn: function (anotherCollection,aBlock){
  7748. var self=this,$self=this;
  7749. return $core.withContext(function($ctx1) {
  7750. $self._withIndexDo_((function(each,index){
  7751. return $core.withContext(function($ctx2) {
  7752. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  7753. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  7754. }));
  7755. return self;
  7756. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  7757. },
  7758. args: ["anotherCollection", "aBlock"],
  7759. 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) ]",
  7760. referencedClasses: [],
  7761. messageSends: ["withIndexDo:", "value:value:", "at:"]
  7762. }),
  7763. $globals.IndexableCollection);
  7764. $core.addMethod(
  7765. $core.method({
  7766. selector: "withIndexDo:",
  7767. protocol: "enumerating",
  7768. fn: function (aBlock){
  7769. var self=this,$self=this;
  7770. return $core.withContext(function($ctx1) {
  7771. $self._subclassResponsibility();
  7772. return self;
  7773. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  7774. },
  7775. args: ["aBlock"],
  7776. 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 subclassResponsibility",
  7777. referencedClasses: [],
  7778. messageSends: ["subclassResponsibility"]
  7779. }),
  7780. $globals.IndexableCollection);
  7781. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  7782. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  7783. $core.addMethod(
  7784. $core.method({
  7785. selector: "=",
  7786. protocol: "comparing",
  7787. fn: function (anAssocitativeCollection){
  7788. var self=this,$self=this;
  7789. return $core.withContext(function($ctx1) {
  7790. var $2,$1,$4,$3,$5;
  7791. $2=$self._class();
  7792. $ctx1.sendIdx["class"]=1;
  7793. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  7794. $ctx1.sendIdx["="]=1;
  7795. if(!$core.assert($1)){
  7796. return false;
  7797. }
  7798. $4=$self._size();
  7799. $ctx1.sendIdx["size"]=1;
  7800. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  7801. $ctx1.sendIdx["="]=2;
  7802. if(!$core.assert($3)){
  7803. return false;
  7804. }
  7805. $5=$self._associations();
  7806. $ctx1.sendIdx["associations"]=1;
  7807. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  7808. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  7809. },
  7810. args: ["anAssocitativeCollection"],
  7811. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  7812. referencedClasses: [],
  7813. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  7814. }),
  7815. $globals.AssociativeCollection);
  7816. $core.addMethod(
  7817. $core.method({
  7818. selector: "add:",
  7819. protocol: "adding/removing",
  7820. fn: function (anAssociation){
  7821. var self=this,$self=this;
  7822. return $core.withContext(function($ctx1) {
  7823. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  7824. return self;
  7825. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  7826. },
  7827. args: ["anAssociation"],
  7828. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  7829. referencedClasses: [],
  7830. messageSends: ["at:put:", "key", "value"]
  7831. }),
  7832. $globals.AssociativeCollection);
  7833. $core.addMethod(
  7834. $core.method({
  7835. selector: "addAll:",
  7836. protocol: "adding/removing",
  7837. fn: function (anAssociativeCollection){
  7838. var self=this,$self=this;
  7839. return $core.withContext(function($ctx1) {
  7840. (
  7841. $ctx1.supercall = true,
  7842. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  7843. $ctx1.supercall = false;
  7844. return anAssociativeCollection;
  7845. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  7846. },
  7847. args: ["anAssociativeCollection"],
  7848. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  7849. referencedClasses: [],
  7850. messageSends: ["addAll:", "associations"]
  7851. }),
  7852. $globals.AssociativeCollection);
  7853. $core.addMethod(
  7854. $core.method({
  7855. selector: "asDictionary",
  7856. protocol: "converting",
  7857. fn: function (){
  7858. var self=this,$self=this;
  7859. return $core.withContext(function($ctx1) {
  7860. return $recv($globals.Dictionary)._from_($self._associations());
  7861. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  7862. },
  7863. args: [],
  7864. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  7865. referencedClasses: ["Dictionary"],
  7866. messageSends: ["from:", "associations"]
  7867. }),
  7868. $globals.AssociativeCollection);
  7869. $core.addMethod(
  7870. $core.method({
  7871. selector: "asHashedCollection",
  7872. protocol: "converting",
  7873. fn: function (){
  7874. var self=this,$self=this;
  7875. return $core.withContext(function($ctx1) {
  7876. return $recv($globals.HashedCollection)._from_($self._associations());
  7877. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  7878. },
  7879. args: [],
  7880. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  7881. referencedClasses: ["HashedCollection"],
  7882. messageSends: ["from:", "associations"]
  7883. }),
  7884. $globals.AssociativeCollection);
  7885. $core.addMethod(
  7886. $core.method({
  7887. selector: "asJavaScriptObject",
  7888. protocol: "converting",
  7889. fn: function (){
  7890. var self=this,$self=this;
  7891. var hash;
  7892. return $core.withContext(function($ctx1) {
  7893. hash=$recv($globals.HashedCollection)._new();
  7894. $self._keysAndValuesDo_((function(key,value){
  7895. return $core.withContext(function($ctx2) {
  7896. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  7897. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7898. }));
  7899. return hash;
  7900. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  7901. },
  7902. args: [],
  7903. source: "asJavaScriptObject\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJavaScriptObject ].\x0a\x09^ hash",
  7904. referencedClasses: ["HashedCollection"],
  7905. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  7906. }),
  7907. $globals.AssociativeCollection);
  7908. $core.addMethod(
  7909. $core.method({
  7910. selector: "associations",
  7911. protocol: "accessing",
  7912. fn: function (){
  7913. var self=this,$self=this;
  7914. var associations;
  7915. return $core.withContext(function($ctx1) {
  7916. associations=[];
  7917. $self._associationsDo_((function(each){
  7918. return $core.withContext(function($ctx2) {
  7919. return $recv(associations)._add_(each);
  7920. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7921. }));
  7922. return associations;
  7923. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  7924. },
  7925. args: [],
  7926. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  7927. referencedClasses: [],
  7928. messageSends: ["associationsDo:", "add:"]
  7929. }),
  7930. $globals.AssociativeCollection);
  7931. $core.addMethod(
  7932. $core.method({
  7933. selector: "associationsDo:",
  7934. protocol: "enumerating",
  7935. fn: function (aBlock){
  7936. var self=this,$self=this;
  7937. return $core.withContext(function($ctx1) {
  7938. $self._keysAndValuesDo_((function(key,value){
  7939. return $core.withContext(function($ctx2) {
  7940. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  7941. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7942. }));
  7943. return self;
  7944. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  7945. },
  7946. args: ["aBlock"],
  7947. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  7948. referencedClasses: ["Association"],
  7949. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  7950. }),
  7951. $globals.AssociativeCollection);
  7952. $core.addMethod(
  7953. $core.method({
  7954. selector: "at:ifPresent:ifAbsent:",
  7955. protocol: "accessing",
  7956. fn: function (aKey,aBlock,anotherBlock){
  7957. var self=this,$self=this;
  7958. return $core.withContext(function($ctx1) {
  7959. var $1;
  7960. $1=$self._includesKey_(aKey);
  7961. if($core.assert($1)){
  7962. return $recv(aBlock)._value_($self._at_(aKey));
  7963. } else {
  7964. return $recv(anotherBlock)._value();
  7965. }
  7966. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  7967. },
  7968. args: ["aKey", "aBlock", "anotherBlock"],
  7969. 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 \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  7970. referencedClasses: [],
  7971. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  7972. }),
  7973. $globals.AssociativeCollection);
  7974. $core.addMethod(
  7975. $core.method({
  7976. selector: "collect:",
  7977. protocol: "enumerating",
  7978. fn: function (aBlock){
  7979. var self=this,$self=this;
  7980. var newDict;
  7981. return $core.withContext(function($ctx1) {
  7982. newDict=$recv($self._class())._new();
  7983. $self._keysAndValuesDo_((function(key,value){
  7984. return $core.withContext(function($ctx2) {
  7985. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  7986. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7987. }));
  7988. return newDict;
  7989. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  7990. },
  7991. args: ["aBlock"],
  7992. 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",
  7993. referencedClasses: [],
  7994. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  7995. }),
  7996. $globals.AssociativeCollection);
  7997. $core.addMethod(
  7998. $core.method({
  7999. selector: "deepCopy",
  8000. protocol: "copying",
  8001. fn: function (){
  8002. var self=this,$self=this;
  8003. var copy;
  8004. return $core.withContext(function($ctx1) {
  8005. copy=$recv($self._class())._new();
  8006. $self._keysAndValuesDo_((function(key,value){
  8007. return $core.withContext(function($ctx2) {
  8008. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8009. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8010. }));
  8011. return copy;
  8012. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8013. },
  8014. args: [],
  8015. 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",
  8016. referencedClasses: [],
  8017. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8018. }),
  8019. $globals.AssociativeCollection);
  8020. $core.addMethod(
  8021. $core.method({
  8022. selector: "detect:ifNone:",
  8023. protocol: "enumerating",
  8024. fn: function (aBlock,anotherBlock){
  8025. var self=this,$self=this;
  8026. return $core.withContext(function($ctx1) {
  8027. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8028. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8029. },
  8030. args: ["aBlock", "anotherBlock"],
  8031. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8032. referencedClasses: [],
  8033. messageSends: ["detect:ifNone:", "values"]
  8034. }),
  8035. $globals.AssociativeCollection);
  8036. $core.addMethod(
  8037. $core.method({
  8038. selector: "do:",
  8039. protocol: "enumerating",
  8040. fn: function (aBlock){
  8041. var self=this,$self=this;
  8042. return $core.withContext(function($ctx1) {
  8043. $self._valuesDo_(aBlock);
  8044. return self;
  8045. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8046. },
  8047. args: ["aBlock"],
  8048. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8049. referencedClasses: [],
  8050. messageSends: ["valuesDo:"]
  8051. }),
  8052. $globals.AssociativeCollection);
  8053. $core.addMethod(
  8054. $core.method({
  8055. selector: "includes:",
  8056. protocol: "enumerating",
  8057. fn: function (anObject){
  8058. var self=this,$self=this;
  8059. return $core.withContext(function($ctx1) {
  8060. return $recv($self._values())._includes_(anObject);
  8061. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  8062. },
  8063. args: ["anObject"],
  8064. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8065. referencedClasses: [],
  8066. messageSends: ["includes:", "values"]
  8067. }),
  8068. $globals.AssociativeCollection);
  8069. $core.addMethod(
  8070. $core.method({
  8071. selector: "includesKey:",
  8072. protocol: "testing",
  8073. fn: function (aKey){
  8074. var self=this,$self=this;
  8075. return $core.withContext(function($ctx1) {
  8076. $self._subclassResponsibility();
  8077. return self;
  8078. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8079. },
  8080. args: ["aKey"],
  8081. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  8082. referencedClasses: [],
  8083. messageSends: ["subclassResponsibility"]
  8084. }),
  8085. $globals.AssociativeCollection);
  8086. $core.addMethod(
  8087. $core.method({
  8088. selector: "indexOf:ifAbsent:",
  8089. protocol: "accessing",
  8090. fn: function (anObject,aBlock){
  8091. var self=this,$self=this;
  8092. return $core.withContext(function($ctx1) {
  8093. return $recv($self._keys())._detect_ifNone_((function(each){
  8094. return $core.withContext(function($ctx2) {
  8095. return $recv($self._at_(each)).__eq(anObject);
  8096. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8097. }),aBlock);
  8098. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8099. },
  8100. args: ["anObject", "aBlock"],
  8101. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  8102. referencedClasses: [],
  8103. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  8104. }),
  8105. $globals.AssociativeCollection);
  8106. $core.addMethod(
  8107. $core.method({
  8108. selector: "keyAtValue:",
  8109. protocol: "accessing",
  8110. fn: function (anObject){
  8111. var self=this,$self=this;
  8112. return $core.withContext(function($ctx1) {
  8113. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  8114. return $core.withContext(function($ctx2) {
  8115. return $self._errorNotFound();
  8116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8117. }));
  8118. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  8119. },
  8120. args: ["anObject"],
  8121. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  8122. referencedClasses: [],
  8123. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  8124. }),
  8125. $globals.AssociativeCollection);
  8126. $core.addMethod(
  8127. $core.method({
  8128. selector: "keyAtValue:ifAbsent:",
  8129. protocol: "accessing",
  8130. fn: function (anObject,aBlock){
  8131. var self=this,$self=this;
  8132. return $core.withContext(function($ctx1) {
  8133. return $self._indexOf_ifAbsent_(anObject,aBlock);
  8134. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8135. },
  8136. args: ["anObject", "aBlock"],
  8137. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  8138. referencedClasses: [],
  8139. messageSends: ["indexOf:ifAbsent:"]
  8140. }),
  8141. $globals.AssociativeCollection);
  8142. $core.addMethod(
  8143. $core.method({
  8144. selector: "keys",
  8145. protocol: "accessing",
  8146. fn: function (){
  8147. var self=this,$self=this;
  8148. return $core.withContext(function($ctx1) {
  8149. $self._subclassResponsibility();
  8150. return self;
  8151. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  8152. },
  8153. args: [],
  8154. source: "keys\x0a\x09self subclassResponsibility",
  8155. referencedClasses: [],
  8156. messageSends: ["subclassResponsibility"]
  8157. }),
  8158. $globals.AssociativeCollection);
  8159. $core.addMethod(
  8160. $core.method({
  8161. selector: "keysAndValuesDo:",
  8162. protocol: "enumerating",
  8163. fn: function (aBlock){
  8164. var self=this,$self=this;
  8165. return $core.withContext(function($ctx1) {
  8166. $self._keysDo_((function(each){
  8167. return $core.withContext(function($ctx2) {
  8168. return $recv(aBlock)._value_value_(each,$self._at_(each));
  8169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8170. }));
  8171. return self;
  8172. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8173. },
  8174. args: ["aBlock"],
  8175. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  8176. referencedClasses: [],
  8177. messageSends: ["keysDo:", "value:value:", "at:"]
  8178. }),
  8179. $globals.AssociativeCollection);
  8180. $core.addMethod(
  8181. $core.method({
  8182. selector: "keysDo:",
  8183. protocol: "enumerating",
  8184. fn: function (aBlock){
  8185. var self=this,$self=this;
  8186. return $core.withContext(function($ctx1) {
  8187. $self._subclassResponsibility();
  8188. return self;
  8189. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8190. },
  8191. args: ["aBlock"],
  8192. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  8193. referencedClasses: [],
  8194. messageSends: ["subclassResponsibility"]
  8195. }),
  8196. $globals.AssociativeCollection);
  8197. $core.addMethod(
  8198. $core.method({
  8199. selector: "printOn:",
  8200. protocol: "printing",
  8201. fn: function (aStream){
  8202. var self=this,$self=this;
  8203. return $core.withContext(function($ctx1) {
  8204. (
  8205. $ctx1.supercall = true,
  8206. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  8207. $ctx1.supercall = false;
  8208. $ctx1.sendIdx["printOn:"]=1;
  8209. $recv(aStream)._nextPutAll_(" (");
  8210. $ctx1.sendIdx["nextPutAll:"]=1;
  8211. $recv($self._associations())._do_separatedBy_((function(each){
  8212. return $core.withContext(function($ctx2) {
  8213. return $recv(each)._printOn_(aStream);
  8214. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8215. }),(function(){
  8216. return $core.withContext(function($ctx2) {
  8217. return $recv(aStream)._nextPutAll_(" , ");
  8218. $ctx2.sendIdx["nextPutAll:"]=2;
  8219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8220. }));
  8221. $recv(aStream)._nextPutAll_(")");
  8222. return self;
  8223. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  8224. },
  8225. args: ["aStream"],
  8226. 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: ')'",
  8227. referencedClasses: [],
  8228. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  8229. }),
  8230. $globals.AssociativeCollection);
  8231. $core.addMethod(
  8232. $core.method({
  8233. selector: "remove:ifAbsent:",
  8234. protocol: "adding/removing",
  8235. fn: function (aKey,aBlock){
  8236. var self=this,$self=this;
  8237. return $core.withContext(function($ctx1) {
  8238. return $self._removeKey_ifAbsent_(aKey,aBlock);
  8239. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  8240. },
  8241. args: ["aKey", "aBlock"],
  8242. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  8243. referencedClasses: [],
  8244. messageSends: ["removeKey:ifAbsent:"]
  8245. }),
  8246. $globals.AssociativeCollection);
  8247. $core.addMethod(
  8248. $core.method({
  8249. selector: "removeAll",
  8250. protocol: "adding/removing",
  8251. fn: function (){
  8252. var self=this,$self=this;
  8253. return $core.withContext(function($ctx1) {
  8254. return $recv($self._keys())._do_((function(each){
  8255. return $core.withContext(function($ctx2) {
  8256. return $self._removeKey_(each);
  8257. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8258. }));
  8259. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  8260. },
  8261. args: [],
  8262. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  8263. referencedClasses: [],
  8264. messageSends: ["do:", "keys", "removeKey:"]
  8265. }),
  8266. $globals.AssociativeCollection);
  8267. $core.addMethod(
  8268. $core.method({
  8269. selector: "removeKey:",
  8270. protocol: "adding/removing",
  8271. fn: function (aKey){
  8272. var self=this,$self=this;
  8273. return $core.withContext(function($ctx1) {
  8274. return $self._remove_(aKey);
  8275. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8276. },
  8277. args: ["aKey"],
  8278. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  8279. referencedClasses: [],
  8280. messageSends: ["remove:"]
  8281. }),
  8282. $globals.AssociativeCollection);
  8283. $core.addMethod(
  8284. $core.method({
  8285. selector: "removeKey:ifAbsent:",
  8286. protocol: "adding/removing",
  8287. fn: function (aKey,aBlock){
  8288. var self=this,$self=this;
  8289. return $core.withContext(function($ctx1) {
  8290. $self._subclassResponsibility();
  8291. return self;
  8292. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  8293. },
  8294. args: ["aKey", "aBlock"],
  8295. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8296. referencedClasses: [],
  8297. messageSends: ["subclassResponsibility"]
  8298. }),
  8299. $globals.AssociativeCollection);
  8300. $core.addMethod(
  8301. $core.method({
  8302. selector: "select:",
  8303. protocol: "enumerating",
  8304. fn: function (aBlock){
  8305. var self=this,$self=this;
  8306. var newDict;
  8307. return $core.withContext(function($ctx1) {
  8308. var $1;
  8309. newDict=$recv($self._class())._new();
  8310. $self._keysAndValuesDo_((function(key,value){
  8311. return $core.withContext(function($ctx2) {
  8312. $1=$recv(aBlock)._value_(value);
  8313. if($core.assert($1)){
  8314. return $recv(newDict)._at_put_(key,value);
  8315. }
  8316. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8317. }));
  8318. return newDict;
  8319. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8320. },
  8321. args: ["aBlock"],
  8322. 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",
  8323. referencedClasses: [],
  8324. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  8325. }),
  8326. $globals.AssociativeCollection);
  8327. $core.addMethod(
  8328. $core.method({
  8329. selector: "select:thenCollect:",
  8330. protocol: "enumerating",
  8331. fn: function (selectBlock,collectBlock){
  8332. var self=this,$self=this;
  8333. var newDict;
  8334. return $core.withContext(function($ctx1) {
  8335. var $1;
  8336. newDict=$recv($self._class())._new();
  8337. $self._keysAndValuesDo_((function(key,value){
  8338. return $core.withContext(function($ctx2) {
  8339. $1=$recv(selectBlock)._value_(value);
  8340. $ctx2.sendIdx["value:"]=1;
  8341. if($core.assert($1)){
  8342. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  8343. }
  8344. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8345. }));
  8346. return newDict;
  8347. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  8348. },
  8349. args: ["selectBlock", "collectBlock"],
  8350. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(selectBlock value: value) ifTrue: [ newDict at: key put: (collectBlock value: value) ]].\x0a\x09^ newDict",
  8351. referencedClasses: [],
  8352. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  8353. }),
  8354. $globals.AssociativeCollection);
  8355. $core.addMethod(
  8356. $core.method({
  8357. selector: "shallowCopy",
  8358. protocol: "copying",
  8359. fn: function (){
  8360. var self=this,$self=this;
  8361. var copy;
  8362. return $core.withContext(function($ctx1) {
  8363. copy=$recv($self._class())._new();
  8364. $self._keysAndValuesDo_((function(key,value){
  8365. return $core.withContext(function($ctx2) {
  8366. return $recv(copy)._at_put_(key,value);
  8367. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8368. }));
  8369. return copy;
  8370. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  8371. },
  8372. args: [],
  8373. 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",
  8374. referencedClasses: [],
  8375. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  8376. }),
  8377. $globals.AssociativeCollection);
  8378. $core.addMethod(
  8379. $core.method({
  8380. selector: "size",
  8381. protocol: "accessing",
  8382. fn: function (){
  8383. var self=this,$self=this;
  8384. return $core.withContext(function($ctx1) {
  8385. return $recv($self._keys())._size();
  8386. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  8387. },
  8388. args: [],
  8389. source: "size\x0a\x09^ self keys size",
  8390. referencedClasses: [],
  8391. messageSends: ["size", "keys"]
  8392. }),
  8393. $globals.AssociativeCollection);
  8394. $core.addMethod(
  8395. $core.method({
  8396. selector: "values",
  8397. protocol: "accessing",
  8398. fn: function (){
  8399. var self=this,$self=this;
  8400. return $core.withContext(function($ctx1) {
  8401. $self._subclassResponsibility();
  8402. return self;
  8403. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  8404. },
  8405. args: [],
  8406. source: "values\x0a\x09self subclassResponsibility",
  8407. referencedClasses: [],
  8408. messageSends: ["subclassResponsibility"]
  8409. }),
  8410. $globals.AssociativeCollection);
  8411. $core.addMethod(
  8412. $core.method({
  8413. selector: "valuesDo:",
  8414. protocol: "enumerating",
  8415. fn: function (aBlock){
  8416. var self=this,$self=this;
  8417. return $core.withContext(function($ctx1) {
  8418. $self._subclassResponsibility();
  8419. return self;
  8420. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8421. },
  8422. args: ["aBlock"],
  8423. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  8424. referencedClasses: [],
  8425. messageSends: ["subclassResponsibility"]
  8426. }),
  8427. $globals.AssociativeCollection);
  8428. $core.addMethod(
  8429. $core.method({
  8430. selector: "withIndexDo:",
  8431. protocol: "enumerating",
  8432. fn: function (aBlock){
  8433. var self=this,$self=this;
  8434. return $core.withContext(function($ctx1) {
  8435. $self._keysAndValuesDo_((function(key,value){
  8436. return $core.withContext(function($ctx2) {
  8437. return $recv(aBlock)._value_value_(value,key);
  8438. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8439. }));
  8440. return self;
  8441. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8442. },
  8443. args: ["aBlock"],
  8444. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  8445. referencedClasses: [],
  8446. messageSends: ["keysAndValuesDo:", "value:value:"]
  8447. }),
  8448. $globals.AssociativeCollection);
  8449. $core.addMethod(
  8450. $core.method({
  8451. selector: "from:",
  8452. protocol: "instance creation",
  8453. fn: function (aCollection){
  8454. var self=this,$self=this;
  8455. var newCollection;
  8456. return $core.withContext(function($ctx1) {
  8457. newCollection=$self._new();
  8458. $recv(aCollection)._do_((function(each){
  8459. return $core.withContext(function($ctx2) {
  8460. return $recv(newCollection)._add_(each);
  8461. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8462. }));
  8463. return newCollection;
  8464. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  8465. },
  8466. args: ["aCollection"],
  8467. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  8468. referencedClasses: [],
  8469. messageSends: ["new", "do:", "add:"]
  8470. }),
  8471. $globals.AssociativeCollection.a$cls);
  8472. $core.addMethod(
  8473. $core.method({
  8474. selector: "fromPairs:",
  8475. protocol: "instance creation",
  8476. fn: function (aCollection){
  8477. var self=this,$self=this;
  8478. return $core.withContext(function($ctx1) {
  8479. return $self._from_(aCollection);
  8480. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  8481. },
  8482. args: ["aCollection"],
  8483. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  8484. referencedClasses: [],
  8485. messageSends: ["from:"]
  8486. }),
  8487. $globals.AssociativeCollection.a$cls);
  8488. $core.addMethod(
  8489. $core.method({
  8490. selector: "newFromPairs:",
  8491. protocol: "instance creation",
  8492. fn: function (aCollection){
  8493. var self=this,$self=this;
  8494. var newCollection;
  8495. return $core.withContext(function($ctx1) {
  8496. var $2,$1,$3,$4;
  8497. $2=$recv(aCollection)._size();
  8498. $ctx1.sendIdx["size"]=1;
  8499. $1=$recv($2)._even();
  8500. if(!$core.assert($1)){
  8501. $self._error_("#newFromPairs only accepts arrays of an even length");
  8502. }
  8503. newCollection=$self._new();
  8504. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  8505. return $core.withContext(function($ctx2) {
  8506. $3=newCollection;
  8507. $4=$recv(aCollection)._at_(each);
  8508. $ctx2.sendIdx["at:"]=1;
  8509. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  8510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  8511. }));
  8512. return newCollection;
  8513. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  8514. },
  8515. args: ["aCollection"],
  8516. 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",
  8517. referencedClasses: [],
  8518. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  8519. }),
  8520. $globals.AssociativeCollection.a$cls);
  8521. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  8522. $globals.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.";
  8523. $core.addMethod(
  8524. $core.method({
  8525. selector: "at:ifAbsent:",
  8526. protocol: "accessing",
  8527. fn: function (aKey,aBlock){
  8528. var self=this,$self=this;
  8529. return $core.withContext(function($ctx1) {
  8530. var index = $self._positionOfKey_(aKey);
  8531. return index >=0 ? $self['@values'][index] : aBlock._value();
  8532. ;
  8533. return self;
  8534. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  8535. },
  8536. args: ["aKey", "aBlock"],
  8537. source: "at: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self[''@values''][index] : aBlock._value();\x0a\x09'>",
  8538. referencedClasses: [],
  8539. messageSends: []
  8540. }),
  8541. $globals.Dictionary);
  8542. $core.addMethod(
  8543. $core.method({
  8544. selector: "at:put:",
  8545. protocol: "accessing",
  8546. fn: function (aKey,aValue){
  8547. var self=this,$self=this;
  8548. return $core.withContext(function($ctx1) {
  8549. var index = $self._positionOfKey_(aKey);
  8550. if(index === -1) {
  8551. var keys = $self['@keys'];
  8552. index = keys.length;
  8553. keys.push(aKey);
  8554. }
  8555. return $self['@values'][index] = aValue;
  8556. ;
  8557. return self;
  8558. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  8559. },
  8560. args: ["aKey", "aValue"],
  8561. source: "at: aKey put: aValue\x0a\x09<inlineJS: '\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'>",
  8562. referencedClasses: [],
  8563. messageSends: []
  8564. }),
  8565. $globals.Dictionary);
  8566. $core.addMethod(
  8567. $core.method({
  8568. selector: "includesKey:",
  8569. protocol: "testing",
  8570. fn: function (aKey){
  8571. var self=this,$self=this;
  8572. return $core.withContext(function($ctx1) {
  8573. return $self._positionOfKey_(aKey) >= 0;;
  8574. return self;
  8575. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  8576. },
  8577. args: ["aKey"],
  8578. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  8579. referencedClasses: [],
  8580. messageSends: []
  8581. }),
  8582. $globals.Dictionary);
  8583. $core.addMethod(
  8584. $core.method({
  8585. selector: "indexOf:ifAbsent:",
  8586. protocol: "accessing",
  8587. fn: function (anObject,aBlock){
  8588. var self=this,$self=this;
  8589. var index;
  8590. return $core.withContext(function($ctx1) {
  8591. var $1;
  8592. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  8593. return (0);
  8594. }));
  8595. $1=$recv(index).__eq((0));
  8596. if($core.assert($1)){
  8597. return $recv(aBlock)._value();
  8598. } else {
  8599. return $recv($self["@keys"])._at_(index);
  8600. }
  8601. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  8602. },
  8603. args: ["anObject", "aBlock"],
  8604. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  8605. referencedClasses: [],
  8606. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  8607. }),
  8608. $globals.Dictionary);
  8609. $core.addMethod(
  8610. $core.method({
  8611. selector: "initialize",
  8612. protocol: "initialization",
  8613. fn: function (){
  8614. var self=this,$self=this;
  8615. return $core.withContext(function($ctx1) {
  8616. (
  8617. $ctx1.supercall = true,
  8618. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  8619. $ctx1.supercall = false;
  8620. $self["@keys"]=[];
  8621. $self["@values"]=[];
  8622. return self;
  8623. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  8624. },
  8625. args: [],
  8626. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  8627. referencedClasses: [],
  8628. messageSends: ["initialize"]
  8629. }),
  8630. $globals.Dictionary);
  8631. $core.addMethod(
  8632. $core.method({
  8633. selector: "keys",
  8634. protocol: "accessing",
  8635. fn: function (){
  8636. var self=this,$self=this;
  8637. return $core.withContext(function($ctx1) {
  8638. return $recv($self["@keys"])._copy();
  8639. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  8640. },
  8641. args: [],
  8642. source: "keys\x0a\x09^ keys copy",
  8643. referencedClasses: [],
  8644. messageSends: ["copy"]
  8645. }),
  8646. $globals.Dictionary);
  8647. $core.addMethod(
  8648. $core.method({
  8649. selector: "keysAndValuesDo:",
  8650. protocol: "enumerating",
  8651. fn: function (aBlock){
  8652. var self=this,$self=this;
  8653. return $core.withContext(function($ctx1) {
  8654. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  8655. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  8656. },
  8657. args: ["aBlock"],
  8658. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  8659. referencedClasses: [],
  8660. messageSends: ["with:do:"]
  8661. }),
  8662. $globals.Dictionary);
  8663. $core.addMethod(
  8664. $core.method({
  8665. selector: "keysDo:",
  8666. protocol: "enumerating",
  8667. fn: function (aBlock){
  8668. var self=this,$self=this;
  8669. return $core.withContext(function($ctx1) {
  8670. return $recv($self["@keys"])._do_(aBlock);
  8671. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  8672. },
  8673. args: ["aBlock"],
  8674. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  8675. referencedClasses: [],
  8676. messageSends: ["do:"]
  8677. }),
  8678. $globals.Dictionary);
  8679. $core.addMethod(
  8680. $core.method({
  8681. selector: "positionOfKey:",
  8682. protocol: "private",
  8683. fn: function (anObject){
  8684. var self=this,$self=this;
  8685. return $core.withContext(function($ctx1) {
  8686. var keys = $self['@keys'];
  8687. for(var i=0;i<keys.length;i++){
  8688. if(keys[i].__eq(anObject)) { return i;}
  8689. }
  8690. return -1;
  8691. ;
  8692. return self;
  8693. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  8694. },
  8695. args: ["anObject"],
  8696. source: "positionOfKey: anObject\x0a\x09<inlineJS: '\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'>",
  8697. referencedClasses: [],
  8698. messageSends: []
  8699. }),
  8700. $globals.Dictionary);
  8701. $core.addMethod(
  8702. $core.method({
  8703. selector: "removeAll",
  8704. protocol: "adding/removing",
  8705. fn: function (){
  8706. var self=this,$self=this;
  8707. return $core.withContext(function($ctx1) {
  8708. $recv($self["@keys"])._removeAll();
  8709. $ctx1.sendIdx["removeAll"]=1;
  8710. $recv($self["@values"])._removeAll();
  8711. return self;
  8712. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  8713. },
  8714. args: [],
  8715. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  8716. referencedClasses: [],
  8717. messageSends: ["removeAll"]
  8718. }),
  8719. $globals.Dictionary);
  8720. $core.addMethod(
  8721. $core.method({
  8722. selector: "removeKey:ifAbsent:",
  8723. protocol: "adding/removing",
  8724. fn: function (aKey,aBlock){
  8725. var self=this,$self=this;
  8726. return $core.withContext(function($ctx1) {
  8727. var index = $self._positionOfKey_(aKey);
  8728. if(index === -1) {
  8729. return aBlock._value()
  8730. } else {
  8731. var keys = $self['@keys'], values = $self['@values'];
  8732. var value = values[index], l = keys.length;
  8733. keys[index] = keys[l-1];
  8734. keys.pop();
  8735. values[index] = values[l-1];
  8736. values.pop();
  8737. return value;
  8738. }
  8739. ;
  8740. return self;
  8741. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  8742. },
  8743. args: ["aKey", "aBlock"],
  8744. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\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'>",
  8745. referencedClasses: [],
  8746. messageSends: []
  8747. }),
  8748. $globals.Dictionary);
  8749. $core.addMethod(
  8750. $core.method({
  8751. selector: "values",
  8752. protocol: "accessing",
  8753. fn: function (){
  8754. var self=this,$self=this;
  8755. return $self["@values"];
  8756. },
  8757. args: [],
  8758. source: "values\x0a\x09^ values",
  8759. referencedClasses: [],
  8760. messageSends: []
  8761. }),
  8762. $globals.Dictionary);
  8763. $core.addMethod(
  8764. $core.method({
  8765. selector: "valuesDo:",
  8766. protocol: "enumerating",
  8767. fn: function (aBlock){
  8768. var self=this,$self=this;
  8769. return $core.withContext(function($ctx1) {
  8770. return $recv($self["@values"])._do_(aBlock);
  8771. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  8772. },
  8773. args: ["aBlock"],
  8774. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  8775. referencedClasses: [],
  8776. messageSends: ["do:"]
  8777. }),
  8778. $globals.Dictionary);
  8779. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  8780. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  8781. $core.addMethod(
  8782. $core.method({
  8783. selector: "at:ifAbsent:",
  8784. protocol: "accessing",
  8785. fn: function (aKey,aBlock){
  8786. var self=this,$self=this;
  8787. return $core.withContext(function($ctx1) {
  8788. var $1;
  8789. $1=$self._includesKey_(aKey);
  8790. if($core.assert($1)){
  8791. return $self._basicAt_(aKey);
  8792. } else {
  8793. return $recv(aBlock)._value();
  8794. }
  8795. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  8796. },
  8797. args: ["aKey", "aBlock"],
  8798. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  8799. referencedClasses: [],
  8800. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  8801. }),
  8802. $globals.HashedCollection);
  8803. $core.addMethod(
  8804. $core.method({
  8805. selector: "at:put:",
  8806. protocol: "accessing",
  8807. fn: function (aKey,aValue){
  8808. var self=this,$self=this;
  8809. return $core.withContext(function($ctx1) {
  8810. return $self._basicAt_put_(aKey,aValue);
  8811. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  8812. },
  8813. args: ["aKey", "aValue"],
  8814. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  8815. referencedClasses: [],
  8816. messageSends: ["basicAt:put:"]
  8817. }),
  8818. $globals.HashedCollection);
  8819. $core.addMethod(
  8820. $core.method({
  8821. selector: "includesKey:",
  8822. protocol: "testing",
  8823. fn: function (aKey){
  8824. var self=this,$self=this;
  8825. return $core.withContext(function($ctx1) {
  8826. return self.hasOwnProperty(aKey);
  8827. return self;
  8828. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  8829. },
  8830. args: ["aKey"],
  8831. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  8832. referencedClasses: [],
  8833. messageSends: []
  8834. }),
  8835. $globals.HashedCollection);
  8836. $core.addMethod(
  8837. $core.method({
  8838. selector: "keys",
  8839. protocol: "accessing",
  8840. fn: function (){
  8841. var self=this,$self=this;
  8842. return $core.withContext(function($ctx1) {
  8843. return Object.keys(self);
  8844. return self;
  8845. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  8846. },
  8847. args: [],
  8848. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  8849. referencedClasses: [],
  8850. messageSends: []
  8851. }),
  8852. $globals.HashedCollection);
  8853. $core.addMethod(
  8854. $core.method({
  8855. selector: "keysDo:",
  8856. protocol: "enumerating",
  8857. fn: function (aBlock){
  8858. var self=this,$self=this;
  8859. return $core.withContext(function($ctx1) {
  8860. $recv($self._keys())._do_(aBlock);
  8861. return self;
  8862. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  8863. },
  8864. args: ["aBlock"],
  8865. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  8866. referencedClasses: [],
  8867. messageSends: ["do:", "keys"]
  8868. }),
  8869. $globals.HashedCollection);
  8870. $core.addMethod(
  8871. $core.method({
  8872. selector: "removeKey:ifAbsent:",
  8873. protocol: "adding/removing",
  8874. fn: function (aKey,aBlock){
  8875. var self=this,$self=this;
  8876. return $core.withContext(function($ctx1) {
  8877. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  8878. return $core.withContext(function($ctx2) {
  8879. $self._basicDelete_(aKey);
  8880. return removed;
  8881. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  8882. }),(function(){
  8883. return $core.withContext(function($ctx2) {
  8884. return $recv(aBlock)._value();
  8885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8886. }));
  8887. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  8888. },
  8889. args: ["aKey", "aBlock"],
  8890. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
  8891. referencedClasses: [],
  8892. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  8893. }),
  8894. $globals.HashedCollection);
  8895. $core.addMethod(
  8896. $core.method({
  8897. selector: "values",
  8898. protocol: "accessing",
  8899. fn: function (){
  8900. var self=this,$self=this;
  8901. return $core.withContext(function($ctx1) {
  8902. return $self._keys().map(function(key){
  8903. return $self._at_(key);
  8904. });
  8905. ;
  8906. return self;
  8907. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  8908. },
  8909. args: [],
  8910. source: "values\x0a\x09<inlineJS: '\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09'>",
  8911. referencedClasses: [],
  8912. messageSends: []
  8913. }),
  8914. $globals.HashedCollection);
  8915. $core.addMethod(
  8916. $core.method({
  8917. selector: "valuesDo:",
  8918. protocol: "enumerating",
  8919. fn: function (aBlock){
  8920. var self=this,$self=this;
  8921. return $core.withContext(function($ctx1) {
  8922. $recv($self._values())._do_(aBlock);
  8923. return self;
  8924. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  8925. },
  8926. args: ["aBlock"],
  8927. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  8928. referencedClasses: [],
  8929. messageSends: ["do:", "values"]
  8930. }),
  8931. $globals.HashedCollection);
  8932. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  8933. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  8934. $core.addMethod(
  8935. $core.method({
  8936. selector: "=",
  8937. protocol: "comparing",
  8938. fn: function (aCollection){
  8939. var self=this,$self=this;
  8940. return $core.withContext(function($ctx1) {
  8941. var $3,$2,$4,$1,$5;
  8942. var $early={};
  8943. try {
  8944. $3=$self._class();
  8945. $ctx1.sendIdx["class"]=1;
  8946. $2=$recv($3).__eq($recv(aCollection)._class());
  8947. $ctx1.sendIdx["="]=1;
  8948. $1=$recv($2)._and_((function(){
  8949. return $core.withContext(function($ctx2) {
  8950. $4=$self._size();
  8951. $ctx2.sendIdx["size"]=1;
  8952. return $recv($4).__eq($recv(aCollection)._size());
  8953. $ctx2.sendIdx["="]=2;
  8954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8955. }));
  8956. if(!$core.assert($1)){
  8957. return false;
  8958. }
  8959. $self._withIndexDo_((function(each,i){
  8960. return $core.withContext(function($ctx2) {
  8961. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  8962. if(!$core.assert($5)){
  8963. throw $early=[false];
  8964. }
  8965. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  8966. }));
  8967. return true;
  8968. }
  8969. catch(e) {if(e===$early)return e[0]; throw e}
  8970. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  8971. },
  8972. args: ["aCollection"],
  8973. 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",
  8974. referencedClasses: [],
  8975. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  8976. }),
  8977. $globals.SequenceableCollection);
  8978. $core.addMethod(
  8979. $core.method({
  8980. selector: "addLast:",
  8981. protocol: "adding/removing",
  8982. fn: function (anObject){
  8983. var self=this,$self=this;
  8984. return $core.withContext(function($ctx1) {
  8985. $self._add_(anObject);
  8986. return self;
  8987. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  8988. },
  8989. args: ["anObject"],
  8990. source: "addLast: anObject\x0a\x09self add: anObject",
  8991. referencedClasses: [],
  8992. messageSends: ["add:"]
  8993. }),
  8994. $globals.SequenceableCollection);
  8995. $core.addMethod(
  8996. $core.method({
  8997. selector: "allButFirst",
  8998. protocol: "accessing",
  8999. fn: function (){
  9000. var self=this,$self=this;
  9001. return $core.withContext(function($ctx1) {
  9002. return $self._copyFrom_to_((2),$self._size());
  9003. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9004. },
  9005. args: [],
  9006. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9007. referencedClasses: [],
  9008. messageSends: ["copyFrom:to:", "size"]
  9009. }),
  9010. $globals.SequenceableCollection);
  9011. $core.addMethod(
  9012. $core.method({
  9013. selector: "allButLast",
  9014. protocol: "accessing",
  9015. fn: function (){
  9016. var self=this,$self=this;
  9017. return $core.withContext(function($ctx1) {
  9018. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9019. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9020. },
  9021. args: [],
  9022. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9023. referencedClasses: [],
  9024. messageSends: ["copyFrom:to:", "-", "size"]
  9025. }),
  9026. $globals.SequenceableCollection);
  9027. $core.addMethod(
  9028. $core.method({
  9029. selector: "anyOne",
  9030. protocol: "accessing",
  9031. fn: function (){
  9032. var self=this,$self=this;
  9033. return $core.withContext(function($ctx1) {
  9034. return $self._at_((1));
  9035. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9036. },
  9037. args: [],
  9038. source: "anyOne\x0a\x09^ self at: 1",
  9039. referencedClasses: [],
  9040. messageSends: ["at:"]
  9041. }),
  9042. $globals.SequenceableCollection);
  9043. $core.addMethod(
  9044. $core.method({
  9045. selector: "atRandom",
  9046. protocol: "accessing",
  9047. fn: function (){
  9048. var self=this,$self=this;
  9049. return $core.withContext(function($ctx1) {
  9050. return $self._at_($recv($self._size())._atRandom());
  9051. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9052. },
  9053. args: [],
  9054. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9055. referencedClasses: [],
  9056. messageSends: ["at:", "atRandom", "size"]
  9057. }),
  9058. $globals.SequenceableCollection);
  9059. $core.addMethod(
  9060. $core.method({
  9061. selector: "beginsWith:",
  9062. protocol: "testing",
  9063. fn: function (prefix){
  9064. var self=this,$self=this;
  9065. return $core.withContext(function($ctx1) {
  9066. var $2,$3,$1;
  9067. $2=$self._size();
  9068. $ctx1.sendIdx["size"]=1;
  9069. $3=$recv(prefix)._size();
  9070. $ctx1.sendIdx["size"]=2;
  9071. $1=$recv($2).__lt($3);
  9072. if($core.assert($1)){
  9073. return false;
  9074. }
  9075. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9076. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  9077. },
  9078. args: ["prefix"],
  9079. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9080. referencedClasses: [],
  9081. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  9082. }),
  9083. $globals.SequenceableCollection);
  9084. $core.addMethod(
  9085. $core.method({
  9086. selector: "copyFrom:to:",
  9087. protocol: "copying",
  9088. fn: function (anIndex,anotherIndex){
  9089. var self=this,$self=this;
  9090. return $core.withContext(function($ctx1) {
  9091. $self._subclassResponsibility();
  9092. return self;
  9093. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  9094. },
  9095. args: ["anIndex", "anotherIndex"],
  9096. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  9097. referencedClasses: [],
  9098. messageSends: ["subclassResponsibility"]
  9099. }),
  9100. $globals.SequenceableCollection);
  9101. $core.addMethod(
  9102. $core.method({
  9103. selector: "detect:ifNone:",
  9104. protocol: "enumerating",
  9105. fn: function (aBlock,anotherBlock){
  9106. var self=this,$self=this;
  9107. return $core.withContext(function($ctx1) {
  9108. var nself = $self._numericallyIndexable();
  9109. for(var i = 0; i < nself.length; i++)
  9110. if(aBlock._value_(nself[i]))
  9111. return nself[i];
  9112. return anotherBlock._value();
  9113. ;
  9114. return self;
  9115. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  9116. },
  9117. args: ["aBlock", "anotherBlock"],
  9118. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < nself.length; i++)\x0a\x09\x09\x09if(aBlock._value_(nself[i]))\x0a\x09\x09\x09\x09return nself[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  9119. referencedClasses: [],
  9120. messageSends: []
  9121. }),
  9122. $globals.SequenceableCollection);
  9123. $core.addMethod(
  9124. $core.method({
  9125. selector: "do:",
  9126. protocol: "enumerating",
  9127. fn: function (aBlock){
  9128. var self=this,$self=this;
  9129. return $core.withContext(function($ctx1) {
  9130. var nself = $self._numericallyIndexable();
  9131. for(var i=0; i < nself.length; i++) {
  9132. aBlock._value_(nself[i]);
  9133. }
  9134. ;
  9135. return self;
  9136. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  9137. },
  9138. args: ["aBlock"],
  9139. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09aBlock._value_(nself[i]);\x0a\x09\x09}\x0a\x09'>",
  9140. referencedClasses: [],
  9141. messageSends: []
  9142. }),
  9143. $globals.SequenceableCollection);
  9144. $core.addMethod(
  9145. $core.method({
  9146. selector: "endsWith:",
  9147. protocol: "testing",
  9148. fn: function (suffix){
  9149. var self=this,$self=this;
  9150. return $core.withContext(function($ctx1) {
  9151. var $2,$3,$1;
  9152. $2=$self._size();
  9153. $ctx1.sendIdx["size"]=1;
  9154. $3=$recv(suffix)._size();
  9155. $ctx1.sendIdx["size"]=2;
  9156. $1=$recv($2).__lt($3);
  9157. if($core.assert($1)){
  9158. return false;
  9159. }
  9160. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  9161. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  9162. },
  9163. args: ["suffix"],
  9164. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  9165. referencedClasses: [],
  9166. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  9167. }),
  9168. $globals.SequenceableCollection);
  9169. $core.addMethod(
  9170. $core.method({
  9171. selector: "first",
  9172. protocol: "accessing",
  9173. fn: function (){
  9174. var self=this,$self=this;
  9175. return $core.withContext(function($ctx1) {
  9176. return $self._at_((1));
  9177. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  9178. },
  9179. args: [],
  9180. source: "first\x0a\x09^ self at: 1",
  9181. referencedClasses: [],
  9182. messageSends: ["at:"]
  9183. }),
  9184. $globals.SequenceableCollection);
  9185. $core.addMethod(
  9186. $core.method({
  9187. selector: "first:",
  9188. protocol: "accessing",
  9189. fn: function (aNumber){
  9190. var self=this,$self=this;
  9191. return $core.withContext(function($ctx1) {
  9192. var $1;
  9193. $1=$recv($self._size()).__lt(aNumber);
  9194. if($core.assert($1)){
  9195. $self._error_("Invalid number of elements");
  9196. }
  9197. return $self._copyFrom_to_((1),aNumber);
  9198. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  9199. },
  9200. args: ["aNumber"],
  9201. source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber",
  9202. referencedClasses: [],
  9203. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  9204. }),
  9205. $globals.SequenceableCollection);
  9206. $core.addMethod(
  9207. $core.method({
  9208. selector: "fourth",
  9209. protocol: "accessing",
  9210. fn: function (){
  9211. var self=this,$self=this;
  9212. return $core.withContext(function($ctx1) {
  9213. return $self._at_((4));
  9214. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  9215. },
  9216. args: [],
  9217. source: "fourth\x0a\x09^ self at: 4",
  9218. referencedClasses: [],
  9219. messageSends: ["at:"]
  9220. }),
  9221. $globals.SequenceableCollection);
  9222. $core.addMethod(
  9223. $core.method({
  9224. selector: "includes:",
  9225. protocol: "testing",
  9226. fn: function (anObject){
  9227. var self=this,$self=this;
  9228. return $core.withContext(function($ctx1) {
  9229. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  9230. return nil;
  9231. })))._notNil();
  9232. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  9233. },
  9234. args: ["anObject"],
  9235. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  9236. referencedClasses: [],
  9237. messageSends: ["notNil", "indexOf:ifAbsent:"]
  9238. }),
  9239. $globals.SequenceableCollection);
  9240. $core.addMethod(
  9241. $core.method({
  9242. selector: "indexOf:ifAbsent:",
  9243. protocol: "accessing",
  9244. fn: function (anObject,aBlock){
  9245. var self=this,$self=this;
  9246. return $core.withContext(function($ctx1) {
  9247. var nself = $self._numericallyIndexable();
  9248. for(var i=0; i < nself.length; i++) {
  9249. if($recv(nself[i]).__eq(anObject)) {return i+1}
  9250. };
  9251. return aBlock._value();
  9252. ;
  9253. return self;
  9254. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  9255. },
  9256. args: ["anObject", "aBlock"],
  9257. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09if($recv(nself[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  9258. referencedClasses: [],
  9259. messageSends: []
  9260. }),
  9261. $globals.SequenceableCollection);
  9262. $core.addMethod(
  9263. $core.method({
  9264. selector: "indexOf:startingAt:",
  9265. protocol: "accessing",
  9266. fn: function (anObject,start){
  9267. var self=this,$self=this;
  9268. return $core.withContext(function($ctx1) {
  9269. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  9270. return (0);
  9271. }));
  9272. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  9273. },
  9274. args: ["anObject", "start"],
  9275. 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 ]",
  9276. referencedClasses: [],
  9277. messageSends: ["indexOf:startingAt:ifAbsent:"]
  9278. }),
  9279. $globals.SequenceableCollection);
  9280. $core.addMethod(
  9281. $core.method({
  9282. selector: "indexOf:startingAt:ifAbsent:",
  9283. protocol: "accessing",
  9284. fn: function (anObject,start,aBlock){
  9285. var self=this,$self=this;
  9286. return $core.withContext(function($ctx1) {
  9287. var nself = $self._numericallyIndexable();
  9288. for(var i=start - 1; i < nself.length; i++){
  9289. if($recv(nself[i]).__eq(anObject)) {return i+1}
  9290. }
  9291. return aBlock._value();
  9292. ;
  9293. return self;
  9294. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  9295. },
  9296. args: ["anObject", "start", "aBlock"],
  9297. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < nself.length; i++){\x0a\x09\x09\x09if($recv(nself[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  9298. referencedClasses: [],
  9299. messageSends: []
  9300. }),
  9301. $globals.SequenceableCollection);
  9302. $core.addMethod(
  9303. $core.method({
  9304. selector: "last",
  9305. protocol: "accessing",
  9306. fn: function (){
  9307. var self=this,$self=this;
  9308. return $core.withContext(function($ctx1) {
  9309. return $self._at_($self._size());
  9310. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  9311. },
  9312. args: [],
  9313. source: "last\x0a\x09^ self at: self size",
  9314. referencedClasses: [],
  9315. messageSends: ["at:", "size"]
  9316. }),
  9317. $globals.SequenceableCollection);
  9318. $core.addMethod(
  9319. $core.method({
  9320. selector: "last:",
  9321. protocol: "accessing",
  9322. fn: function (aNumber){
  9323. var self=this,$self=this;
  9324. return $core.withContext(function($ctx1) {
  9325. var $2,$1,$5,$4,$3;
  9326. $2=$self._size();
  9327. $ctx1.sendIdx["size"]=1;
  9328. $1=$recv($2).__lt(aNumber);
  9329. if($core.assert($1)){
  9330. $self._error_("Invalid number of elements");
  9331. }
  9332. $5=$self._size();
  9333. $ctx1.sendIdx["size"]=2;
  9334. $4=$recv($5).__minus(aNumber);
  9335. $3=$recv($4).__plus((1));
  9336. return $self._copyFrom_to_($3,$self._size());
  9337. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  9338. },
  9339. args: ["aNumber"],
  9340. source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size",
  9341. referencedClasses: [],
  9342. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  9343. }),
  9344. $globals.SequenceableCollection);
  9345. $core.addMethod(
  9346. $core.method({
  9347. selector: "newStream",
  9348. protocol: "streaming",
  9349. fn: function (){
  9350. var self=this,$self=this;
  9351. return $core.withContext(function($ctx1) {
  9352. return $recv($self._streamClass())._on_(self);
  9353. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  9354. },
  9355. args: [],
  9356. source: "newStream\x0a\x09^ self streamClass on: self",
  9357. referencedClasses: [],
  9358. messageSends: ["on:", "streamClass"]
  9359. }),
  9360. $globals.SequenceableCollection);
  9361. $core.addMethod(
  9362. $core.method({
  9363. selector: "numericallyIndexable",
  9364. protocol: "private",
  9365. fn: function (){
  9366. var self=this,$self=this;
  9367. return $core.withContext(function($ctx1) {
  9368. $self._subclassResponsibility();
  9369. return self;
  9370. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  9371. },
  9372. args: [],
  9373. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  9374. referencedClasses: [],
  9375. messageSends: ["subclassResponsibility"]
  9376. }),
  9377. $globals.SequenceableCollection);
  9378. $core.addMethod(
  9379. $core.method({
  9380. selector: "readStream",
  9381. protocol: "streaming",
  9382. fn: function (){
  9383. var self=this,$self=this;
  9384. return $core.withContext(function($ctx1) {
  9385. return $self._stream();
  9386. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  9387. },
  9388. args: [],
  9389. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  9390. referencedClasses: [],
  9391. messageSends: ["stream"]
  9392. }),
  9393. $globals.SequenceableCollection);
  9394. $core.addMethod(
  9395. $core.method({
  9396. selector: "removeLast",
  9397. protocol: "adding/removing",
  9398. fn: function (){
  9399. var self=this,$self=this;
  9400. return $core.withContext(function($ctx1) {
  9401. return $self._remove_($self._last());
  9402. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  9403. },
  9404. args: [],
  9405. source: "removeLast\x0a\x09^ self remove: self last",
  9406. referencedClasses: [],
  9407. messageSends: ["remove:", "last"]
  9408. }),
  9409. $globals.SequenceableCollection);
  9410. $core.addMethod(
  9411. $core.method({
  9412. selector: "reverseDo:",
  9413. protocol: "enumerating",
  9414. fn: function (aBlock){
  9415. var self=this,$self=this;
  9416. return $core.withContext(function($ctx1) {
  9417. $recv($self._reversed())._do_(aBlock);
  9418. return self;
  9419. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  9420. },
  9421. args: ["aBlock"],
  9422. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  9423. referencedClasses: [],
  9424. messageSends: ["do:", "reversed"]
  9425. }),
  9426. $globals.SequenceableCollection);
  9427. $core.addMethod(
  9428. $core.method({
  9429. selector: "reversed",
  9430. protocol: "converting",
  9431. fn: function (){
  9432. var self=this,$self=this;
  9433. return $core.withContext(function($ctx1) {
  9434. $self._subclassResponsibility();
  9435. return self;
  9436. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  9437. },
  9438. args: [],
  9439. source: "reversed\x0a\x09self subclassResponsibility",
  9440. referencedClasses: [],
  9441. messageSends: ["subclassResponsibility"]
  9442. }),
  9443. $globals.SequenceableCollection);
  9444. $core.addMethod(
  9445. $core.method({
  9446. selector: "second",
  9447. protocol: "accessing",
  9448. fn: function (){
  9449. var self=this,$self=this;
  9450. return $core.withContext(function($ctx1) {
  9451. return $self._at_((2));
  9452. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  9453. },
  9454. args: [],
  9455. source: "second\x0a\x09^ self at: 2",
  9456. referencedClasses: [],
  9457. messageSends: ["at:"]
  9458. }),
  9459. $globals.SequenceableCollection);
  9460. $core.addMethod(
  9461. $core.method({
  9462. selector: "single",
  9463. protocol: "accessing",
  9464. fn: function (){
  9465. var self=this,$self=this;
  9466. return $core.withContext(function($ctx1) {
  9467. if (self.length == 0) throw new Error("Collection is empty");
  9468. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9469. return $self._numericallyIndexable()[0];;
  9470. return self;
  9471. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  9472. },
  9473. args: [],
  9474. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return $self._numericallyIndexable()[0];\x0a'>",
  9475. referencedClasses: [],
  9476. messageSends: []
  9477. }),
  9478. $globals.SequenceableCollection);
  9479. $core.addMethod(
  9480. $core.method({
  9481. selector: "stream",
  9482. protocol: "streaming",
  9483. fn: function (){
  9484. var self=this,$self=this;
  9485. return $core.withContext(function($ctx1) {
  9486. return $self._newStream();
  9487. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  9488. },
  9489. args: [],
  9490. source: "stream\x0a\x09^ self newStream",
  9491. referencedClasses: [],
  9492. messageSends: ["newStream"]
  9493. }),
  9494. $globals.SequenceableCollection);
  9495. $core.addMethod(
  9496. $core.method({
  9497. selector: "streamClass",
  9498. protocol: "streaming",
  9499. fn: function (){
  9500. var self=this,$self=this;
  9501. return $core.withContext(function($ctx1) {
  9502. return $recv($self._class())._streamClass();
  9503. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  9504. },
  9505. args: [],
  9506. source: "streamClass\x0a\x09^ self class streamClass",
  9507. referencedClasses: [],
  9508. messageSends: ["streamClass", "class"]
  9509. }),
  9510. $globals.SequenceableCollection);
  9511. $core.addMethod(
  9512. $core.method({
  9513. selector: "third",
  9514. protocol: "accessing",
  9515. fn: function (){
  9516. var self=this,$self=this;
  9517. return $core.withContext(function($ctx1) {
  9518. return $self._at_((3));
  9519. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  9520. },
  9521. args: [],
  9522. source: "third\x0a\x09^ self at: 3",
  9523. referencedClasses: [],
  9524. messageSends: ["at:"]
  9525. }),
  9526. $globals.SequenceableCollection);
  9527. $core.addMethod(
  9528. $core.method({
  9529. selector: "with:do:",
  9530. protocol: "enumerating",
  9531. fn: function (anotherCollection,aBlock){
  9532. var self=this,$self=this;
  9533. return $core.withContext(function($ctx1) {
  9534. var nself = $self._numericallyIndexable();
  9535. anotherCollection = anotherCollection._numericallyIndexable();
  9536. for(var i=0; i<nself.length; i++) {
  9537. aBlock._value_value_(nself[i], anotherCollection[i]);
  9538. }
  9539. ;
  9540. return self;
  9541. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  9542. },
  9543. args: ["anotherCollection", "aBlock"],
  9544. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<nself.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(nself[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  9545. referencedClasses: [],
  9546. messageSends: []
  9547. }),
  9548. $globals.SequenceableCollection);
  9549. $core.addMethod(
  9550. $core.method({
  9551. selector: "withIndexDo:",
  9552. protocol: "enumerating",
  9553. fn: function (aBlock){
  9554. var self=this,$self=this;
  9555. return $core.withContext(function($ctx1) {
  9556. var nself = $self._numericallyIndexable();
  9557. for(var i=0; i < nself.length; i++) {
  9558. aBlock._value_value_(nself[i], i+1);
  9559. }
  9560. ;
  9561. return self;
  9562. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  9563. },
  9564. args: ["aBlock"],
  9565. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(nself[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  9566. referencedClasses: [],
  9567. messageSends: []
  9568. }),
  9569. $globals.SequenceableCollection);
  9570. $core.addMethod(
  9571. $core.method({
  9572. selector: "writeStream",
  9573. protocol: "streaming",
  9574. fn: function (){
  9575. var self=this,$self=this;
  9576. return $core.withContext(function($ctx1) {
  9577. return $self._stream();
  9578. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  9579. },
  9580. args: [],
  9581. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  9582. referencedClasses: [],
  9583. messageSends: ["stream"]
  9584. }),
  9585. $globals.SequenceableCollection);
  9586. $core.addMethod(
  9587. $core.method({
  9588. selector: "streamClass",
  9589. protocol: "accessing",
  9590. fn: function (){
  9591. var self=this,$self=this;
  9592. return $globals.Stream;
  9593. },
  9594. args: [],
  9595. source: "streamClass\x0a\x09\x09^ Stream",
  9596. referencedClasses: ["Stream"],
  9597. messageSends: []
  9598. }),
  9599. $globals.SequenceableCollection.a$cls);
  9600. $core.addMethod(
  9601. $core.method({
  9602. selector: "streamContents:",
  9603. protocol: "streaming",
  9604. fn: function (aBlock){
  9605. var self=this,$self=this;
  9606. var stream;
  9607. return $core.withContext(function($ctx1) {
  9608. stream=$recv($self._streamClass())._on_($self._new());
  9609. $recv(aBlock)._value_(stream);
  9610. return $recv(stream)._contents();
  9611. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  9612. },
  9613. args: ["aBlock"],
  9614. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  9615. referencedClasses: [],
  9616. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  9617. }),
  9618. $globals.SequenceableCollection.a$cls);
  9619. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  9620. $globals.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`.";
  9621. $core.addMethod(
  9622. $core.method({
  9623. selector: "add:",
  9624. protocol: "adding/removing",
  9625. fn: function (anObject){
  9626. var self=this,$self=this;
  9627. return $core.withContext(function($ctx1) {
  9628. self.push(anObject); return anObject;;
  9629. return self;
  9630. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  9631. },
  9632. args: ["anObject"],
  9633. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  9634. referencedClasses: [],
  9635. messageSends: []
  9636. }),
  9637. $globals.Array);
  9638. $core.addMethod(
  9639. $core.method({
  9640. selector: "addAll:",
  9641. protocol: "adding/removing",
  9642. fn: function (aCollection){
  9643. var self=this,$self=this;
  9644. return $core.withContext(function($ctx1) {
  9645. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  9646. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  9647. return aCollection;;
  9648. return self;
  9649. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  9650. },
  9651. args: ["aCollection"],
  9652. source: "addAll: aCollection\x0a<inlineJS: '\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);\x0a\x09return aCollection;\x0a'>",
  9653. referencedClasses: [],
  9654. messageSends: []
  9655. }),
  9656. $globals.Array);
  9657. $core.addMethod(
  9658. $core.method({
  9659. selector: "addFirst:",
  9660. protocol: "adding/removing",
  9661. fn: function (anObject){
  9662. var self=this,$self=this;
  9663. return $core.withContext(function($ctx1) {
  9664. self.unshift(anObject); return anObject;;
  9665. return self;
  9666. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  9667. },
  9668. args: ["anObject"],
  9669. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  9670. referencedClasses: [],
  9671. messageSends: []
  9672. }),
  9673. $globals.Array);
  9674. $core.addMethod(
  9675. $core.method({
  9676. selector: "asJavaScriptSource",
  9677. protocol: "converting",
  9678. fn: function (){
  9679. var self=this,$self=this;
  9680. return $core.withContext(function($ctx1) {
  9681. var $1;
  9682. $1=$recv("[".__comma($recv($self._collect_((function(each){
  9683. return $core.withContext(function($ctx2) {
  9684. return $recv(each)._asJavaScriptSource();
  9685. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9686. })))._join_(", "))).__comma("]");
  9687. $ctx1.sendIdx[","]=1;
  9688. return $1;
  9689. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  9690. },
  9691. args: [],
  9692. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  9693. referencedClasses: [],
  9694. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  9695. }),
  9696. $globals.Array);
  9697. $core.addMethod(
  9698. $core.method({
  9699. selector: "at:ifAbsent:",
  9700. protocol: "accessing",
  9701. fn: function (anIndex,aBlock){
  9702. var self=this,$self=this;
  9703. return $core.withContext(function($ctx1) {
  9704. return anIndex >= 1 && anIndex <= self.length
  9705. ? self[anIndex - 1]
  9706. : aBlock._value()
  9707. ;
  9708. return self;
  9709. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  9710. },
  9711. args: ["anIndex", "aBlock"],
  9712. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09'>",
  9713. referencedClasses: [],
  9714. messageSends: []
  9715. }),
  9716. $globals.Array);
  9717. $core.addMethod(
  9718. $core.method({
  9719. selector: "at:ifPresent:ifAbsent:",
  9720. protocol: "accessing",
  9721. fn: function (anIndex,aBlock,anotherBlock){
  9722. var self=this,$self=this;
  9723. return $core.withContext(function($ctx1) {
  9724. return anIndex >= 1 && anIndex <= self.length
  9725. ? aBlock._value_(self[anIndex - 1])
  9726. : anotherBlock._value()
  9727. ;
  9728. return self;
  9729. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  9730. },
  9731. args: ["anIndex", "aBlock", "anotherBlock"],
  9732. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09'>",
  9733. referencedClasses: [],
  9734. messageSends: []
  9735. }),
  9736. $globals.Array);
  9737. $core.addMethod(
  9738. $core.method({
  9739. selector: "at:put:",
  9740. protocol: "accessing",
  9741. fn: function (anIndex,anObject){
  9742. var self=this,$self=this;
  9743. return $core.withContext(function($ctx1) {
  9744. return self[anIndex - 1] = anObject;
  9745. return self;
  9746. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  9747. },
  9748. args: ["anIndex", "anObject"],
  9749. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  9750. referencedClasses: [],
  9751. messageSends: []
  9752. }),
  9753. $globals.Array);
  9754. $core.addMethod(
  9755. $core.method({
  9756. selector: "collect:",
  9757. protocol: "enumerating",
  9758. fn: function (aBlock){
  9759. var self=this,$self=this;
  9760. return $core.withContext(function($ctx1) {
  9761. return self.map(function(each) {return aBlock._value_(each)});
  9762. return self;
  9763. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  9764. },
  9765. args: ["aBlock"],
  9766. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  9767. referencedClasses: [],
  9768. messageSends: []
  9769. }),
  9770. $globals.Array);
  9771. $core.addMethod(
  9772. $core.method({
  9773. selector: "copyFrom:to:",
  9774. protocol: "copying",
  9775. fn: function (anIndex,anotherIndex){
  9776. var self=this,$self=this;
  9777. return $core.withContext(function($ctx1) {
  9778. if (anIndex >= 1 && anotherIndex <= self.length) {
  9779. return self.slice(anIndex - 1, anotherIndex);
  9780. } else {
  9781. self._at_(anIndex);
  9782. self._at_(self.length + 1);
  9783. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  9784. };
  9785. return self;
  9786. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  9787. },
  9788. args: ["anIndex", "anotherIndex"],
  9789. source: "copyFrom: anIndex to: anotherIndex\x0a<inlineJS: '\x0a\x09if (anIndex >= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}\x0a'>",
  9790. referencedClasses: [],
  9791. messageSends: []
  9792. }),
  9793. $globals.Array);
  9794. $core.addMethod(
  9795. $core.method({
  9796. selector: "join:",
  9797. protocol: "enumerating",
  9798. fn: function (aString){
  9799. var self=this,$self=this;
  9800. return $core.withContext(function($ctx1) {
  9801. return self.join(aString);
  9802. return self;
  9803. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  9804. },
  9805. args: ["aString"],
  9806. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  9807. referencedClasses: [],
  9808. messageSends: []
  9809. }),
  9810. $globals.Array);
  9811. $core.addMethod(
  9812. $core.method({
  9813. selector: "numericallyIndexable",
  9814. protocol: "private",
  9815. fn: function (){
  9816. var self=this,$self=this;
  9817. return self;
  9818. },
  9819. args: [],
  9820. source: "numericallyIndexable\x0a\x09^ self",
  9821. referencedClasses: [],
  9822. messageSends: []
  9823. }),
  9824. $globals.Array);
  9825. $core.addMethod(
  9826. $core.method({
  9827. selector: "printOn:",
  9828. protocol: "printing",
  9829. fn: function (aStream){
  9830. var self=this,$self=this;
  9831. return $core.withContext(function($ctx1) {
  9832. (
  9833. $ctx1.supercall = true,
  9834. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9835. $ctx1.supercall = false;
  9836. $ctx1.sendIdx["printOn:"]=1;
  9837. $recv(aStream)._nextPutAll_(" (");
  9838. $ctx1.sendIdx["nextPutAll:"]=1;
  9839. $self._do_separatedBy_((function(each){
  9840. return $core.withContext(function($ctx2) {
  9841. return $recv(each)._printOn_(aStream);
  9842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9843. }),(function(){
  9844. return $core.withContext(function($ctx2) {
  9845. return $recv(aStream)._nextPutAll_(" ");
  9846. $ctx2.sendIdx["nextPutAll:"]=2;
  9847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9848. }));
  9849. $recv(aStream)._nextPutAll_(")");
  9850. return self;
  9851. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  9852. },
  9853. args: ["aStream"],
  9854. 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: ')'",
  9855. referencedClasses: [],
  9856. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  9857. }),
  9858. $globals.Array);
  9859. $core.addMethod(
  9860. $core.method({
  9861. selector: "remove:ifAbsent:",
  9862. protocol: "adding/removing",
  9863. fn: function (anObject,aBlock){
  9864. var self=this,$self=this;
  9865. var index;
  9866. return $core.withContext(function($ctx1) {
  9867. var $1;
  9868. index=$self._indexOf_ifAbsent_(anObject,(function(){
  9869. return (0);
  9870. }));
  9871. $1=$recv(index).__eq((0));
  9872. if($core.assert($1)){
  9873. return $recv(aBlock)._value();
  9874. } else {
  9875. $self._removeIndex_(index);
  9876. return anObject;
  9877. }
  9878. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  9879. },
  9880. args: ["anObject", "aBlock"],
  9881. source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]",
  9882. referencedClasses: [],
  9883. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  9884. }),
  9885. $globals.Array);
  9886. $core.addMethod(
  9887. $core.method({
  9888. selector: "removeAll",
  9889. protocol: "adding/removing",
  9890. fn: function (){
  9891. var self=this,$self=this;
  9892. return $core.withContext(function($ctx1) {
  9893. self.length = 0;
  9894. return self;
  9895. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  9896. },
  9897. args: [],
  9898. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  9899. referencedClasses: [],
  9900. messageSends: []
  9901. }),
  9902. $globals.Array);
  9903. $core.addMethod(
  9904. $core.method({
  9905. selector: "removeFrom:to:",
  9906. protocol: "adding/removing",
  9907. fn: function (aNumber,anotherNumber){
  9908. var self=this,$self=this;
  9909. return $core.withContext(function($ctx1) {
  9910. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  9911. return self;
  9912. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  9913. },
  9914. args: ["aNumber", "anotherNumber"],
  9915. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  9916. referencedClasses: [],
  9917. messageSends: []
  9918. }),
  9919. $globals.Array);
  9920. $core.addMethod(
  9921. $core.method({
  9922. selector: "removeIndex:",
  9923. protocol: "adding/removing",
  9924. fn: function (anInteger){
  9925. var self=this,$self=this;
  9926. return $core.withContext(function($ctx1) {
  9927. self.splice(anInteger - 1, 1);
  9928. return self;
  9929. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  9930. },
  9931. args: ["anInteger"],
  9932. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  9933. referencedClasses: [],
  9934. messageSends: []
  9935. }),
  9936. $globals.Array);
  9937. $core.addMethod(
  9938. $core.method({
  9939. selector: "removeLast",
  9940. protocol: "adding/removing",
  9941. fn: function (){
  9942. var self=this,$self=this;
  9943. return $core.withContext(function($ctx1) {
  9944. return self.pop();;
  9945. return self;
  9946. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  9947. },
  9948. args: [],
  9949. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  9950. referencedClasses: [],
  9951. messageSends: []
  9952. }),
  9953. $globals.Array);
  9954. $core.addMethod(
  9955. $core.method({
  9956. selector: "reversed",
  9957. protocol: "converting",
  9958. fn: function (){
  9959. var self=this,$self=this;
  9960. return $core.withContext(function($ctx1) {
  9961. return self.slice().reverse();
  9962. return self;
  9963. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  9964. },
  9965. args: [],
  9966. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  9967. referencedClasses: [],
  9968. messageSends: []
  9969. }),
  9970. $globals.Array);
  9971. $core.addMethod(
  9972. $core.method({
  9973. selector: "select:",
  9974. protocol: "enumerating",
  9975. fn: function (aBlock){
  9976. var self=this,$self=this;
  9977. return $core.withContext(function($ctx1) {
  9978. return self.filter(function(each) {return aBlock._value_(each)});
  9979. return self;
  9980. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  9981. },
  9982. args: ["aBlock"],
  9983. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  9984. referencedClasses: [],
  9985. messageSends: []
  9986. }),
  9987. $globals.Array);
  9988. $core.addMethod(
  9989. $core.method({
  9990. selector: "shallowCopy",
  9991. protocol: "copying",
  9992. fn: function (){
  9993. var self=this,$self=this;
  9994. return $core.withContext(function($ctx1) {
  9995. return self.slice();
  9996. return self;
  9997. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  9998. },
  9999. args: [],
  10000. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10001. referencedClasses: [],
  10002. messageSends: []
  10003. }),
  10004. $globals.Array);
  10005. $core.addMethod(
  10006. $core.method({
  10007. selector: "size",
  10008. protocol: "accessing",
  10009. fn: function (){
  10010. var self=this,$self=this;
  10011. return $core.withContext(function($ctx1) {
  10012. return self.length;
  10013. return self;
  10014. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  10015. },
  10016. args: [],
  10017. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  10018. referencedClasses: [],
  10019. messageSends: []
  10020. }),
  10021. $globals.Array);
  10022. $core.addMethod(
  10023. $core.method({
  10024. selector: "sort",
  10025. protocol: "enumerating",
  10026. fn: function (){
  10027. var self=this,$self=this;
  10028. return $core.withContext(function($ctx1) {
  10029. return $self._sort_((function(a,b){
  10030. return $core.withContext(function($ctx2) {
  10031. return $recv(a).__lt(b);
  10032. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10033. }));
  10034. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10035. },
  10036. args: [],
  10037. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10038. referencedClasses: [],
  10039. messageSends: ["sort:", "<"]
  10040. }),
  10041. $globals.Array);
  10042. $core.addMethod(
  10043. $core.method({
  10044. selector: "sort:",
  10045. protocol: "enumerating",
  10046. fn: function (aBlock){
  10047. var self=this,$self=this;
  10048. return $core.withContext(function($ctx1) {
  10049. return self.sort(function(a, b) {
  10050. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10051. })
  10052. ;
  10053. return self;
  10054. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  10055. },
  10056. args: ["aBlock"],
  10057. source: "sort: aBlock\x0a\x09<inlineJS: '\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'>",
  10058. referencedClasses: [],
  10059. messageSends: []
  10060. }),
  10061. $globals.Array);
  10062. $core.addMethod(
  10063. $core.method({
  10064. selector: "sorted",
  10065. protocol: "enumerating",
  10066. fn: function (){
  10067. var self=this,$self=this;
  10068. return $core.withContext(function($ctx1) {
  10069. return $recv($self._copy())._sort();
  10070. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  10071. },
  10072. args: [],
  10073. source: "sorted\x0a\x09^ self copy sort",
  10074. referencedClasses: [],
  10075. messageSends: ["sort", "copy"]
  10076. }),
  10077. $globals.Array);
  10078. $core.addMethod(
  10079. $core.method({
  10080. selector: "sorted:",
  10081. protocol: "enumerating",
  10082. fn: function (aBlock){
  10083. var self=this,$self=this;
  10084. return $core.withContext(function($ctx1) {
  10085. return $recv($self._copy())._sort_(aBlock);
  10086. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  10087. },
  10088. args: ["aBlock"],
  10089. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  10090. referencedClasses: [],
  10091. messageSends: ["sort:", "copy"]
  10092. }),
  10093. $globals.Array);
  10094. $core.addMethod(
  10095. $core.method({
  10096. selector: "new:",
  10097. protocol: "instance creation",
  10098. fn: function (anInteger){
  10099. var self=this,$self=this;
  10100. return $core.withContext(function($ctx1) {
  10101. return new Array(anInteger);
  10102. return self;
  10103. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  10104. },
  10105. args: ["anInteger"],
  10106. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  10107. referencedClasses: [],
  10108. messageSends: []
  10109. }),
  10110. $globals.Array.a$cls);
  10111. $core.addMethod(
  10112. $core.method({
  10113. selector: "with:",
  10114. protocol: "instance creation",
  10115. fn: function (anObject){
  10116. var self=this,$self=this;
  10117. return $core.withContext(function($ctx1) {
  10118. var $1;
  10119. $1=$self._new_((1));
  10120. $recv($1)._at_put_((1),anObject);
  10121. return $recv($1)._yourself();
  10122. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  10123. },
  10124. args: ["anObject"],
  10125. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  10126. referencedClasses: [],
  10127. messageSends: ["at:put:", "new:", "yourself"]
  10128. }),
  10129. $globals.Array.a$cls);
  10130. $core.addMethod(
  10131. $core.method({
  10132. selector: "with:with:",
  10133. protocol: "instance creation",
  10134. fn: function (anObject,anObject2){
  10135. var self=this,$self=this;
  10136. return $core.withContext(function($ctx1) {
  10137. var $1;
  10138. $1=$self._new_((2));
  10139. $recv($1)._at_put_((1),anObject);
  10140. $ctx1.sendIdx["at:put:"]=1;
  10141. $recv($1)._at_put_((2),anObject2);
  10142. return $recv($1)._yourself();
  10143. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  10144. },
  10145. args: ["anObject", "anObject2"],
  10146. 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",
  10147. referencedClasses: [],
  10148. messageSends: ["at:put:", "new:", "yourself"]
  10149. }),
  10150. $globals.Array.a$cls);
  10151. $core.addMethod(
  10152. $core.method({
  10153. selector: "with:with:with:",
  10154. protocol: "instance creation",
  10155. fn: function (anObject,anObject2,anObject3){
  10156. var self=this,$self=this;
  10157. return $core.withContext(function($ctx1) {
  10158. var $1;
  10159. $1=$self._new_((3));
  10160. $recv($1)._at_put_((1),anObject);
  10161. $ctx1.sendIdx["at:put:"]=1;
  10162. $recv($1)._at_put_((2),anObject2);
  10163. $ctx1.sendIdx["at:put:"]=2;
  10164. $recv($1)._at_put_((3),anObject3);
  10165. return $recv($1)._yourself();
  10166. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  10167. },
  10168. args: ["anObject", "anObject2", "anObject3"],
  10169. 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",
  10170. referencedClasses: [],
  10171. messageSends: ["at:put:", "new:", "yourself"]
  10172. }),
  10173. $globals.Array.a$cls);
  10174. $core.addMethod(
  10175. $core.method({
  10176. selector: "withAll:",
  10177. protocol: "instance creation",
  10178. fn: function (aCollection){
  10179. var self=this,$self=this;
  10180. var instance,index;
  10181. return $core.withContext(function($ctx1) {
  10182. index=(1);
  10183. instance=$self._new_($recv(aCollection)._size());
  10184. $recv(aCollection)._do_((function(each){
  10185. return $core.withContext(function($ctx2) {
  10186. $recv(instance)._at_put_(index,each);
  10187. index=$recv(index).__plus((1));
  10188. return index;
  10189. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10190. }));
  10191. return instance;
  10192. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  10193. },
  10194. args: ["aCollection"],
  10195. 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",
  10196. referencedClasses: [],
  10197. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  10198. }),
  10199. $globals.Array.a$cls);
  10200. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  10201. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  10202. $core.addMethod(
  10203. $core.method({
  10204. selector: ",",
  10205. protocol: "copying",
  10206. fn: function (aString){
  10207. var self=this,$self=this;
  10208. return $core.withContext(function($ctx1) {
  10209. var $1;
  10210. $1=$self._asString();
  10211. $ctx1.sendIdx["asString"]=1;
  10212. return $recv($1).__comma($recv(aString)._asString());
  10213. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  10214. },
  10215. args: ["aString"],
  10216. source: ", aString\x0a\x09^ self asString, aString asString",
  10217. referencedClasses: [],
  10218. messageSends: [",", "asString"]
  10219. }),
  10220. $globals.CharacterArray);
  10221. $core.addMethod(
  10222. $core.method({
  10223. selector: "add:",
  10224. protocol: "adding/removing",
  10225. fn: function (anObject){
  10226. var self=this,$self=this;
  10227. return $core.withContext(function($ctx1) {
  10228. $self._errorReadOnly();
  10229. return self;
  10230. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  10231. },
  10232. args: ["anObject"],
  10233. source: "add: anObject\x0a\x09self errorReadOnly",
  10234. referencedClasses: [],
  10235. messageSends: ["errorReadOnly"]
  10236. }),
  10237. $globals.CharacterArray);
  10238. $core.addMethod(
  10239. $core.method({
  10240. selector: "asLowercase",
  10241. protocol: "converting",
  10242. fn: function (){
  10243. var self=this,$self=this;
  10244. return $core.withContext(function($ctx1) {
  10245. return $recv($self._class())._fromString_($recv($self._asString())._asLowercase());
  10246. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  10247. },
  10248. args: [],
  10249. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  10250. referencedClasses: [],
  10251. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  10252. }),
  10253. $globals.CharacterArray);
  10254. $core.addMethod(
  10255. $core.method({
  10256. selector: "asNumber",
  10257. protocol: "converting",
  10258. fn: function (){
  10259. var self=this,$self=this;
  10260. return $core.withContext(function($ctx1) {
  10261. return $recv($self._asString())._asNumber();
  10262. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  10263. },
  10264. args: [],
  10265. source: "asNumber\x0a\x09^ self asString asNumber",
  10266. referencedClasses: [],
  10267. messageSends: ["asNumber", "asString"]
  10268. }),
  10269. $globals.CharacterArray);
  10270. $core.addMethod(
  10271. $core.method({
  10272. selector: "asString",
  10273. protocol: "converting",
  10274. fn: function (){
  10275. var self=this,$self=this;
  10276. return $core.withContext(function($ctx1) {
  10277. return $self._subclassResponsibility();
  10278. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  10279. },
  10280. args: [],
  10281. source: "asString\x0a\x09^ self subclassResponsibility",
  10282. referencedClasses: [],
  10283. messageSends: ["subclassResponsibility"]
  10284. }),
  10285. $globals.CharacterArray);
  10286. $core.addMethod(
  10287. $core.method({
  10288. selector: "asSymbol",
  10289. protocol: "converting",
  10290. fn: function (){
  10291. var self=this,$self=this;
  10292. return $core.withContext(function($ctx1) {
  10293. return $self._asString();
  10294. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  10295. },
  10296. args: [],
  10297. source: "asSymbol\x0a\x09^ self asString",
  10298. referencedClasses: [],
  10299. messageSends: ["asString"]
  10300. }),
  10301. $globals.CharacterArray);
  10302. $core.addMethod(
  10303. $core.method({
  10304. selector: "asSymbolPrintOn:",
  10305. protocol: "printing",
  10306. fn: function (aStream){
  10307. var self=this,$self=this;
  10308. return $core.withContext(function($ctx1) {
  10309. var $1;
  10310. $recv(aStream)._nextPutAll_("#");
  10311. $1=$recv($self._asString())._isSelector();
  10312. if($core.assert($1)){
  10313. $recv(aStream)._nextPut_(self);
  10314. } else {
  10315. $self._printOn_(aStream);
  10316. }
  10317. return self;
  10318. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  10319. },
  10320. args: ["aStream"],
  10321. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  10322. referencedClasses: [],
  10323. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  10324. }),
  10325. $globals.CharacterArray);
  10326. $core.addMethod(
  10327. $core.method({
  10328. selector: "asUppercase",
  10329. protocol: "converting",
  10330. fn: function (){
  10331. var self=this,$self=this;
  10332. return $core.withContext(function($ctx1) {
  10333. return $recv($self._class())._fromString_($recv($self._asString())._asUppercase());
  10334. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  10335. },
  10336. args: [],
  10337. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  10338. referencedClasses: [],
  10339. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  10340. }),
  10341. $globals.CharacterArray);
  10342. $core.addMethod(
  10343. $core.method({
  10344. selector: "at:put:",
  10345. protocol: "accessing",
  10346. fn: function (anIndex,anObject){
  10347. var self=this,$self=this;
  10348. return $core.withContext(function($ctx1) {
  10349. $self._errorReadOnly();
  10350. return self;
  10351. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  10352. },
  10353. args: ["anIndex", "anObject"],
  10354. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  10355. referencedClasses: [],
  10356. messageSends: ["errorReadOnly"]
  10357. }),
  10358. $globals.CharacterArray);
  10359. $core.addMethod(
  10360. $core.method({
  10361. selector: "errorReadOnly",
  10362. protocol: "error handling",
  10363. fn: function (){
  10364. var self=this,$self=this;
  10365. return $core.withContext(function($ctx1) {
  10366. $self._error_("Object is read-only");
  10367. return self;
  10368. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  10369. },
  10370. args: [],
  10371. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  10372. referencedClasses: [],
  10373. messageSends: ["error:"]
  10374. }),
  10375. $globals.CharacterArray);
  10376. $core.addMethod(
  10377. $core.method({
  10378. selector: "printOn:",
  10379. protocol: "printing",
  10380. fn: function (aStream){
  10381. var self=this,$self=this;
  10382. return $core.withContext(function($ctx1) {
  10383. $recv($self._asString())._printOn_(aStream);
  10384. return self;
  10385. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  10386. },
  10387. args: ["aStream"],
  10388. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  10389. referencedClasses: [],
  10390. messageSends: ["printOn:", "asString"]
  10391. }),
  10392. $globals.CharacterArray);
  10393. $core.addMethod(
  10394. $core.method({
  10395. selector: "putOn:",
  10396. protocol: "streaming",
  10397. fn: function (aStream){
  10398. var self=this,$self=this;
  10399. return $core.withContext(function($ctx1) {
  10400. $recv(aStream)._nextPutString_(self);
  10401. return self;
  10402. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  10403. },
  10404. args: ["aStream"],
  10405. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  10406. referencedClasses: [],
  10407. messageSends: ["nextPutString:"]
  10408. }),
  10409. $globals.CharacterArray);
  10410. $core.addMethod(
  10411. $core.method({
  10412. selector: "remove:",
  10413. protocol: "adding/removing",
  10414. fn: function (anObject){
  10415. var self=this,$self=this;
  10416. return $core.withContext(function($ctx1) {
  10417. $self._errorReadOnly();
  10418. return self;
  10419. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  10420. },
  10421. args: ["anObject"],
  10422. source: "remove: anObject\x0a\x09self errorReadOnly",
  10423. referencedClasses: [],
  10424. messageSends: ["errorReadOnly"]
  10425. }),
  10426. $globals.CharacterArray);
  10427. $core.addMethod(
  10428. $core.method({
  10429. selector: "symbolPrintString",
  10430. protocol: "printing",
  10431. fn: function (){
  10432. var self=this,$self=this;
  10433. return $core.withContext(function($ctx1) {
  10434. return $recv($globals.String)._streamContents_((function(str){
  10435. return $core.withContext(function($ctx2) {
  10436. return $self._asSymbolPrintOn_(str);
  10437. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  10438. }));
  10439. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  10440. },
  10441. args: [],
  10442. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  10443. referencedClasses: ["String"],
  10444. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  10445. }),
  10446. $globals.CharacterArray);
  10447. $core.addMethod(
  10448. $core.method({
  10449. selector: "fromString:",
  10450. protocol: "instance creation",
  10451. fn: function (aString){
  10452. var self=this,$self=this;
  10453. return $core.withContext(function($ctx1) {
  10454. $self._subclassResponsibility();
  10455. return self;
  10456. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.a$cls)});
  10457. },
  10458. args: ["aString"],
  10459. source: "fromString: aString\x0a\x09self subclassResponsibility",
  10460. referencedClasses: [],
  10461. messageSends: ["subclassResponsibility"]
  10462. }),
  10463. $globals.CharacterArray.a$cls);
  10464. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  10465. $globals.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 >> #,`";
  10466. $core.addMethod(
  10467. $core.method({
  10468. selector: ",",
  10469. protocol: "copying",
  10470. fn: function (aString){
  10471. var self=this,$self=this;
  10472. return $core.withContext(function($ctx1) {
  10473. return String(self) + aString;
  10474. return self;
  10475. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  10476. },
  10477. args: ["aString"],
  10478. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  10479. referencedClasses: [],
  10480. messageSends: []
  10481. }),
  10482. $globals.String);
  10483. $core.addMethod(
  10484. $core.method({
  10485. selector: "<",
  10486. protocol: "comparing",
  10487. fn: function (aString){
  10488. var self=this,$self=this;
  10489. return $core.withContext(function($ctx1) {
  10490. return String(self) < aString._asString();
  10491. return self;
  10492. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  10493. },
  10494. args: ["aString"],
  10495. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  10496. referencedClasses: [],
  10497. messageSends: []
  10498. }),
  10499. $globals.String);
  10500. $core.addMethod(
  10501. $core.method({
  10502. selector: "<=",
  10503. protocol: "comparing",
  10504. fn: function (aString){
  10505. var self=this,$self=this;
  10506. return $core.withContext(function($ctx1) {
  10507. return String(self) <= aString._asString();
  10508. return self;
  10509. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  10510. },
  10511. args: ["aString"],
  10512. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  10513. referencedClasses: [],
  10514. messageSends: []
  10515. }),
  10516. $globals.String);
  10517. $core.addMethod(
  10518. $core.method({
  10519. selector: "=",
  10520. protocol: "comparing",
  10521. fn: function (aString){
  10522. var self=this,$self=this;
  10523. return $core.withContext(function($ctx1) {
  10524. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  10525. return self;
  10526. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  10527. },
  10528. args: ["aString"],
  10529. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  10530. referencedClasses: [],
  10531. messageSends: []
  10532. }),
  10533. $globals.String);
  10534. $core.addMethod(
  10535. $core.method({
  10536. selector: "==",
  10537. protocol: "comparing",
  10538. fn: function (aString){
  10539. var self=this,$self=this;
  10540. return $core.withContext(function($ctx1) {
  10541. if (typeof aString === "string") return String(self) === aString;
  10542. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  10543. else return false;;
  10544. return self;
  10545. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  10546. },
  10547. args: ["aString"],
  10548. source: "== aString\x0a<inlineJS: '\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;\x0a'>",
  10549. referencedClasses: [],
  10550. messageSends: []
  10551. }),
  10552. $globals.String);
  10553. $core.addMethod(
  10554. $core.method({
  10555. selector: ">",
  10556. protocol: "comparing",
  10557. fn: function (aString){
  10558. var self=this,$self=this;
  10559. return $core.withContext(function($ctx1) {
  10560. return String(self) > aString._asString();
  10561. return self;
  10562. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  10563. },
  10564. args: ["aString"],
  10565. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  10566. referencedClasses: [],
  10567. messageSends: []
  10568. }),
  10569. $globals.String);
  10570. $core.addMethod(
  10571. $core.method({
  10572. selector: ">=",
  10573. protocol: "comparing",
  10574. fn: function (aString){
  10575. var self=this,$self=this;
  10576. return $core.withContext(function($ctx1) {
  10577. return String(self) >= aString._asString();
  10578. return self;
  10579. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  10580. },
  10581. args: ["aString"],
  10582. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  10583. referencedClasses: [],
  10584. messageSends: []
  10585. }),
  10586. $globals.String);
  10587. $core.addMethod(
  10588. $core.method({
  10589. selector: "asJavaScriptMethodName",
  10590. protocol: "converting",
  10591. fn: function (){
  10592. var self=this,$self=this;
  10593. return $core.withContext(function($ctx1) {
  10594. return $core.st2js(self);
  10595. return self;
  10596. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  10597. },
  10598. args: [],
  10599. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  10600. referencedClasses: [],
  10601. messageSends: []
  10602. }),
  10603. $globals.String);
  10604. $core.addMethod(
  10605. $core.method({
  10606. selector: "asJavaScriptObject",
  10607. protocol: "converting",
  10608. fn: function (){
  10609. var self=this,$self=this;
  10610. return self;
  10611. },
  10612. args: [],
  10613. source: "asJavaScriptObject\x0a\x09^ self",
  10614. referencedClasses: [],
  10615. messageSends: []
  10616. }),
  10617. $globals.String);
  10618. $core.addMethod(
  10619. $core.method({
  10620. selector: "asJavaScriptSource",
  10621. protocol: "converting",
  10622. fn: function (){
  10623. var self=this,$self=this;
  10624. return $core.withContext(function($ctx1) {
  10625. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  10626. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  10627. else
  10628. return "\"" + self + "\"";
  10629. ;
  10630. return self;
  10631. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  10632. },
  10633. args: [],
  10634. source: "asJavaScriptSource\x0a\x09<inlineJS: '\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'>",
  10635. referencedClasses: [],
  10636. messageSends: []
  10637. }),
  10638. $globals.String);
  10639. $core.addMethod(
  10640. $core.method({
  10641. selector: "asLowercase",
  10642. protocol: "converting",
  10643. fn: function (){
  10644. var self=this,$self=this;
  10645. return $core.withContext(function($ctx1) {
  10646. return self.toLowerCase();
  10647. return self;
  10648. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  10649. },
  10650. args: [],
  10651. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  10652. referencedClasses: [],
  10653. messageSends: []
  10654. }),
  10655. $globals.String);
  10656. $core.addMethod(
  10657. $core.method({
  10658. selector: "asMutator",
  10659. protocol: "converting",
  10660. fn: function (){
  10661. var self=this,$self=this;
  10662. return $core.withContext(function($ctx1) {
  10663. var $1;
  10664. $1=$recv($self._last()).__eq(":");
  10665. if(!$core.assert($1)){
  10666. return $self.__comma(":");
  10667. }
  10668. return self;
  10669. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  10670. },
  10671. args: [],
  10672. source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self",
  10673. referencedClasses: [],
  10674. messageSends: ["ifFalse:", "=", "last", ","]
  10675. }),
  10676. $globals.String);
  10677. $core.addMethod(
  10678. $core.method({
  10679. selector: "asNumber",
  10680. protocol: "converting",
  10681. fn: function (){
  10682. var self=this,$self=this;
  10683. return $core.withContext(function($ctx1) {
  10684. return Number(self);
  10685. return self;
  10686. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  10687. },
  10688. args: [],
  10689. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  10690. referencedClasses: [],
  10691. messageSends: []
  10692. }),
  10693. $globals.String);
  10694. $core.addMethod(
  10695. $core.method({
  10696. selector: "asRegexp",
  10697. protocol: "converting",
  10698. fn: function (){
  10699. var self=this,$self=this;
  10700. return $core.withContext(function($ctx1) {
  10701. return $recv($globals.RegularExpression)._fromString_(self);
  10702. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  10703. },
  10704. args: [],
  10705. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  10706. referencedClasses: ["RegularExpression"],
  10707. messageSends: ["fromString:"]
  10708. }),
  10709. $globals.String);
  10710. $core.addMethod(
  10711. $core.method({
  10712. selector: "asString",
  10713. protocol: "converting",
  10714. fn: function (){
  10715. var self=this,$self=this;
  10716. return self;
  10717. },
  10718. args: [],
  10719. source: "asString\x0a\x09^ self",
  10720. referencedClasses: [],
  10721. messageSends: []
  10722. }),
  10723. $globals.String);
  10724. $core.addMethod(
  10725. $core.method({
  10726. selector: "asSymbol",
  10727. protocol: "converting",
  10728. fn: function (){
  10729. var self=this,$self=this;
  10730. return self;
  10731. },
  10732. args: [],
  10733. source: "asSymbol\x0a\x09^ self",
  10734. referencedClasses: [],
  10735. messageSends: []
  10736. }),
  10737. $globals.String);
  10738. $core.addMethod(
  10739. $core.method({
  10740. selector: "asUppercase",
  10741. protocol: "converting",
  10742. fn: function (){
  10743. var self=this,$self=this;
  10744. return $core.withContext(function($ctx1) {
  10745. return self.toUpperCase();
  10746. return self;
  10747. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  10748. },
  10749. args: [],
  10750. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  10751. referencedClasses: [],
  10752. messageSends: []
  10753. }),
  10754. $globals.String);
  10755. $core.addMethod(
  10756. $core.method({
  10757. selector: "asciiValue",
  10758. protocol: "accessing",
  10759. fn: function (){
  10760. var self=this,$self=this;
  10761. return $core.withContext(function($ctx1) {
  10762. return self.charCodeAt(0);;
  10763. return self;
  10764. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  10765. },
  10766. args: [],
  10767. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  10768. referencedClasses: [],
  10769. messageSends: []
  10770. }),
  10771. $globals.String);
  10772. $core.addMethod(
  10773. $core.method({
  10774. selector: "at:ifAbsent:",
  10775. protocol: "accessing",
  10776. fn: function (anIndex,aBlock){
  10777. var self=this,$self=this;
  10778. return $core.withContext(function($ctx1) {
  10779. return String(self)[anIndex - 1] || aBlock._value();
  10780. return self;
  10781. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  10782. },
  10783. args: ["anIndex", "aBlock"],
  10784. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  10785. referencedClasses: [],
  10786. messageSends: []
  10787. }),
  10788. $globals.String);
  10789. $core.addMethod(
  10790. $core.method({
  10791. selector: "at:ifPresent:ifAbsent:",
  10792. protocol: "accessing",
  10793. fn: function (anIndex,aBlock,anotherBlock){
  10794. var self=this,$self=this;
  10795. return $core.withContext(function($ctx1) {
  10796. var result = String(self)[anIndex - 1];
  10797. return result ? aBlock._value_(result) : anotherBlock._value();
  10798. ;
  10799. return self;
  10800. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  10801. },
  10802. args: ["anIndex", "aBlock", "anotherBlock"],
  10803. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09'>",
  10804. referencedClasses: [],
  10805. messageSends: []
  10806. }),
  10807. $globals.String);
  10808. $core.addMethod(
  10809. $core.method({
  10810. selector: "capitalized",
  10811. protocol: "converting",
  10812. fn: function (){
  10813. var self=this,$self=this;
  10814. return $core.withContext(function($ctx1) {
  10815. return $self._ifNotEmpty_((function(){
  10816. return $core.withContext(function($ctx2) {
  10817. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  10818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10819. }));
  10820. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  10821. },
  10822. args: [],
  10823. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  10824. referencedClasses: [],
  10825. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  10826. }),
  10827. $globals.String);
  10828. $core.addMethod(
  10829. $core.method({
  10830. selector: "charCodeAt:",
  10831. protocol: "accessing",
  10832. fn: function (anInteger){
  10833. var self=this,$self=this;
  10834. return $core.withContext(function($ctx1) {
  10835. return self.charCodeAt(anInteger - 1);
  10836. return self;
  10837. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  10838. },
  10839. args: ["anInteger"],
  10840. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  10841. referencedClasses: [],
  10842. messageSends: []
  10843. }),
  10844. $globals.String);
  10845. $core.addMethod(
  10846. $core.method({
  10847. selector: "copyFrom:to:",
  10848. protocol: "copying",
  10849. fn: function (anIndex,anotherIndex){
  10850. var self=this,$self=this;
  10851. return $core.withContext(function($ctx1) {
  10852. return self.substring(anIndex - 1, anotherIndex);
  10853. return self;
  10854. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  10855. },
  10856. args: ["anIndex", "anotherIndex"],
  10857. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  10858. referencedClasses: [],
  10859. messageSends: []
  10860. }),
  10861. $globals.String);
  10862. $core.addMethod(
  10863. $core.method({
  10864. selector: "crlfSanitized",
  10865. protocol: "converting",
  10866. fn: function (){
  10867. var self=this,$self=this;
  10868. return $core.withContext(function($ctx1) {
  10869. return $recv($self._lines())._join_($recv($globals.String)._lf());
  10870. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  10871. },
  10872. args: [],
  10873. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  10874. referencedClasses: ["String"],
  10875. messageSends: ["join:", "lines", "lf"]
  10876. }),
  10877. $globals.String);
  10878. $core.addMethod(
  10879. $core.method({
  10880. selector: "deepCopy",
  10881. protocol: "copying",
  10882. fn: function (){
  10883. var self=this,$self=this;
  10884. return $core.withContext(function($ctx1) {
  10885. return $self._shallowCopy();
  10886. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  10887. },
  10888. args: [],
  10889. source: "deepCopy\x0a\x09^ self shallowCopy",
  10890. referencedClasses: [],
  10891. messageSends: ["shallowCopy"]
  10892. }),
  10893. $globals.String);
  10894. $core.addMethod(
  10895. $core.method({
  10896. selector: "escaped",
  10897. protocol: "converting",
  10898. fn: function (){
  10899. var self=this,$self=this;
  10900. return $core.withContext(function($ctx1) {
  10901. return escape(self);
  10902. return self;
  10903. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  10904. },
  10905. args: [],
  10906. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  10907. referencedClasses: [],
  10908. messageSends: []
  10909. }),
  10910. $globals.String);
  10911. $core.addMethod(
  10912. $core.method({
  10913. selector: "includesSubString:",
  10914. protocol: "testing",
  10915. fn: function (subString){
  10916. var self=this,$self=this;
  10917. return $core.withContext(function($ctx1) {
  10918. return self.indexOf(subString) != -1;
  10919. return self;
  10920. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  10921. },
  10922. args: ["subString"],
  10923. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  10924. referencedClasses: [],
  10925. messageSends: []
  10926. }),
  10927. $globals.String);
  10928. $core.addMethod(
  10929. $core.method({
  10930. selector: "isCapitalized",
  10931. protocol: "testing",
  10932. fn: function (){
  10933. var self=this,$self=this;
  10934. return $core.withContext(function($ctx1) {
  10935. var $2,$1;
  10936. $2=$self._first();
  10937. $ctx1.sendIdx["first"]=1;
  10938. $1=$recv($2)._asUppercase();
  10939. return $recv($1).__eq_eq($self._first());
  10940. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  10941. },
  10942. args: [],
  10943. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  10944. referencedClasses: [],
  10945. messageSends: ["==", "asUppercase", "first"]
  10946. }),
  10947. $globals.String);
  10948. $core.addMethod(
  10949. $core.method({
  10950. selector: "isImmutable",
  10951. protocol: "testing",
  10952. fn: function (){
  10953. var self=this,$self=this;
  10954. return true;
  10955. },
  10956. args: [],
  10957. source: "isImmutable\x0a\x09^ true",
  10958. referencedClasses: [],
  10959. messageSends: []
  10960. }),
  10961. $globals.String);
  10962. $core.addMethod(
  10963. $core.method({
  10964. selector: "isSelector",
  10965. protocol: "testing",
  10966. fn: function (){
  10967. var self=this,$self=this;
  10968. return $core.withContext(function($ctx1) {
  10969. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  10970. return self;
  10971. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  10972. },
  10973. args: [],
  10974. source: "isSelector\x0a<inlineJS:\x0a\x09'return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)'\x0a>",
  10975. referencedClasses: [],
  10976. messageSends: []
  10977. }),
  10978. $globals.String);
  10979. $core.addMethod(
  10980. $core.method({
  10981. selector: "isString",
  10982. protocol: "testing",
  10983. fn: function (){
  10984. var self=this,$self=this;
  10985. return true;
  10986. },
  10987. args: [],
  10988. source: "isString\x0a\x09^ true",
  10989. referencedClasses: [],
  10990. messageSends: []
  10991. }),
  10992. $globals.String);
  10993. $core.addMethod(
  10994. $core.method({
  10995. selector: "isVowel",
  10996. protocol: "testing",
  10997. fn: function (){
  10998. var self=this,$self=this;
  10999. return $core.withContext(function($ctx1) {
  11000. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11001. return $core.withContext(function($ctx2) {
  11002. return "aeiou"._includes_($self._asLowercase());
  11003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11004. }));
  11005. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11006. },
  11007. args: [],
  11008. 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 ]",
  11009. referencedClasses: [],
  11010. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11011. }),
  11012. $globals.String);
  11013. $core.addMethod(
  11014. $core.method({
  11015. selector: "join:",
  11016. protocol: "split join",
  11017. fn: function (aCollection){
  11018. var self=this,$self=this;
  11019. return $core.withContext(function($ctx1) {
  11020. return $recv($globals.String)._streamContents_((function(stream){
  11021. return $core.withContext(function($ctx2) {
  11022. return $recv(aCollection)._do_separatedBy_((function(each){
  11023. return $core.withContext(function($ctx3) {
  11024. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11025. $ctx3.sendIdx["nextPutAll:"]=1;
  11026. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11027. }),(function(){
  11028. return $core.withContext(function($ctx3) {
  11029. return $recv(stream)._nextPutAll_(self);
  11030. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11031. }));
  11032. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11033. }));
  11034. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11035. },
  11036. args: ["aCollection"],
  11037. 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 ]]",
  11038. referencedClasses: ["String"],
  11039. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11040. }),
  11041. $globals.String);
  11042. $core.addMethod(
  11043. $core.method({
  11044. selector: "lineIndicesDo:",
  11045. protocol: "split join",
  11046. fn: function (aBlock){
  11047. var self=this,$self=this;
  11048. var cr,lf,start,sz,nextLF,nextCR;
  11049. return $core.withContext(function($ctx1) {
  11050. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11051. var $early={};
  11052. try {
  11053. start=(1);
  11054. sz=$self._size();
  11055. cr=$recv($globals.String)._cr();
  11056. nextCR=$self._indexOf_startingAt_(cr,(1));
  11057. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11058. lf=$recv($globals.String)._lf();
  11059. nextLF=$self._indexOf_startingAt_(lf,(1));
  11060. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11061. $recv((function(){
  11062. return $core.withContext(function($ctx2) {
  11063. return $recv(start).__lt_eq(sz);
  11064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11065. }))._whileTrue_((function(){
  11066. return $core.withContext(function($ctx2) {
  11067. $2=$recv(nextLF).__eq((0));
  11068. $ctx2.sendIdx["="]=1;
  11069. $1=$recv($2)._and_((function(){
  11070. return $core.withContext(function($ctx3) {
  11071. return $recv(nextCR).__eq((0));
  11072. $ctx3.sendIdx["="]=2;
  11073. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11074. }));
  11075. $ctx2.sendIdx["and:"]=1;
  11076. if($core.assert($1)){
  11077. $recv(aBlock)._value_value_value_(start,sz,sz);
  11078. $ctx2.sendIdx["value:value:value:"]=1;
  11079. throw $early=[self];
  11080. }
  11081. $4=$recv(nextCR).__eq((0));
  11082. $ctx2.sendIdx["="]=3;
  11083. $3=$recv($4)._or_((function(){
  11084. return $core.withContext(function($ctx3) {
  11085. $5=(0).__lt(nextLF);
  11086. $ctx3.sendIdx["<"]=1;
  11087. return $recv($5)._and_((function(){
  11088. return $core.withContext(function($ctx4) {
  11089. return $recv(nextLF).__lt(nextCR);
  11090. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  11091. }));
  11092. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11093. }));
  11094. if($core.assert($3)){
  11095. $6=start;
  11096. $7=$recv(nextLF).__minus((1));
  11097. $ctx2.sendIdx["-"]=1;
  11098. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  11099. $ctx2.sendIdx["value:value:value:"]=2;
  11100. start=(1).__plus(nextLF);
  11101. $ctx2.sendIdx["+"]=1;
  11102. start;
  11103. nextLF=$self._indexOf_startingAt_(lf,start);
  11104. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  11105. return nextLF;
  11106. } else {
  11107. $9=(1).__plus(nextCR);
  11108. $ctx2.sendIdx["+"]=2;
  11109. $8=$recv($9).__eq(nextLF);
  11110. if($core.assert($8)){
  11111. $10=start;
  11112. $11=$recv(nextCR).__minus((1));
  11113. $ctx2.sendIdx["-"]=2;
  11114. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  11115. $ctx2.sendIdx["value:value:value:"]=3;
  11116. start=(1).__plus(nextLF);
  11117. $ctx2.sendIdx["+"]=3;
  11118. start;
  11119. nextCR=$self._indexOf_startingAt_(cr,start);
  11120. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  11121. nextCR;
  11122. nextLF=$self._indexOf_startingAt_(lf,start);
  11123. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  11124. return nextLF;
  11125. } else {
  11126. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  11127. start=(1).__plus(nextCR);
  11128. start;
  11129. nextCR=$self._indexOf_startingAt_(cr,start);
  11130. return nextCR;
  11131. }
  11132. }
  11133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11134. }));
  11135. return self;
  11136. }
  11137. catch(e) {if(e===$early)return e[0]; throw e}
  11138. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  11139. },
  11140. args: ["aBlock"],
  11141. 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 ] ]]",
  11142. referencedClasses: ["String"],
  11143. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  11144. }),
  11145. $globals.String);
  11146. $core.addMethod(
  11147. $core.method({
  11148. selector: "lineNumber:",
  11149. protocol: "split join",
  11150. fn: function (anIndex){
  11151. var self=this,$self=this;
  11152. var lineCount;
  11153. return $core.withContext(function($ctx1) {
  11154. var $2,$1;
  11155. var $early={};
  11156. try {
  11157. lineCount=(0);
  11158. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  11159. return $core.withContext(function($ctx2) {
  11160. lineCount=$recv(lineCount).__plus((1));
  11161. $2=lineCount;
  11162. $1=$recv($2).__eq(anIndex);
  11163. if($core.assert($1)){
  11164. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  11165. }
  11166. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  11167. }));
  11168. return nil;
  11169. }
  11170. catch(e) {if(e===$early)return e[0]; throw e}
  11171. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  11172. },
  11173. args: ["anIndex"],
  11174. 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",
  11175. referencedClasses: [],
  11176. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  11177. }),
  11178. $globals.String);
  11179. $core.addMethod(
  11180. $core.method({
  11181. selector: "lines",
  11182. protocol: "split join",
  11183. fn: function (){
  11184. var self=this,$self=this;
  11185. return $core.withContext(function($ctx1) {
  11186. var result = self.split(/\r\n|\r|\n/);
  11187. if (!result[result.length-1]) result.pop();
  11188. return result;;
  11189. return self;
  11190. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  11191. },
  11192. args: [],
  11193. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<inlineJS: '\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a'>",
  11194. referencedClasses: [],
  11195. messageSends: []
  11196. }),
  11197. $globals.String);
  11198. $core.addMethod(
  11199. $core.method({
  11200. selector: "linesDo:",
  11201. protocol: "split join",
  11202. fn: function (aBlock){
  11203. var self=this,$self=this;
  11204. return $core.withContext(function($ctx1) {
  11205. $recv($self._lines())._do_(aBlock);
  11206. return self;
  11207. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  11208. },
  11209. args: ["aBlock"],
  11210. 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 lines do: aBlock",
  11211. referencedClasses: [],
  11212. messageSends: ["do:", "lines"]
  11213. }),
  11214. $globals.String);
  11215. $core.addMethod(
  11216. $core.method({
  11217. selector: "match:",
  11218. protocol: "regular expressions",
  11219. fn: function (aRegexp){
  11220. var self=this,$self=this;
  11221. return $core.withContext(function($ctx1) {
  11222. return self.search(aRegexp) != -1;
  11223. return self;
  11224. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  11225. },
  11226. args: ["aRegexp"],
  11227. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  11228. referencedClasses: [],
  11229. messageSends: []
  11230. }),
  11231. $globals.String);
  11232. $core.addMethod(
  11233. $core.method({
  11234. selector: "matchesOf:",
  11235. protocol: "regular expressions",
  11236. fn: function (aRegularExpression){
  11237. var self=this,$self=this;
  11238. return $core.withContext(function($ctx1) {
  11239. return self.match(aRegularExpression);
  11240. return self;
  11241. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  11242. },
  11243. args: ["aRegularExpression"],
  11244. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  11245. referencedClasses: [],
  11246. messageSends: []
  11247. }),
  11248. $globals.String);
  11249. $core.addMethod(
  11250. $core.method({
  11251. selector: "numericallyIndexable",
  11252. protocol: "private",
  11253. fn: function (){
  11254. var self=this,$self=this;
  11255. return $core.withContext(function($ctx1) {
  11256. return String(self);
  11257. return self;
  11258. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  11259. },
  11260. args: [],
  11261. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  11262. referencedClasses: [],
  11263. messageSends: []
  11264. }),
  11265. $globals.String);
  11266. $core.addMethod(
  11267. $core.method({
  11268. selector: "printNl",
  11269. protocol: "printing",
  11270. fn: function (){
  11271. var self=this,$self=this;
  11272. return $core.withContext(function($ctx1) {
  11273. console.log(self);
  11274. return self;
  11275. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  11276. },
  11277. args: [],
  11278. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  11279. referencedClasses: [],
  11280. messageSends: []
  11281. }),
  11282. $globals.String);
  11283. $core.addMethod(
  11284. $core.method({
  11285. selector: "printOn:",
  11286. protocol: "printing",
  11287. fn: function (aStream){
  11288. var self=this,$self=this;
  11289. return $core.withContext(function($ctx1) {
  11290. $recv(aStream)._nextPutAll_("'");
  11291. $ctx1.sendIdx["nextPutAll:"]=1;
  11292. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  11293. $ctx1.sendIdx["nextPutAll:"]=2;
  11294. $recv(aStream)._nextPutAll_("'");
  11295. return self;
  11296. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  11297. },
  11298. args: ["aStream"],
  11299. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  11300. referencedClasses: [],
  11301. messageSends: ["nextPutAll:", "replace:with:"]
  11302. }),
  11303. $globals.String);
  11304. $core.addMethod(
  11305. $core.method({
  11306. selector: "replace:with:",
  11307. protocol: "regular expressions",
  11308. fn: function (aString,anotherString){
  11309. var self=this,$self=this;
  11310. return $core.withContext(function($ctx1) {
  11311. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  11312. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  11313. },
  11314. args: ["aString", "anotherString"],
  11315. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  11316. referencedClasses: ["RegularExpression"],
  11317. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  11318. }),
  11319. $globals.String);
  11320. $core.addMethod(
  11321. $core.method({
  11322. selector: "replaceRegexp:with:",
  11323. protocol: "regular expressions",
  11324. fn: function (aRegexp,aString){
  11325. var self=this,$self=this;
  11326. return $core.withContext(function($ctx1) {
  11327. return self.replace(aRegexp, aString);
  11328. return self;
  11329. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  11330. },
  11331. args: ["aRegexp", "aString"],
  11332. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  11333. referencedClasses: [],
  11334. messageSends: []
  11335. }),
  11336. $globals.String);
  11337. $core.addMethod(
  11338. $core.method({
  11339. selector: "reversed",
  11340. protocol: "converting",
  11341. fn: function (){
  11342. var self=this,$self=this;
  11343. return $core.withContext(function($ctx1) {
  11344. return self.split("").reverse().join("");
  11345. return self;
  11346. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  11347. },
  11348. args: [],
  11349. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  11350. referencedClasses: [],
  11351. messageSends: []
  11352. }),
  11353. $globals.String);
  11354. $core.addMethod(
  11355. $core.method({
  11356. selector: "shallowCopy",
  11357. protocol: "copying",
  11358. fn: function (){
  11359. var self=this,$self=this;
  11360. return self;
  11361. },
  11362. args: [],
  11363. source: "shallowCopy\x0a\x09^ self",
  11364. referencedClasses: [],
  11365. messageSends: []
  11366. }),
  11367. $globals.String);
  11368. $core.addMethod(
  11369. $core.method({
  11370. selector: "size",
  11371. protocol: "accessing",
  11372. fn: function (){
  11373. var self=this,$self=this;
  11374. return $core.withContext(function($ctx1) {
  11375. return self.length;
  11376. return self;
  11377. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  11378. },
  11379. args: [],
  11380. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  11381. referencedClasses: [],
  11382. messageSends: []
  11383. }),
  11384. $globals.String);
  11385. $core.addMethod(
  11386. $core.method({
  11387. selector: "subStrings:",
  11388. protocol: "split join",
  11389. fn: function (aString){
  11390. var self=this,$self=this;
  11391. return $core.withContext(function($ctx1) {
  11392. return $self._tokenize_(aString);
  11393. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  11394. },
  11395. args: ["aString"],
  11396. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  11397. referencedClasses: [],
  11398. messageSends: ["tokenize:"]
  11399. }),
  11400. $globals.String);
  11401. $core.addMethod(
  11402. $core.method({
  11403. selector: "tokenize:",
  11404. protocol: "split join",
  11405. fn: function (aString){
  11406. var self=this,$self=this;
  11407. return $core.withContext(function($ctx1) {
  11408. return self.split(aString);
  11409. return self;
  11410. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  11411. },
  11412. args: ["aString"],
  11413. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  11414. referencedClasses: [],
  11415. messageSends: []
  11416. }),
  11417. $globals.String);
  11418. $core.addMethod(
  11419. $core.method({
  11420. selector: "trimBoth",
  11421. protocol: "regular expressions",
  11422. fn: function (){
  11423. var self=this,$self=this;
  11424. return $core.withContext(function($ctx1) {
  11425. return $self._trimBoth_("\x5cs");
  11426. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  11427. },
  11428. args: [],
  11429. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  11430. referencedClasses: [],
  11431. messageSends: ["trimBoth:"]
  11432. }),
  11433. $globals.String);
  11434. $core.addMethod(
  11435. $core.method({
  11436. selector: "trimBoth:",
  11437. protocol: "regular expressions",
  11438. fn: function (separators){
  11439. var self=this,$self=this;
  11440. return $core.withContext(function($ctx1) {
  11441. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  11442. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  11443. },
  11444. args: ["separators"],
  11445. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  11446. referencedClasses: [],
  11447. messageSends: ["trimRight:", "trimLeft:"]
  11448. }),
  11449. $globals.String);
  11450. $core.addMethod(
  11451. $core.method({
  11452. selector: "trimLeft",
  11453. protocol: "regular expressions",
  11454. fn: function (){
  11455. var self=this,$self=this;
  11456. return $core.withContext(function($ctx1) {
  11457. return $self._trimLeft_("\x5cs");
  11458. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  11459. },
  11460. args: [],
  11461. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  11462. referencedClasses: [],
  11463. messageSends: ["trimLeft:"]
  11464. }),
  11465. $globals.String);
  11466. $core.addMethod(
  11467. $core.method({
  11468. selector: "trimLeft:",
  11469. protocol: "regular expressions",
  11470. fn: function (separators){
  11471. var self=this,$self=this;
  11472. return $core.withContext(function($ctx1) {
  11473. var $2,$1;
  11474. $2=$recv("^[".__comma(separators)).__comma("]+");
  11475. $ctx1.sendIdx[","]=1;
  11476. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11477. return $self._replaceRegexp_with_($1,"");
  11478. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  11479. },
  11480. args: ["separators"],
  11481. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  11482. referencedClasses: ["RegularExpression"],
  11483. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11484. }),
  11485. $globals.String);
  11486. $core.addMethod(
  11487. $core.method({
  11488. selector: "trimRight",
  11489. protocol: "regular expressions",
  11490. fn: function (){
  11491. var self=this,$self=this;
  11492. return $core.withContext(function($ctx1) {
  11493. return $self._trimRight_("\x5cs");
  11494. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  11495. },
  11496. args: [],
  11497. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  11498. referencedClasses: [],
  11499. messageSends: ["trimRight:"]
  11500. }),
  11501. $globals.String);
  11502. $core.addMethod(
  11503. $core.method({
  11504. selector: "trimRight:",
  11505. protocol: "regular expressions",
  11506. fn: function (separators){
  11507. var self=this,$self=this;
  11508. return $core.withContext(function($ctx1) {
  11509. var $2,$1;
  11510. $2=$recv("[".__comma(separators)).__comma("]+$");
  11511. $ctx1.sendIdx[","]=1;
  11512. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11513. return $self._replaceRegexp_with_($1,"");
  11514. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  11515. },
  11516. args: ["separators"],
  11517. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  11518. referencedClasses: ["RegularExpression"],
  11519. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11520. }),
  11521. $globals.String);
  11522. $core.addMethod(
  11523. $core.method({
  11524. selector: "unescaped",
  11525. protocol: "converting",
  11526. fn: function (){
  11527. var self=this,$self=this;
  11528. return $core.withContext(function($ctx1) {
  11529. return unescape(self);
  11530. return self;
  11531. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  11532. },
  11533. args: [],
  11534. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  11535. referencedClasses: [],
  11536. messageSends: []
  11537. }),
  11538. $globals.String);
  11539. $core.addMethod(
  11540. $core.method({
  11541. selector: "uriComponentDecoded",
  11542. protocol: "converting",
  11543. fn: function (){
  11544. var self=this,$self=this;
  11545. return $core.withContext(function($ctx1) {
  11546. return decodeURIComponent(self);
  11547. return self;
  11548. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  11549. },
  11550. args: [],
  11551. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  11552. referencedClasses: [],
  11553. messageSends: []
  11554. }),
  11555. $globals.String);
  11556. $core.addMethod(
  11557. $core.method({
  11558. selector: "uriComponentEncoded",
  11559. protocol: "converting",
  11560. fn: function (){
  11561. var self=this,$self=this;
  11562. return $core.withContext(function($ctx1) {
  11563. return encodeURIComponent(self);
  11564. return self;
  11565. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  11566. },
  11567. args: [],
  11568. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  11569. referencedClasses: [],
  11570. messageSends: []
  11571. }),
  11572. $globals.String);
  11573. $core.addMethod(
  11574. $core.method({
  11575. selector: "uriDecoded",
  11576. protocol: "converting",
  11577. fn: function (){
  11578. var self=this,$self=this;
  11579. return $core.withContext(function($ctx1) {
  11580. return decodeURI(self);
  11581. return self;
  11582. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  11583. },
  11584. args: [],
  11585. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  11586. referencedClasses: [],
  11587. messageSends: []
  11588. }),
  11589. $globals.String);
  11590. $core.addMethod(
  11591. $core.method({
  11592. selector: "uriEncoded",
  11593. protocol: "converting",
  11594. fn: function (){
  11595. var self=this,$self=this;
  11596. return $core.withContext(function($ctx1) {
  11597. return encodeURI(self);
  11598. return self;
  11599. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  11600. },
  11601. args: [],
  11602. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  11603. referencedClasses: [],
  11604. messageSends: []
  11605. }),
  11606. $globals.String);
  11607. $core.addMethod(
  11608. $core.method({
  11609. selector: "value:",
  11610. protocol: "evaluating",
  11611. fn: function (anObject){
  11612. var self=this,$self=this;
  11613. return $core.withContext(function($ctx1) {
  11614. return $recv(anObject)._perform_(self);
  11615. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  11616. },
  11617. args: ["anObject"],
  11618. source: "value: anObject \x0a\x09^ anObject perform: self",
  11619. referencedClasses: [],
  11620. messageSends: ["perform:"]
  11621. }),
  11622. $globals.String);
  11623. $core.addMethod(
  11624. $core.method({
  11625. selector: "cr",
  11626. protocol: "accessing",
  11627. fn: function (){
  11628. var self=this,$self=this;
  11629. return $core.withContext(function($ctx1) {
  11630. return "\r";
  11631. return self;
  11632. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  11633. },
  11634. args: [],
  11635. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  11636. referencedClasses: [],
  11637. messageSends: []
  11638. }),
  11639. $globals.String.a$cls);
  11640. $core.addMethod(
  11641. $core.method({
  11642. selector: "crlf",
  11643. protocol: "accessing",
  11644. fn: function (){
  11645. var self=this,$self=this;
  11646. return $core.withContext(function($ctx1) {
  11647. return "\r\n";
  11648. return self;
  11649. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  11650. },
  11651. args: [],
  11652. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  11653. referencedClasses: [],
  11654. messageSends: []
  11655. }),
  11656. $globals.String.a$cls);
  11657. $core.addMethod(
  11658. $core.method({
  11659. selector: "esc",
  11660. protocol: "accessing",
  11661. fn: function (){
  11662. var self=this,$self=this;
  11663. return $core.withContext(function($ctx1) {
  11664. return $self._fromCharCode_((27));
  11665. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  11666. },
  11667. args: [],
  11668. source: "esc\x0a\x09^ self fromCharCode: 27",
  11669. referencedClasses: [],
  11670. messageSends: ["fromCharCode:"]
  11671. }),
  11672. $globals.String.a$cls);
  11673. $core.addMethod(
  11674. $core.method({
  11675. selector: "fromCharCode:",
  11676. protocol: "instance creation",
  11677. fn: function (anInteger){
  11678. var self=this,$self=this;
  11679. return $core.withContext(function($ctx1) {
  11680. return String.fromCharCode(anInteger);
  11681. return self;
  11682. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  11683. },
  11684. args: ["anInteger"],
  11685. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  11686. referencedClasses: [],
  11687. messageSends: []
  11688. }),
  11689. $globals.String.a$cls);
  11690. $core.addMethod(
  11691. $core.method({
  11692. selector: "fromString:",
  11693. protocol: "instance creation",
  11694. fn: function (aString){
  11695. var self=this,$self=this;
  11696. return $core.withContext(function($ctx1) {
  11697. return String(aString);
  11698. return self;
  11699. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  11700. },
  11701. args: ["aString"],
  11702. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  11703. referencedClasses: [],
  11704. messageSends: []
  11705. }),
  11706. $globals.String.a$cls);
  11707. $core.addMethod(
  11708. $core.method({
  11709. selector: "lf",
  11710. protocol: "accessing",
  11711. fn: function (){
  11712. var self=this,$self=this;
  11713. return $core.withContext(function($ctx1) {
  11714. return "\n";
  11715. return self;
  11716. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  11717. },
  11718. args: [],
  11719. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  11720. referencedClasses: [],
  11721. messageSends: []
  11722. }),
  11723. $globals.String.a$cls);
  11724. $core.addMethod(
  11725. $core.method({
  11726. selector: "random",
  11727. protocol: "random",
  11728. fn: function (){
  11729. var self=this,$self=this;
  11730. return $core.withContext(function($ctx1) {
  11731. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  11732. return self;
  11733. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  11734. },
  11735. args: [],
  11736. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  11737. referencedClasses: [],
  11738. messageSends: []
  11739. }),
  11740. $globals.String.a$cls);
  11741. $core.addMethod(
  11742. $core.method({
  11743. selector: "randomNotIn:",
  11744. protocol: "random",
  11745. fn: function (aString){
  11746. var self=this,$self=this;
  11747. var result;
  11748. return $core.withContext(function($ctx1) {
  11749. $recv((function(){
  11750. return $core.withContext(function($ctx2) {
  11751. result=$self._random();
  11752. result;
  11753. return $recv(aString)._includesSubString_(result);
  11754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11755. }))._whileTrue();
  11756. return result;
  11757. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  11758. },
  11759. args: ["aString"],
  11760. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  11761. referencedClasses: [],
  11762. messageSends: ["whileTrue", "random", "includesSubString:"]
  11763. }),
  11764. $globals.String.a$cls);
  11765. $core.addMethod(
  11766. $core.method({
  11767. selector: "space",
  11768. protocol: "accessing",
  11769. fn: function (){
  11770. var self=this,$self=this;
  11771. return $core.withContext(function($ctx1) {
  11772. return " ";
  11773. return self;
  11774. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  11775. },
  11776. args: [],
  11777. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  11778. referencedClasses: [],
  11779. messageSends: []
  11780. }),
  11781. $globals.String.a$cls);
  11782. $core.addMethod(
  11783. $core.method({
  11784. selector: "streamClass",
  11785. protocol: "accessing",
  11786. fn: function (){
  11787. var self=this,$self=this;
  11788. return $globals.StringStream;
  11789. },
  11790. args: [],
  11791. source: "streamClass\x0a\x09\x09^ StringStream",
  11792. referencedClasses: ["StringStream"],
  11793. messageSends: []
  11794. }),
  11795. $globals.String.a$cls);
  11796. $core.addMethod(
  11797. $core.method({
  11798. selector: "tab",
  11799. protocol: "accessing",
  11800. fn: function (){
  11801. var self=this,$self=this;
  11802. return $core.withContext(function($ctx1) {
  11803. return "\t";
  11804. return self;
  11805. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  11806. },
  11807. args: [],
  11808. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  11809. referencedClasses: [],
  11810. messageSends: []
  11811. }),
  11812. $globals.String.a$cls);
  11813. $core.addMethod(
  11814. $core.method({
  11815. selector: "value:",
  11816. protocol: "instance creation",
  11817. fn: function (aUTFCharCode){
  11818. var self=this,$self=this;
  11819. return $core.withContext(function($ctx1) {
  11820. return String.fromCharCode(aUTFCharCode);;
  11821. return self;
  11822. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  11823. },
  11824. args: ["aUTFCharCode"],
  11825. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  11826. referencedClasses: [],
  11827. messageSends: []
  11828. }),
  11829. $globals.String.a$cls);
  11830. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  11831. $globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`.";
  11832. $core.addMethod(
  11833. $core.method({
  11834. selector: "=",
  11835. protocol: "comparing",
  11836. fn: function (aCollection){
  11837. var self=this,$self=this;
  11838. return $core.withContext(function($ctx1) {
  11839. var $2,$1,$4,$3,$5;
  11840. var $early={};
  11841. try {
  11842. $2=$self._class();
  11843. $ctx1.sendIdx["class"]=1;
  11844. $1=$recv($2).__eq($recv(aCollection)._class());
  11845. $ctx1.sendIdx["="]=1;
  11846. if(!$core.assert($1)){
  11847. return false;
  11848. }
  11849. $4=$self._size();
  11850. $ctx1.sendIdx["size"]=1;
  11851. $3=$recv($4).__eq($recv(aCollection)._size());
  11852. if(!$core.assert($3)){
  11853. return false;
  11854. }
  11855. $self._do_((function(each){
  11856. return $core.withContext(function($ctx2) {
  11857. $5=$recv(aCollection)._includes_(each);
  11858. if(!$core.assert($5)){
  11859. throw $early=[false];
  11860. }
  11861. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  11862. }));
  11863. return true;
  11864. }
  11865. catch(e) {if(e===$early)return e[0]; throw e}
  11866. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  11867. },
  11868. args: ["aCollection"],
  11869. 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",
  11870. referencedClasses: [],
  11871. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  11872. }),
  11873. $globals.Set);
  11874. $core.addMethod(
  11875. $core.method({
  11876. selector: "add:",
  11877. protocol: "adding/removing",
  11878. fn: function (anObject){
  11879. var self=this,$self=this;
  11880. var bucket;
  11881. return $core.withContext(function($ctx1) {
  11882. var $1,$receiver;
  11883. bucket=$self._bucketsOfElement_(anObject);
  11884. $1=$recv(bucket)._second();
  11885. if(($receiver = $1) == null || $receiver.a$nil){
  11886. var object,slowBucket;
  11887. object=$recv(bucket)._first();
  11888. $ctx1.sendIdx["first"]=1;
  11889. object;
  11890. slowBucket=$recv(bucket)._third();
  11891. slowBucket;
  11892. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  11893. return $core.withContext(function($ctx2) {
  11894. $recv(slowBucket)._add_(object);
  11895. $self["@size"]=$recv($self["@size"]).__plus((1));
  11896. return $self["@size"];
  11897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11898. }));
  11899. return object;
  11900. } else {
  11901. var primitiveBucket;
  11902. primitiveBucket=$receiver;
  11903. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  11904. }
  11905. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  11906. },
  11907. args: ["anObject"],
  11908. source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]",
  11909. referencedClasses: [],
  11910. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  11911. }),
  11912. $globals.Set);
  11913. $core.addMethod(
  11914. $core.method({
  11915. selector: "add:in:",
  11916. protocol: "private",
  11917. fn: function (anObject,anotherObject){
  11918. var self=this,$self=this;
  11919. return $core.withContext(function($ctx1) {
  11920. if (anObject in anotherObject.store) { return false; }
  11921. $self['@size']++;
  11922. anotherObject.store[anObject] = true;
  11923. return anObject;
  11924. ;
  11925. return self;
  11926. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  11927. },
  11928. args: ["anObject", "anotherObject"],
  11929. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09$self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  11930. referencedClasses: [],
  11931. messageSends: []
  11932. }),
  11933. $globals.Set);
  11934. $core.addMethod(
  11935. $core.method({
  11936. selector: "bucketsOfElement:",
  11937. protocol: "private",
  11938. fn: function (anObject){
  11939. var self=this,$self=this;
  11940. return $core.withContext(function($ctx1) {
  11941. // include nil to well-known objects under "boolean" fastBucket
  11942. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  11943. var prim = anObject.valueOf();
  11944. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  11945. var bucket = null;
  11946. $self['@slowBucketStores'].some(function (store) {
  11947. return bucket = store._bucketOfElement_(anObject);
  11948. });
  11949. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  11950. }
  11951. return [ prim, $self['@fastBuckets'][typeof prim] ];
  11952. ;
  11953. return self;
  11954. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  11955. },
  11956. args: ["anObject"],
  11957. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) return [ null, $self[''@fastBuckets''].boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !$self[''@fastBuckets''][typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09$self[''@slowBucketStores''].some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || $self[''@defaultBucket''] ];\x0a\x09\x09}\x0a\x09\x09return [ prim, $self[''@fastBuckets''][typeof prim] ];\x0a\x09'>",
  11958. referencedClasses: [],
  11959. messageSends: []
  11960. }),
  11961. $globals.Set);
  11962. $core.addMethod(
  11963. $core.method({
  11964. selector: "classNameOf:",
  11965. protocol: "private",
  11966. fn: function (anObject){
  11967. var self=this,$self=this;
  11968. return $core.withContext(function($ctx1) {
  11969. return anObject.a$cls != null && anObject.a$cls.className;
  11970. return self;
  11971. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  11972. },
  11973. args: ["anObject"],
  11974. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null && anObject.a$cls.className'>",
  11975. referencedClasses: [],
  11976. messageSends: []
  11977. }),
  11978. $globals.Set);
  11979. $core.addMethod(
  11980. $core.method({
  11981. selector: "collect:",
  11982. protocol: "enumerating",
  11983. fn: function (aBlock){
  11984. var self=this,$self=this;
  11985. var collection;
  11986. return $core.withContext(function($ctx1) {
  11987. collection=$recv($self._class())._new();
  11988. $self._do_((function(each){
  11989. return $core.withContext(function($ctx2) {
  11990. return $recv(collection)._add_($recv(aBlock)._value_(each));
  11991. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11992. }));
  11993. return collection;
  11994. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  11995. },
  11996. args: ["aBlock"],
  11997. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  11998. referencedClasses: [],
  11999. messageSends: ["new", "class", "do:", "add:", "value:"]
  12000. }),
  12001. $globals.Set);
  12002. $core.addMethod(
  12003. $core.method({
  12004. selector: "detect:ifNone:",
  12005. protocol: "enumerating",
  12006. fn: function (aBlock,anotherBlock){
  12007. var self=this,$self=this;
  12008. return $core.withContext(function($ctx1) {
  12009. var $1;
  12010. var $early={};
  12011. try {
  12012. $self._do_((function(each){
  12013. return $core.withContext(function($ctx2) {
  12014. $1=$recv(aBlock)._value_(each);
  12015. if($core.assert($1)){
  12016. throw $early=[each];
  12017. }
  12018. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12019. }));
  12020. return $recv(anotherBlock)._value();
  12021. }
  12022. catch(e) {if(e===$early)return e[0]; throw e}
  12023. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  12024. },
  12025. args: ["aBlock", "anotherBlock"],
  12026. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  12027. referencedClasses: [],
  12028. messageSends: ["do:", "ifTrue:", "value:", "value"]
  12029. }),
  12030. $globals.Set);
  12031. $core.addMethod(
  12032. $core.method({
  12033. selector: "do:",
  12034. protocol: "enumerating",
  12035. fn: function (aBlock){
  12036. var self=this,$self=this;
  12037. return $core.withContext(function($ctx1) {
  12038. var el, keys, i;
  12039. el = $self['@fastBuckets'];
  12040. keys = Object.keys(el);
  12041. for (i = 0; i < keys.length; ++i) {
  12042. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12043. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12044. else { store._do_(aBlock); }
  12045. }
  12046. el = $self['@slowBucketStores'];
  12047. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12048. $self['@defaultBucket']._do_(aBlock);
  12049. ;
  12050. return self;
  12051. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  12052. },
  12053. args: ["aBlock"],
  12054. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = $self[''@fastBuckets''];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = $self[''@slowBucketStores''];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09$self[''@defaultBucket'']._do_(aBlock);\x0a\x09'>",
  12055. referencedClasses: [],
  12056. messageSends: []
  12057. }),
  12058. $globals.Set);
  12059. $core.addMethod(
  12060. $core.method({
  12061. selector: "includes:",
  12062. protocol: "testing",
  12063. fn: function (anObject){
  12064. var self=this,$self=this;
  12065. var bucket;
  12066. return $core.withContext(function($ctx1) {
  12067. var $1,$2,$3,$receiver;
  12068. bucket=$self._bucketsOfElement_(anObject);
  12069. $1=$recv(bucket)._second();
  12070. if(($receiver = $1) == null || $receiver.a$nil){
  12071. $2=$recv(bucket)._third();
  12072. $3=$recv(bucket)._first();
  12073. $ctx1.sendIdx["first"]=1;
  12074. return $recv($2)._includes_($3);
  12075. } else {
  12076. var primitiveBucket;
  12077. primitiveBucket=$receiver;
  12078. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  12079. }
  12080. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12081. },
  12082. args: ["anObject"],
  12083. source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]",
  12084. referencedClasses: [],
  12085. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  12086. }),
  12087. $globals.Set);
  12088. $core.addMethod(
  12089. $core.method({
  12090. selector: "includes:in:",
  12091. protocol: "private",
  12092. fn: function (anObject,anotherObject){
  12093. var self=this,$self=this;
  12094. return $core.withContext(function($ctx1) {
  12095. return anObject in anotherObject.store;
  12096. return self;
  12097. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12098. },
  12099. args: ["anObject", "anotherObject"],
  12100. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  12101. referencedClasses: [],
  12102. messageSends: []
  12103. }),
  12104. $globals.Set);
  12105. $core.addMethod(
  12106. $core.method({
  12107. selector: "initialize",
  12108. protocol: "initialization",
  12109. fn: function (){
  12110. var self=this,$self=this;
  12111. return $core.withContext(function($ctx1) {
  12112. (
  12113. $ctx1.supercall = true,
  12114. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  12115. $ctx1.supercall = false;
  12116. $self["@defaultBucket"]=[];
  12117. $self._initializeSlowBucketStores();
  12118. $self._removeAll();
  12119. return self;
  12120. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  12121. },
  12122. args: [],
  12123. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  12124. referencedClasses: [],
  12125. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  12126. }),
  12127. $globals.Set);
  12128. $core.addMethod(
  12129. $core.method({
  12130. selector: "initializeSlowBucketStores",
  12131. protocol: "initialization",
  12132. fn: function (){
  12133. var self=this,$self=this;
  12134. return $core.withContext(function($ctx1) {
  12135. var $1;
  12136. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12137. return $core.withContext(function($ctx2) {
  12138. return $self._classNameOf_(x);
  12139. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  12140. }));
  12141. $ctx1.sendIdx["hashBlock:"]=1;
  12142. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12143. return $core.withContext(function($ctx2) {
  12144. return $self._jsConstructorNameOf_(x);
  12145. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  12146. }))];
  12147. return self;
  12148. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  12149. },
  12150. args: [],
  12151. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  12152. referencedClasses: ["ArrayBucketStore"],
  12153. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  12154. }),
  12155. $globals.Set);
  12156. $core.addMethod(
  12157. $core.method({
  12158. selector: "jsConstructorNameOf:",
  12159. protocol: "private",
  12160. fn: function (anObject){
  12161. var self=this,$self=this;
  12162. return $core.withContext(function($ctx1) {
  12163. return anObject.constructor && anObject.constructor.name;
  12164. return self;
  12165. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  12166. },
  12167. args: ["anObject"],
  12168. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  12169. referencedClasses: [],
  12170. messageSends: []
  12171. }),
  12172. $globals.Set);
  12173. $core.addMethod(
  12174. $core.method({
  12175. selector: "printOn:",
  12176. protocol: "printing",
  12177. fn: function (aStream){
  12178. var self=this,$self=this;
  12179. return $core.withContext(function($ctx1) {
  12180. (
  12181. $ctx1.supercall = true,
  12182. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  12183. $ctx1.supercall = false;
  12184. $ctx1.sendIdx["printOn:"]=1;
  12185. $recv(aStream)._nextPutAll_(" (");
  12186. $ctx1.sendIdx["nextPutAll:"]=1;
  12187. $self._do_separatedBy_((function(each){
  12188. return $core.withContext(function($ctx2) {
  12189. return $recv(each)._printOn_(aStream);
  12190. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12191. }),(function(){
  12192. return $core.withContext(function($ctx2) {
  12193. return $recv(aStream)._nextPutAll_(" ");
  12194. $ctx2.sendIdx["nextPutAll:"]=2;
  12195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12196. }));
  12197. $recv(aStream)._nextPutAll_(")");
  12198. return self;
  12199. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  12200. },
  12201. args: ["aStream"],
  12202. 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: ')'",
  12203. referencedClasses: [],
  12204. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  12205. }),
  12206. $globals.Set);
  12207. $core.addMethod(
  12208. $core.method({
  12209. selector: "remove:ifAbsent:",
  12210. protocol: "adding/removing",
  12211. fn: function (anObject,aBlock){
  12212. var self=this,$self=this;
  12213. var bucket;
  12214. return $core.withContext(function($ctx1) {
  12215. var $1,$2,$3,$receiver;
  12216. var $early={};
  12217. try {
  12218. bucket=$self._bucketsOfElement_(anObject);
  12219. $1=$recv(bucket)._second();
  12220. if(($receiver = $1) == null || $receiver.a$nil){
  12221. $2=$recv(bucket)._third();
  12222. $3=$recv(bucket)._first();
  12223. $ctx1.sendIdx["first"]=1;
  12224. $recv($2)._remove_ifAbsent_($3,(function(){
  12225. return $core.withContext(function($ctx2) {
  12226. throw $early=[$recv(aBlock)._value()];
  12227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12228. }));
  12229. $self["@size"]=$recv($self["@size"]).__minus((1));
  12230. return $self["@size"];
  12231. } else {
  12232. var primitiveBucket;
  12233. primitiveBucket=$receiver;
  12234. return $self._remove_in_($recv(bucket)._first(),primitiveBucket);
  12235. }
  12236. }
  12237. catch(e) {if(e===$early)return e[0]; throw e}
  12238. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  12239. },
  12240. args: ["anObject", "aBlock"],
  12241. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
  12242. referencedClasses: [],
  12243. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  12244. }),
  12245. $globals.Set);
  12246. $core.addMethod(
  12247. $core.method({
  12248. selector: "remove:in:",
  12249. protocol: "private",
  12250. fn: function (anObject,anotherObject){
  12251. var self=this,$self=this;
  12252. return $core.withContext(function($ctx1) {
  12253. if (delete anotherObject.store[anObject]) $self['@size']--;
  12254. return self;
  12255. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12256. },
  12257. args: ["anObject", "anotherObject"],
  12258. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (delete anotherObject.store[anObject]) $self[''@size'']--'>",
  12259. referencedClasses: [],
  12260. messageSends: []
  12261. }),
  12262. $globals.Set);
  12263. $core.addMethod(
  12264. $core.method({
  12265. selector: "removeAll",
  12266. protocol: "adding/removing",
  12267. fn: function (){
  12268. var self=this,$self=this;
  12269. return $core.withContext(function($ctx1) {
  12270. $self['@fastBuckets'] = {
  12271. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  12272. "number": { store: Object.create(null), fn: Number },
  12273. "string": { store: Object.create(null) }
  12274. };
  12275. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  12276. $self['@defaultBucket']._removeAll();
  12277. $self['@size'] = 0;
  12278. ;
  12279. return self;
  12280. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  12281. },
  12282. args: [],
  12283. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09$self[''@fastBuckets''] = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self[''@slowBucketStores''].forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self[''@defaultBucket'']._removeAll();\x0a\x09\x09$self[''@size''] = 0;\x0a\x09'>",
  12284. referencedClasses: [],
  12285. messageSends: []
  12286. }),
  12287. $globals.Set);
  12288. $core.addMethod(
  12289. $core.method({
  12290. selector: "select:",
  12291. protocol: "enumerating",
  12292. fn: function (aBlock){
  12293. var self=this,$self=this;
  12294. var collection;
  12295. return $core.withContext(function($ctx1) {
  12296. var $1;
  12297. collection=$recv($self._class())._new();
  12298. $self._do_((function(each){
  12299. return $core.withContext(function($ctx2) {
  12300. $1=$recv(aBlock)._value_(each);
  12301. if($core.assert($1)){
  12302. return $recv(collection)._add_(each);
  12303. }
  12304. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12305. }));
  12306. return collection;
  12307. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12308. },
  12309. args: ["aBlock"],
  12310. 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",
  12311. referencedClasses: [],
  12312. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12313. }),
  12314. $globals.Set);
  12315. $core.addMethod(
  12316. $core.method({
  12317. selector: "select:thenCollect:",
  12318. protocol: "enumerating",
  12319. fn: function (selectBlock,collectBlock){
  12320. var self=this,$self=this;
  12321. var collection;
  12322. return $core.withContext(function($ctx1) {
  12323. var $1;
  12324. collection=$recv($self._class())._new();
  12325. $self._do_((function(each){
  12326. return $core.withContext(function($ctx2) {
  12327. $1=$recv(selectBlock)._value_(each);
  12328. $ctx2.sendIdx["value:"]=1;
  12329. if($core.assert($1)){
  12330. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  12331. }
  12332. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12333. }));
  12334. return collection;
  12335. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  12336. },
  12337. args: ["selectBlock", "collectBlock"],
  12338. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: (collectBlock value: each) ] ].\x0a\x09^ collection",
  12339. referencedClasses: [],
  12340. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12341. }),
  12342. $globals.Set);
  12343. $core.addMethod(
  12344. $core.method({
  12345. selector: "size",
  12346. protocol: "accessing",
  12347. fn: function (){
  12348. var self=this,$self=this;
  12349. return $self["@size"];
  12350. },
  12351. args: [],
  12352. source: "size\x0a\x09^ size",
  12353. referencedClasses: [],
  12354. messageSends: []
  12355. }),
  12356. $globals.Set);
  12357. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  12358. $globals.ProtoStream.comment="I am the abstract base for different accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams modifying the contents.";
  12359. $core.addMethod(
  12360. $core.method({
  12361. selector: "<<",
  12362. protocol: "writing",
  12363. fn: function (anObject){
  12364. var self=this,$self=this;
  12365. return $core.withContext(function($ctx1) {
  12366. $self._write_(anObject);
  12367. return self;
  12368. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  12369. },
  12370. args: ["anObject"],
  12371. source: "<< anObject\x0a\x09self write: anObject",
  12372. referencedClasses: [],
  12373. messageSends: ["write:"]
  12374. }),
  12375. $globals.ProtoStream);
  12376. $core.addMethod(
  12377. $core.method({
  12378. selector: "atEnd",
  12379. protocol: "testing",
  12380. fn: function (){
  12381. var self=this,$self=this;
  12382. return $core.withContext(function($ctx1) {
  12383. $self._subclassResponsibility();
  12384. return self;
  12385. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  12386. },
  12387. args: [],
  12388. source: "atEnd\x0a\x09self subclassResponsibility",
  12389. referencedClasses: [],
  12390. messageSends: ["subclassResponsibility"]
  12391. }),
  12392. $globals.ProtoStream);
  12393. $core.addMethod(
  12394. $core.method({
  12395. selector: "atStart",
  12396. protocol: "testing",
  12397. fn: function (){
  12398. var self=this,$self=this;
  12399. return $core.withContext(function($ctx1) {
  12400. $self._subclassResponsibility();
  12401. return self;
  12402. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  12403. },
  12404. args: [],
  12405. source: "atStart\x0a\x09self subclassResponsibility",
  12406. referencedClasses: [],
  12407. messageSends: ["subclassResponsibility"]
  12408. }),
  12409. $globals.ProtoStream);
  12410. $core.addMethod(
  12411. $core.method({
  12412. selector: "contents",
  12413. protocol: "accessing",
  12414. fn: function (){
  12415. var self=this,$self=this;
  12416. return $core.withContext(function($ctx1) {
  12417. $self._subclassResponsibility();
  12418. return self;
  12419. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  12420. },
  12421. args: [],
  12422. source: "contents\x0a\x09self subclassResponsibility",
  12423. referencedClasses: [],
  12424. messageSends: ["subclassResponsibility"]
  12425. }),
  12426. $globals.ProtoStream);
  12427. $core.addMethod(
  12428. $core.method({
  12429. selector: "do:",
  12430. protocol: "enumerating",
  12431. fn: function (aBlock){
  12432. var self=this,$self=this;
  12433. return $core.withContext(function($ctx1) {
  12434. $recv((function(){
  12435. return $core.withContext(function($ctx2) {
  12436. return $self._atEnd();
  12437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12438. }))._whileFalse_((function(){
  12439. return $core.withContext(function($ctx2) {
  12440. return $recv(aBlock)._value_($self._next());
  12441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12442. }));
  12443. return self;
  12444. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  12445. },
  12446. args: ["aBlock"],
  12447. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  12448. referencedClasses: [],
  12449. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  12450. }),
  12451. $globals.ProtoStream);
  12452. $core.addMethod(
  12453. $core.method({
  12454. selector: "isEmpty",
  12455. protocol: "testing",
  12456. fn: function (){
  12457. var self=this,$self=this;
  12458. return $core.withContext(function($ctx1) {
  12459. return $recv($self._atStart())._and_((function(){
  12460. return $core.withContext(function($ctx2) {
  12461. return $self._atEnd();
  12462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12463. }));
  12464. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  12465. },
  12466. args: [],
  12467. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  12468. referencedClasses: [],
  12469. messageSends: ["and:", "atStart", "atEnd"]
  12470. }),
  12471. $globals.ProtoStream);
  12472. $core.addMethod(
  12473. $core.method({
  12474. selector: "next",
  12475. protocol: "reading",
  12476. fn: function (){
  12477. var self=this,$self=this;
  12478. return $core.withContext(function($ctx1) {
  12479. var $1;
  12480. $1=$self._atEnd();
  12481. if($core.assert($1)){
  12482. return nil;
  12483. } else {
  12484. return $self._subclassResponsibility();
  12485. }
  12486. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  12487. },
  12488. args: [],
  12489. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12490. referencedClasses: [],
  12491. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12492. }),
  12493. $globals.ProtoStream);
  12494. $core.addMethod(
  12495. $core.method({
  12496. selector: "nextPut:",
  12497. protocol: "writing",
  12498. fn: function (anObject){
  12499. var self=this,$self=this;
  12500. return $core.withContext(function($ctx1) {
  12501. $self._subclassResponsibility();
  12502. return self;
  12503. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  12504. },
  12505. args: ["anObject"],
  12506. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  12507. referencedClasses: [],
  12508. messageSends: ["subclassResponsibility"]
  12509. }),
  12510. $globals.ProtoStream);
  12511. $core.addMethod(
  12512. $core.method({
  12513. selector: "nextPutAll:",
  12514. protocol: "writing",
  12515. fn: function (aCollection){
  12516. var self=this,$self=this;
  12517. return $core.withContext(function($ctx1) {
  12518. $recv(aCollection)._do_((function(each){
  12519. return $core.withContext(function($ctx2) {
  12520. return $self._nextPut_(each);
  12521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12522. }));
  12523. return self;
  12524. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  12525. },
  12526. args: ["aCollection"],
  12527. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  12528. referencedClasses: [],
  12529. messageSends: ["do:", "nextPut:"]
  12530. }),
  12531. $globals.ProtoStream);
  12532. $core.addMethod(
  12533. $core.method({
  12534. selector: "nextPutString:",
  12535. protocol: "writing",
  12536. fn: function (aString){
  12537. var self=this,$self=this;
  12538. return $core.withContext(function($ctx1) {
  12539. $self._nextPut_(aString);
  12540. return self;
  12541. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  12542. },
  12543. args: ["aString"],
  12544. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  12545. referencedClasses: [],
  12546. messageSends: ["nextPut:"]
  12547. }),
  12548. $globals.ProtoStream);
  12549. $core.addMethod(
  12550. $core.method({
  12551. selector: "peek",
  12552. protocol: "reading",
  12553. fn: function (){
  12554. var self=this,$self=this;
  12555. return $core.withContext(function($ctx1) {
  12556. var $1;
  12557. $1=$self._atEnd();
  12558. if($core.assert($1)){
  12559. return nil;
  12560. } else {
  12561. return $self._subclassResponsibility();
  12562. }
  12563. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  12564. },
  12565. args: [],
  12566. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12567. referencedClasses: [],
  12568. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12569. }),
  12570. $globals.ProtoStream);
  12571. $core.addMethod(
  12572. $core.method({
  12573. selector: "reset",
  12574. protocol: "actions",
  12575. fn: function (){
  12576. var self=this,$self=this;
  12577. return $core.withContext(function($ctx1) {
  12578. $self._subclassResponsibility();
  12579. return self;
  12580. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  12581. },
  12582. args: [],
  12583. source: "reset\x0a\x09self subclassResponsibility",
  12584. referencedClasses: [],
  12585. messageSends: ["subclassResponsibility"]
  12586. }),
  12587. $globals.ProtoStream);
  12588. $core.addMethod(
  12589. $core.method({
  12590. selector: "resetContents",
  12591. protocol: "actions",
  12592. fn: function (){
  12593. var self=this,$self=this;
  12594. return $core.withContext(function($ctx1) {
  12595. $self._subclassResponsibility();
  12596. return self;
  12597. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  12598. },
  12599. args: [],
  12600. source: "resetContents\x0a\x09self subclassResponsibility",
  12601. referencedClasses: [],
  12602. messageSends: ["subclassResponsibility"]
  12603. }),
  12604. $globals.ProtoStream);
  12605. $core.addMethod(
  12606. $core.method({
  12607. selector: "setToEnd",
  12608. protocol: "positioning",
  12609. fn: function (){
  12610. var self=this,$self=this;
  12611. return $core.withContext(function($ctx1) {
  12612. $self._subclassResponsibility();
  12613. return self;
  12614. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  12615. },
  12616. args: [],
  12617. source: "setToEnd\x0a\x09self subclassResponsibility",
  12618. referencedClasses: [],
  12619. messageSends: ["subclassResponsibility"]
  12620. }),
  12621. $globals.ProtoStream);
  12622. $core.addMethod(
  12623. $core.method({
  12624. selector: "setToStart",
  12625. protocol: "positioning",
  12626. fn: function (){
  12627. var self=this,$self=this;
  12628. return $core.withContext(function($ctx1) {
  12629. $self._reset();
  12630. return self;
  12631. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  12632. },
  12633. args: [],
  12634. source: "setToStart\x0a\x09self reset",
  12635. referencedClasses: [],
  12636. messageSends: ["reset"]
  12637. }),
  12638. $globals.ProtoStream);
  12639. $core.addMethod(
  12640. $core.method({
  12641. selector: "write:",
  12642. protocol: "writing",
  12643. fn: function (anObject){
  12644. var self=this,$self=this;
  12645. return $core.withContext(function($ctx1) {
  12646. $recv(anObject)._putOn_(self);
  12647. return self;
  12648. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  12649. },
  12650. args: ["anObject"],
  12651. source: "write: anObject\x0a\x09anObject putOn: self",
  12652. referencedClasses: [],
  12653. messageSends: ["putOn:"]
  12654. }),
  12655. $globals.ProtoStream);
  12656. $core.addMethod(
  12657. $core.method({
  12658. selector: "on:",
  12659. protocol: "instance creation",
  12660. fn: function (aCollection){
  12661. var self=this,$self=this;
  12662. return $core.withContext(function($ctx1) {
  12663. var $1;
  12664. $1=$self._new();
  12665. $recv($1)._setCollection_(aCollection);
  12666. $recv($1)._setStreamSize_($recv(aCollection)._size());
  12667. return $recv($1)._yourself();
  12668. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  12669. },
  12670. args: ["aCollection"],
  12671. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  12672. referencedClasses: [],
  12673. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  12674. }),
  12675. $globals.ProtoStream.a$cls);
  12676. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  12677. $globals.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.";
  12678. $core.addMethod(
  12679. $core.method({
  12680. selector: "atEnd",
  12681. protocol: "testing",
  12682. fn: function (){
  12683. var self=this,$self=this;
  12684. return $core.withContext(function($ctx1) {
  12685. return $recv($self._position()).__eq($self._size());
  12686. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  12687. },
  12688. args: [],
  12689. source: "atEnd\x0a\x09^ self position = self size",
  12690. referencedClasses: [],
  12691. messageSends: ["=", "position", "size"]
  12692. }),
  12693. $globals.Stream);
  12694. $core.addMethod(
  12695. $core.method({
  12696. selector: "atStart",
  12697. protocol: "testing",
  12698. fn: function (){
  12699. var self=this,$self=this;
  12700. return $core.withContext(function($ctx1) {
  12701. return $recv($self._position()).__eq((0));
  12702. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  12703. },
  12704. args: [],
  12705. source: "atStart\x0a\x09^ self position = 0",
  12706. referencedClasses: [],
  12707. messageSends: ["=", "position"]
  12708. }),
  12709. $globals.Stream);
  12710. $core.addMethod(
  12711. $core.method({
  12712. selector: "close",
  12713. protocol: "actions",
  12714. fn: function (){
  12715. var self=this,$self=this;
  12716. return self;
  12717. },
  12718. args: [],
  12719. source: "close",
  12720. referencedClasses: [],
  12721. messageSends: []
  12722. }),
  12723. $globals.Stream);
  12724. $core.addMethod(
  12725. $core.method({
  12726. selector: "collection",
  12727. protocol: "accessing",
  12728. fn: function (){
  12729. var self=this,$self=this;
  12730. return $self["@collection"];
  12731. },
  12732. args: [],
  12733. source: "collection\x0a\x09^ collection",
  12734. referencedClasses: [],
  12735. messageSends: []
  12736. }),
  12737. $globals.Stream);
  12738. $core.addMethod(
  12739. $core.method({
  12740. selector: "contents",
  12741. protocol: "accessing",
  12742. fn: function (){
  12743. var self=this,$self=this;
  12744. return $core.withContext(function($ctx1) {
  12745. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  12746. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  12747. },
  12748. args: [],
  12749. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  12750. referencedClasses: [],
  12751. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  12752. }),
  12753. $globals.Stream);
  12754. $core.addMethod(
  12755. $core.method({
  12756. selector: "flush",
  12757. protocol: "actions",
  12758. fn: function (){
  12759. var self=this,$self=this;
  12760. return self;
  12761. },
  12762. args: [],
  12763. source: "flush",
  12764. referencedClasses: [],
  12765. messageSends: []
  12766. }),
  12767. $globals.Stream);
  12768. $core.addMethod(
  12769. $core.method({
  12770. selector: "isEmpty",
  12771. protocol: "testing",
  12772. fn: function (){
  12773. var self=this,$self=this;
  12774. return $core.withContext(function($ctx1) {
  12775. return $recv($self._size()).__eq((0));
  12776. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  12777. },
  12778. args: [],
  12779. source: "isEmpty\x0a\x09^ self size = 0",
  12780. referencedClasses: [],
  12781. messageSends: ["=", "size"]
  12782. }),
  12783. $globals.Stream);
  12784. $core.addMethod(
  12785. $core.method({
  12786. selector: "next",
  12787. protocol: "reading",
  12788. fn: function (){
  12789. var self=this,$self=this;
  12790. return $core.withContext(function($ctx1) {
  12791. var $1,$3,$2;
  12792. $1=$self._atEnd();
  12793. if($core.assert($1)){
  12794. return nil;
  12795. } else {
  12796. $3=$self._position();
  12797. $ctx1.sendIdx["position"]=1;
  12798. $2=$recv($3).__plus((1));
  12799. $self._position_($2);
  12800. return $recv($self["@collection"])._at_($self._position());
  12801. }
  12802. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  12803. },
  12804. args: [],
  12805. 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 ]",
  12806. referencedClasses: [],
  12807. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  12808. }),
  12809. $globals.Stream);
  12810. $core.addMethod(
  12811. $core.method({
  12812. selector: "next:",
  12813. protocol: "reading",
  12814. fn: function (anInteger){
  12815. var self=this,$self=this;
  12816. var tempCollection;
  12817. return $core.withContext(function($ctx1) {
  12818. var $1;
  12819. tempCollection=$recv($recv($self._collection())._class())._new();
  12820. $recv(anInteger)._timesRepeat_((function(){
  12821. return $core.withContext(function($ctx2) {
  12822. $1=$self._atEnd();
  12823. if(!$core.assert($1)){
  12824. return $recv(tempCollection)._add_($self._next());
  12825. }
  12826. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12827. }));
  12828. return tempCollection;
  12829. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  12830. },
  12831. args: ["anInteger"],
  12832. 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",
  12833. referencedClasses: [],
  12834. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  12835. }),
  12836. $globals.Stream);
  12837. $core.addMethod(
  12838. $core.method({
  12839. selector: "nextPut:",
  12840. protocol: "writing",
  12841. fn: function (anObject){
  12842. var self=this,$self=this;
  12843. return $core.withContext(function($ctx1) {
  12844. var $2,$1,$3,$4;
  12845. $2=$self._position();
  12846. $ctx1.sendIdx["position"]=1;
  12847. $1=$recv($2).__plus((1));
  12848. $self._position_($1);
  12849. $3=$self._collection();
  12850. $4=$self._position();
  12851. $ctx1.sendIdx["position"]=2;
  12852. $recv($3)._at_put_($4,anObject);
  12853. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  12854. return self;
  12855. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  12856. },
  12857. args: ["anObject"],
  12858. 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)",
  12859. referencedClasses: [],
  12860. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  12861. }),
  12862. $globals.Stream);
  12863. $core.addMethod(
  12864. $core.method({
  12865. selector: "peek",
  12866. protocol: "reading",
  12867. fn: function (){
  12868. var self=this,$self=this;
  12869. return $core.withContext(function($ctx1) {
  12870. var $1;
  12871. $1=$self._atEnd();
  12872. if(!$core.assert($1)){
  12873. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  12874. }
  12875. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  12876. },
  12877. args: [],
  12878. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  12879. referencedClasses: [],
  12880. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  12881. }),
  12882. $globals.Stream);
  12883. $core.addMethod(
  12884. $core.method({
  12885. selector: "position",
  12886. protocol: "accessing",
  12887. fn: function (){
  12888. var self=this,$self=this;
  12889. return $core.withContext(function($ctx1) {
  12890. var $1,$receiver;
  12891. $1=$self["@position"];
  12892. if(($receiver = $1) == null || $receiver.a$nil){
  12893. $self["@position"]=(0);
  12894. return $self["@position"];
  12895. } else {
  12896. return $1;
  12897. }
  12898. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  12899. },
  12900. args: [],
  12901. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  12902. referencedClasses: [],
  12903. messageSends: ["ifNil:"]
  12904. }),
  12905. $globals.Stream);
  12906. $core.addMethod(
  12907. $core.method({
  12908. selector: "position:",
  12909. protocol: "accessing",
  12910. fn: function (anInteger){
  12911. var self=this,$self=this;
  12912. $self["@position"]=anInteger;
  12913. return self;
  12914. },
  12915. args: ["anInteger"],
  12916. source: "position: anInteger\x0a\x09position := anInteger",
  12917. referencedClasses: [],
  12918. messageSends: []
  12919. }),
  12920. $globals.Stream);
  12921. $core.addMethod(
  12922. $core.method({
  12923. selector: "reset",
  12924. protocol: "actions",
  12925. fn: function (){
  12926. var self=this,$self=this;
  12927. return $core.withContext(function($ctx1) {
  12928. $self._position_((0));
  12929. return self;
  12930. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  12931. },
  12932. args: [],
  12933. source: "reset\x0a\x09self position: 0",
  12934. referencedClasses: [],
  12935. messageSends: ["position:"]
  12936. }),
  12937. $globals.Stream);
  12938. $core.addMethod(
  12939. $core.method({
  12940. selector: "resetContents",
  12941. protocol: "actions",
  12942. fn: function (){
  12943. var self=this,$self=this;
  12944. return $core.withContext(function($ctx1) {
  12945. $self._reset();
  12946. $self._setStreamSize_((0));
  12947. return self;
  12948. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  12949. },
  12950. args: [],
  12951. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  12952. referencedClasses: [],
  12953. messageSends: ["reset", "setStreamSize:"]
  12954. }),
  12955. $globals.Stream);
  12956. $core.addMethod(
  12957. $core.method({
  12958. selector: "setCollection:",
  12959. protocol: "accessing",
  12960. fn: function (aCollection){
  12961. var self=this,$self=this;
  12962. $self["@collection"]=aCollection;
  12963. return self;
  12964. },
  12965. args: ["aCollection"],
  12966. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  12967. referencedClasses: [],
  12968. messageSends: []
  12969. }),
  12970. $globals.Stream);
  12971. $core.addMethod(
  12972. $core.method({
  12973. selector: "setStreamSize:",
  12974. protocol: "accessing",
  12975. fn: function (anInteger){
  12976. var self=this,$self=this;
  12977. $self["@streamSize"]=anInteger;
  12978. return self;
  12979. },
  12980. args: ["anInteger"],
  12981. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  12982. referencedClasses: [],
  12983. messageSends: []
  12984. }),
  12985. $globals.Stream);
  12986. $core.addMethod(
  12987. $core.method({
  12988. selector: "setToEnd",
  12989. protocol: "positioning",
  12990. fn: function (){
  12991. var self=this,$self=this;
  12992. return $core.withContext(function($ctx1) {
  12993. $self._position_($self._size());
  12994. return self;
  12995. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  12996. },
  12997. args: [],
  12998. source: "setToEnd\x0a\x09self position: self size",
  12999. referencedClasses: [],
  13000. messageSends: ["position:", "size"]
  13001. }),
  13002. $globals.Stream);
  13003. $core.addMethod(
  13004. $core.method({
  13005. selector: "size",
  13006. protocol: "accessing",
  13007. fn: function (){
  13008. var self=this,$self=this;
  13009. return $core.withContext(function($ctx1) {
  13010. return $self._streamSize();
  13011. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13012. },
  13013. args: [],
  13014. source: "size\x0a\x09^ self streamSize",
  13015. referencedClasses: [],
  13016. messageSends: ["streamSize"]
  13017. }),
  13018. $globals.Stream);
  13019. $core.addMethod(
  13020. $core.method({
  13021. selector: "skip:",
  13022. protocol: "positioning",
  13023. fn: function (anInteger){
  13024. var self=this,$self=this;
  13025. return $core.withContext(function($ctx1) {
  13026. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13027. return self;
  13028. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13029. },
  13030. args: ["anInteger"],
  13031. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13032. referencedClasses: [],
  13033. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13034. }),
  13035. $globals.Stream);
  13036. $core.addMethod(
  13037. $core.method({
  13038. selector: "streamSize",
  13039. protocol: "accessing",
  13040. fn: function (){
  13041. var self=this,$self=this;
  13042. return $self["@streamSize"];
  13043. },
  13044. args: [],
  13045. source: "streamSize\x0a\x09^ streamSize",
  13046. referencedClasses: [],
  13047. messageSends: []
  13048. }),
  13049. $globals.Stream);
  13050. $core.addMethod(
  13051. $core.method({
  13052. selector: "on:",
  13053. protocol: "instance creation",
  13054. fn: function (aCollection){
  13055. var self=this,$self=this;
  13056. return $core.withContext(function($ctx1) {
  13057. var $1;
  13058. $1=$self._new();
  13059. $recv($1)._setCollection_(aCollection);
  13060. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13061. return $recv($1)._yourself();
  13062. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  13063. },
  13064. args: ["aCollection"],
  13065. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13066. referencedClasses: [],
  13067. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13068. }),
  13069. $globals.Stream.a$cls);
  13070. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13071. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  13072. $core.addMethod(
  13073. $core.method({
  13074. selector: "cr",
  13075. protocol: "writing",
  13076. fn: function (){
  13077. var self=this,$self=this;
  13078. return $core.withContext(function($ctx1) {
  13079. return $self._nextPutAll_($recv($globals.String)._cr());
  13080. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  13081. },
  13082. args: [],
  13083. source: "cr\x0a\x09^ self nextPutAll: String cr",
  13084. referencedClasses: ["String"],
  13085. messageSends: ["nextPutAll:", "cr"]
  13086. }),
  13087. $globals.StringStream);
  13088. $core.addMethod(
  13089. $core.method({
  13090. selector: "crlf",
  13091. protocol: "writing",
  13092. fn: function (){
  13093. var self=this,$self=this;
  13094. return $core.withContext(function($ctx1) {
  13095. return $self._nextPutAll_($recv($globals.String)._crlf());
  13096. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  13097. },
  13098. args: [],
  13099. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  13100. referencedClasses: ["String"],
  13101. messageSends: ["nextPutAll:", "crlf"]
  13102. }),
  13103. $globals.StringStream);
  13104. $core.addMethod(
  13105. $core.method({
  13106. selector: "lf",
  13107. protocol: "writing",
  13108. fn: function (){
  13109. var self=this,$self=this;
  13110. return $core.withContext(function($ctx1) {
  13111. return $self._nextPutAll_($recv($globals.String)._lf());
  13112. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  13113. },
  13114. args: [],
  13115. source: "lf\x0a\x09^ self nextPutAll: String lf",
  13116. referencedClasses: ["String"],
  13117. messageSends: ["nextPutAll:", "lf"]
  13118. }),
  13119. $globals.StringStream);
  13120. $core.addMethod(
  13121. $core.method({
  13122. selector: "next:",
  13123. protocol: "reading",
  13124. fn: function (anInteger){
  13125. var self=this,$self=this;
  13126. var tempCollection;
  13127. return $core.withContext(function($ctx1) {
  13128. var $1;
  13129. tempCollection=$recv($recv($self._collection())._class())._new();
  13130. $recv(anInteger)._timesRepeat_((function(){
  13131. return $core.withContext(function($ctx2) {
  13132. $1=$self._atEnd();
  13133. if(!$core.assert($1)){
  13134. tempCollection=$recv(tempCollection).__comma($self._next());
  13135. return tempCollection;
  13136. }
  13137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13138. }));
  13139. return tempCollection;
  13140. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  13141. },
  13142. args: ["anInteger"],
  13143. 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",
  13144. referencedClasses: [],
  13145. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  13146. }),
  13147. $globals.StringStream);
  13148. $core.addMethod(
  13149. $core.method({
  13150. selector: "nextPut:",
  13151. protocol: "writing",
  13152. fn: function (aString){
  13153. var self=this,$self=this;
  13154. return $core.withContext(function($ctx1) {
  13155. $self._nextPutAll_(aString);
  13156. return self;
  13157. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  13158. },
  13159. args: ["aString"],
  13160. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  13161. referencedClasses: [],
  13162. messageSends: ["nextPutAll:"]
  13163. }),
  13164. $globals.StringStream);
  13165. $core.addMethod(
  13166. $core.method({
  13167. selector: "nextPutAll:",
  13168. protocol: "writing",
  13169. fn: function (aString){
  13170. var self=this,$self=this;
  13171. var pre,post;
  13172. return $core.withContext(function($ctx1) {
  13173. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  13174. $1=$self._atEnd();
  13175. if($core.assert($1)){
  13176. $3=$self._collection();
  13177. $ctx1.sendIdx["collection"]=1;
  13178. $2=$recv($3).__comma(aString);
  13179. $ctx1.sendIdx[","]=1;
  13180. $self._setCollection_($2);
  13181. $ctx1.sendIdx["setCollection:"]=1;
  13182. } else {
  13183. $4=$self._collection();
  13184. $ctx1.sendIdx["collection"]=2;
  13185. $5=$self._position();
  13186. $ctx1.sendIdx["position"]=1;
  13187. pre=$recv($4)._copyFrom_to_((1),$5);
  13188. $ctx1.sendIdx["copyFrom:to:"]=1;
  13189. pre;
  13190. $6=$self._collection();
  13191. $ctx1.sendIdx["collection"]=3;
  13192. $9=$self._position();
  13193. $ctx1.sendIdx["position"]=2;
  13194. $8=$recv($9).__plus((1));
  13195. $ctx1.sendIdx["+"]=2;
  13196. $10=$recv(aString)._size();
  13197. $ctx1.sendIdx["size"]=1;
  13198. $7=$recv($8).__plus($10);
  13199. $ctx1.sendIdx["+"]=1;
  13200. $11=$recv($self._collection())._size();
  13201. $ctx1.sendIdx["size"]=2;
  13202. post=$recv($6)._copyFrom_to_($7,$11);
  13203. post;
  13204. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  13205. $ctx1.sendIdx[","]=2;
  13206. $self._setCollection_($12);
  13207. }
  13208. $14=$self._position();
  13209. $ctx1.sendIdx["position"]=3;
  13210. $13=$recv($14).__plus($recv(aString)._size());
  13211. $self._position_($13);
  13212. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13213. return self;
  13214. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  13215. },
  13216. args: ["aString"],
  13217. 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)",
  13218. referencedClasses: [],
  13219. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  13220. }),
  13221. $globals.StringStream);
  13222. $core.addMethod(
  13223. $core.method({
  13224. selector: "nextPutString:",
  13225. protocol: "writing",
  13226. fn: function (aString){
  13227. var self=this,$self=this;
  13228. return $core.withContext(function($ctx1) {
  13229. $self._nextPutAll_(aString);
  13230. return self;
  13231. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  13232. },
  13233. args: ["aString"],
  13234. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  13235. referencedClasses: [],
  13236. messageSends: ["nextPutAll:"]
  13237. }),
  13238. $globals.StringStream);
  13239. $core.addMethod(
  13240. $core.method({
  13241. selector: "print:",
  13242. protocol: "writing",
  13243. fn: function (anObject){
  13244. var self=this,$self=this;
  13245. return $core.withContext(function($ctx1) {
  13246. $recv(anObject)._printOn_(self);
  13247. return self;
  13248. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  13249. },
  13250. args: ["anObject"],
  13251. source: "print: anObject\x0a\x09anObject printOn: self",
  13252. referencedClasses: [],
  13253. messageSends: ["printOn:"]
  13254. }),
  13255. $globals.StringStream);
  13256. $core.addMethod(
  13257. $core.method({
  13258. selector: "printSymbol:",
  13259. protocol: "writing",
  13260. fn: function (anObject){
  13261. var self=this,$self=this;
  13262. return $core.withContext(function($ctx1) {
  13263. $recv(anObject)._asSymbolPrintOn_(self);
  13264. return self;
  13265. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  13266. },
  13267. args: ["anObject"],
  13268. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  13269. referencedClasses: [],
  13270. messageSends: ["asSymbolPrintOn:"]
  13271. }),
  13272. $globals.StringStream);
  13273. $core.addMethod(
  13274. $core.method({
  13275. selector: "space",
  13276. protocol: "writing",
  13277. fn: function (){
  13278. var self=this,$self=this;
  13279. return $core.withContext(function($ctx1) {
  13280. $self._nextPut_(" ");
  13281. return self;
  13282. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  13283. },
  13284. args: [],
  13285. source: "space\x0a\x09self nextPut: ' '",
  13286. referencedClasses: [],
  13287. messageSends: ["nextPut:"]
  13288. }),
  13289. $globals.StringStream);
  13290. $core.addMethod(
  13291. $core.method({
  13292. selector: "tab",
  13293. protocol: "writing",
  13294. fn: function (){
  13295. var self=this,$self=this;
  13296. return $core.withContext(function($ctx1) {
  13297. return $self._nextPutAll_($recv($globals.String)._tab());
  13298. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  13299. },
  13300. args: [],
  13301. source: "tab\x0a\x09^ self nextPutAll: String tab",
  13302. referencedClasses: ["String"],
  13303. messageSends: ["nextPutAll:", "tab"]
  13304. }),
  13305. $globals.StringStream);
  13306. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  13307. $globals.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.";
  13308. $core.addMethod(
  13309. $core.method({
  13310. selector: "initialize",
  13311. protocol: "initialization",
  13312. fn: function (){
  13313. var self=this,$self=this;
  13314. return $core.withContext(function($ctx1) {
  13315. (
  13316. $ctx1.supercall = true,
  13317. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13318. $ctx1.supercall = false;
  13319. $self["@read"]=$recv($globals.OrderedCollection)._new();
  13320. $ctx1.sendIdx["new"]=1;
  13321. $self["@write"]=$recv($globals.OrderedCollection)._new();
  13322. $self["@readIndex"]=(1);
  13323. return self;
  13324. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  13325. },
  13326. args: [],
  13327. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13328. referencedClasses: ["OrderedCollection"],
  13329. messageSends: ["initialize", "new"]
  13330. }),
  13331. $globals.Queue);
  13332. $core.addMethod(
  13333. $core.method({
  13334. selector: "next",
  13335. protocol: "accessing",
  13336. fn: function (){
  13337. var self=this,$self=this;
  13338. return $core.withContext(function($ctx1) {
  13339. return $self._nextIfAbsent_((function(){
  13340. return $core.withContext(function($ctx2) {
  13341. return $self._error_("Cannot read from empty Queue.");
  13342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13343. }));
  13344. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  13345. },
  13346. args: [],
  13347. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13348. referencedClasses: [],
  13349. messageSends: ["nextIfAbsent:", "error:"]
  13350. }),
  13351. $globals.Queue);
  13352. $core.addMethod(
  13353. $core.method({
  13354. selector: "nextIfAbsent:",
  13355. protocol: "accessing",
  13356. fn: function (aBlock){
  13357. var self=this,$self=this;
  13358. var result;
  13359. return $core.withContext(function($ctx1) {
  13360. var $1;
  13361. var $early={};
  13362. try {
  13363. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  13364. return $core.withContext(function($ctx2) {
  13365. $recv($self["@write"])._ifEmpty_((function(){
  13366. return $core.withContext(function($ctx3) {
  13367. $1=$recv($self["@readIndex"]).__gt((1));
  13368. if($core.assert($1)){
  13369. $self["@read"]=[];
  13370. $self["@read"];
  13371. $self["@readIndex"]=(1);
  13372. $self["@readIndex"];
  13373. }
  13374. throw $early=[$recv(aBlock)._value()];
  13375. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13376. }));
  13377. $self["@read"]=$self["@write"];
  13378. $self["@read"];
  13379. $self["@readIndex"]=(1);
  13380. $self["@readIndex"];
  13381. $self["@write"]=$recv($globals.OrderedCollection)._new();
  13382. $self["@write"];
  13383. return $recv($self["@read"])._first();
  13384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13385. }));
  13386. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  13387. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  13388. return result;
  13389. }
  13390. catch(e) {if(e===$early)return e[0]; throw e}
  13391. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  13392. },
  13393. args: ["aBlock"],
  13394. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write ifEmpty: [\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",
  13395. referencedClasses: ["OrderedCollection"],
  13396. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  13397. }),
  13398. $globals.Queue);
  13399. $core.addMethod(
  13400. $core.method({
  13401. selector: "nextPut:",
  13402. protocol: "accessing",
  13403. fn: function (anObject){
  13404. var self=this,$self=this;
  13405. return $core.withContext(function($ctx1) {
  13406. $recv($self["@write"])._add_(anObject);
  13407. return self;
  13408. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  13409. },
  13410. args: ["anObject"],
  13411. source: "nextPut: anObject\x0a\x09write add: anObject",
  13412. referencedClasses: [],
  13413. messageSends: ["add:"]
  13414. }),
  13415. $globals.Queue);
  13416. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  13417. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  13418. $core.addMethod(
  13419. $core.method({
  13420. selector: "compile:",
  13421. protocol: "evaluating",
  13422. fn: function (aString){
  13423. var self=this,$self=this;
  13424. return $core.withContext(function($ctx1) {
  13425. return self.compile(aString);
  13426. return self;
  13427. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  13428. },
  13429. args: ["aString"],
  13430. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  13431. referencedClasses: [],
  13432. messageSends: []
  13433. }),
  13434. $globals.RegularExpression);
  13435. $core.addMethod(
  13436. $core.method({
  13437. selector: "exec:",
  13438. protocol: "evaluating",
  13439. fn: function (aString){
  13440. var self=this,$self=this;
  13441. return $core.withContext(function($ctx1) {
  13442. return self.exec(aString) || nil;
  13443. return self;
  13444. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  13445. },
  13446. args: ["aString"],
  13447. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  13448. referencedClasses: [],
  13449. messageSends: []
  13450. }),
  13451. $globals.RegularExpression);
  13452. $core.addMethod(
  13453. $core.method({
  13454. selector: "test:",
  13455. protocol: "evaluating",
  13456. fn: function (aString){
  13457. var self=this,$self=this;
  13458. return $core.withContext(function($ctx1) {
  13459. return self.test(aString);
  13460. return self;
  13461. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  13462. },
  13463. args: ["aString"],
  13464. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  13465. referencedClasses: [],
  13466. messageSends: []
  13467. }),
  13468. $globals.RegularExpression);
  13469. $core.addMethod(
  13470. $core.method({
  13471. selector: "fromString:",
  13472. protocol: "instance creation",
  13473. fn: function (aString){
  13474. var self=this,$self=this;
  13475. return $core.withContext(function($ctx1) {
  13476. return $self._fromString_flag_(aString,"");
  13477. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  13478. },
  13479. args: ["aString"],
  13480. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  13481. referencedClasses: [],
  13482. messageSends: ["fromString:flag:"]
  13483. }),
  13484. $globals.RegularExpression.a$cls);
  13485. $core.addMethod(
  13486. $core.method({
  13487. selector: "fromString:flag:",
  13488. protocol: "instance creation",
  13489. fn: function (aString,anotherString){
  13490. var self=this,$self=this;
  13491. return $core.withContext(function($ctx1) {
  13492. return new RegExp(aString, anotherString);
  13493. return self;
  13494. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  13495. },
  13496. args: ["aString", "anotherString"],
  13497. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  13498. referencedClasses: [],
  13499. messageSends: []
  13500. }),
  13501. $globals.RegularExpression.a$cls);
  13502. });
  13503. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  13504. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  13505. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  13506. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  13507. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  13508. $core.addPackage("Kernel-Classes");
  13509. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  13510. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  13511. $core.addClass("Behavior", $globals.Object, [], "Kernel-Classes");
  13512. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aIn addition to BehaviorBody, I define superclass/subclass relationships and instantiation.\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 and contain the description that instances are created from.\x0a\x0aI also provide iterating over the class hierarchy.";
  13513. $core.addMethod(
  13514. $core.method({
  13515. selector: "allInstanceVariableNames",
  13516. protocol: "accessing",
  13517. fn: function (){
  13518. var self=this,$self=this;
  13519. var result;
  13520. return $core.withContext(function($ctx1) {
  13521. var $1,$receiver;
  13522. result=$recv($self._instanceVariableNames())._copy();
  13523. $1=$self._superclass();
  13524. $ctx1.sendIdx["superclass"]=1;
  13525. if(($receiver = $1) == null || $receiver.a$nil){
  13526. $1;
  13527. } else {
  13528. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  13529. }
  13530. return result;
  13531. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  13532. },
  13533. args: [],
  13534. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  13535. referencedClasses: [],
  13536. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  13537. }),
  13538. $globals.Behavior);
  13539. $core.addMethod(
  13540. $core.method({
  13541. selector: "allSelectors",
  13542. protocol: "accessing",
  13543. fn: function (){
  13544. var self=this,$self=this;
  13545. return $core.withContext(function($ctx1) {
  13546. var $1,$2;
  13547. $1=$self._allSuperclasses();
  13548. $2=$self._selectors();
  13549. $ctx1.sendIdx["selectors"]=1;
  13550. return $recv($1)._inject_into_($2,(function(acc,each){
  13551. return $core.withContext(function($ctx2) {
  13552. $recv(acc)._addAll_($recv(each)._selectors());
  13553. return $recv(acc)._yourself();
  13554. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  13555. }));
  13556. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  13557. },
  13558. args: [],
  13559. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  13560. referencedClasses: [],
  13561. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  13562. }),
  13563. $globals.Behavior);
  13564. $core.addMethod(
  13565. $core.method({
  13566. selector: "allSubclasses",
  13567. protocol: "accessing",
  13568. fn: function (){
  13569. var self=this,$self=this;
  13570. return $core.withContext(function($ctx1) {
  13571. return $recv($globals.Array)._streamContents_((function(str){
  13572. return $core.withContext(function($ctx2) {
  13573. return $self._allSubclassesDo_((function(each){
  13574. return $core.withContext(function($ctx3) {
  13575. return $recv(str)._nextPut_(each);
  13576. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  13577. }));
  13578. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  13579. }));
  13580. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  13581. },
  13582. args: [],
  13583. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09^ Array streamContents: [ :str | self allSubclassesDo: [ :each | str nextPut: each ] ]",
  13584. referencedClasses: ["Array"],
  13585. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  13586. }),
  13587. $globals.Behavior);
  13588. $core.addMethod(
  13589. $core.method({
  13590. selector: "allSubclassesDo:",
  13591. protocol: "enumerating",
  13592. fn: function (aBlock){
  13593. var self=this,$self=this;
  13594. return $core.withContext(function($ctx1) {
  13595. $core.traverseClassTree(self, function(subclass) {
  13596. if (subclass !== self) aBlock._value_(subclass);
  13597. });
  13598. return self;
  13599. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  13600. },
  13601. args: ["aBlock"],
  13602. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<inlineJS: '$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})'>",
  13603. referencedClasses: [],
  13604. messageSends: []
  13605. }),
  13606. $globals.Behavior);
  13607. $core.addMethod(
  13608. $core.method({
  13609. selector: "allSuperclasses",
  13610. protocol: "accessing",
  13611. fn: function (){
  13612. var self=this,$self=this;
  13613. return $core.withContext(function($ctx1) {
  13614. var $1,$3,$2,$receiver;
  13615. $1=$self._superclass();
  13616. $ctx1.sendIdx["superclass"]=1;
  13617. if(($receiver = $1) == null || $receiver.a$nil){
  13618. return [];
  13619. } else {
  13620. $1;
  13621. }
  13622. $3=$self._superclass();
  13623. $ctx1.sendIdx["superclass"]=2;
  13624. $2=$recv($globals.OrderedCollection)._with_($3);
  13625. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  13626. return $recv($2)._yourself();
  13627. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  13628. },
  13629. args: [],
  13630. 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",
  13631. referencedClasses: ["OrderedCollection"],
  13632. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  13633. }),
  13634. $globals.Behavior);
  13635. $core.addMethod(
  13636. $core.method({
  13637. selector: "basicNew",
  13638. protocol: "instance creation",
  13639. fn: function (){
  13640. var self=this,$self=this;
  13641. return $core.withContext(function($ctx1) {
  13642. return new self.fn();
  13643. return self;
  13644. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  13645. },
  13646. args: [],
  13647. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  13648. referencedClasses: [],
  13649. messageSends: []
  13650. }),
  13651. $globals.Behavior);
  13652. $core.addMethod(
  13653. $core.method({
  13654. selector: "canUnderstand:",
  13655. protocol: "testing",
  13656. fn: function (aSelector){
  13657. var self=this,$self=this;
  13658. return $core.withContext(function($ctx1) {
  13659. var $2,$1;
  13660. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  13661. return $core.withContext(function($ctx2) {
  13662. $2=$self._superclass();
  13663. $ctx2.sendIdx["superclass"]=1;
  13664. $1=$recv($2)._notNil();
  13665. return $recv($1)._and_((function(){
  13666. return $core.withContext(function($ctx3) {
  13667. return $recv($self._superclass())._canUnderstand_(aSelector);
  13668. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13669. }));
  13670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13671. }));
  13672. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  13673. },
  13674. args: ["aSelector"],
  13675. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  13676. referencedClasses: [],
  13677. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  13678. }),
  13679. $globals.Behavior);
  13680. $core.addMethod(
  13681. $core.method({
  13682. selector: "includesBehavior:",
  13683. protocol: "testing",
  13684. fn: function (aClass){
  13685. var self=this,$self=this;
  13686. return $core.withContext(function($ctx1) {
  13687. return $recv($self.__eq_eq(aClass))._or_((function(){
  13688. return $core.withContext(function($ctx2) {
  13689. return $self._inheritsFrom_(aClass);
  13690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13691. }));
  13692. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  13693. },
  13694. args: ["aClass"],
  13695. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  13696. referencedClasses: [],
  13697. messageSends: ["or:", "==", "inheritsFrom:"]
  13698. }),
  13699. $globals.Behavior);
  13700. $core.addMethod(
  13701. $core.method({
  13702. selector: "inheritsFrom:",
  13703. protocol: "testing",
  13704. fn: function (aClass){
  13705. var self=this,$self=this;
  13706. return $core.withContext(function($ctx1) {
  13707. var $1,$3,$2,$receiver;
  13708. $1=$self._superclass();
  13709. $ctx1.sendIdx["superclass"]=1;
  13710. if(($receiver = $1) == null || $receiver.a$nil){
  13711. return false;
  13712. } else {
  13713. $1;
  13714. }
  13715. $3=$self._superclass();
  13716. $ctx1.sendIdx["superclass"]=2;
  13717. $2=$recv(aClass).__eq_eq($3);
  13718. return $recv($2)._or_((function(){
  13719. return $core.withContext(function($ctx2) {
  13720. return $recv($self._superclass())._inheritsFrom_(aClass);
  13721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13722. }));
  13723. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  13724. },
  13725. args: ["aClass"],
  13726. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  13727. referencedClasses: [],
  13728. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  13729. }),
  13730. $globals.Behavior);
  13731. $core.addMethod(
  13732. $core.method({
  13733. selector: "instanceVariableNames",
  13734. protocol: "accessing",
  13735. fn: function (){
  13736. var self=this,$self=this;
  13737. return $core.withContext(function($ctx1) {
  13738. return self.iVarNames;
  13739. return self;
  13740. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  13741. },
  13742. args: [],
  13743. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  13744. referencedClasses: [],
  13745. messageSends: []
  13746. }),
  13747. $globals.Behavior);
  13748. $core.addMethod(
  13749. $core.method({
  13750. selector: "isBehavior",
  13751. protocol: "testing",
  13752. fn: function (){
  13753. var self=this,$self=this;
  13754. return true;
  13755. },
  13756. args: [],
  13757. source: "isBehavior\x0a\x09^ true",
  13758. referencedClasses: [],
  13759. messageSends: []
  13760. }),
  13761. $globals.Behavior);
  13762. $core.addMethod(
  13763. $core.method({
  13764. selector: "javascriptConstructor",
  13765. protocol: "accessing",
  13766. fn: function (){
  13767. var self=this,$self=this;
  13768. return $core.withContext(function($ctx1) {
  13769. return self.fn;
  13770. return self;
  13771. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  13772. },
  13773. args: [],
  13774. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  13775. referencedClasses: [],
  13776. messageSends: []
  13777. }),
  13778. $globals.Behavior);
  13779. $core.addMethod(
  13780. $core.method({
  13781. selector: "javascriptConstructor:",
  13782. protocol: "accessing",
  13783. fn: function (aJavaScriptFunction){
  13784. var self=this,$self=this;
  13785. return $core.withContext(function($ctx1) {
  13786. $core.setClassConstructor(self, aJavaScriptFunction);;
  13787. return self;
  13788. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  13789. },
  13790. args: ["aJavaScriptFunction"],
  13791. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<inlineJS: '$core.setClassConstructor(self, aJavaScriptFunction);'>",
  13792. referencedClasses: [],
  13793. messageSends: []
  13794. }),
  13795. $globals.Behavior);
  13796. $core.addMethod(
  13797. $core.method({
  13798. selector: "lookupSelector:",
  13799. protocol: "accessing",
  13800. fn: function (selector){
  13801. var self=this,$self=this;
  13802. var lookupClass;
  13803. return $core.withContext(function($ctx1) {
  13804. var $1;
  13805. var $early={};
  13806. try {
  13807. lookupClass=self;
  13808. $recv((function(){
  13809. return $core.withContext(function($ctx2) {
  13810. return $recv(lookupClass).__eq(nil);
  13811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13812. }))._whileFalse_((function(){
  13813. return $core.withContext(function($ctx2) {
  13814. $1=$recv(lookupClass)._includesSelector_(selector);
  13815. if($core.assert($1)){
  13816. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  13817. }
  13818. lookupClass=$recv(lookupClass)._superclass();
  13819. return lookupClass;
  13820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13821. }));
  13822. return nil;
  13823. }
  13824. catch(e) {if(e===$early)return e[0]; throw e}
  13825. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  13826. },
  13827. args: ["selector"],
  13828. 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",
  13829. referencedClasses: [],
  13830. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  13831. }),
  13832. $globals.Behavior);
  13833. $core.addMethod(
  13834. $core.method({
  13835. selector: "new",
  13836. protocol: "instance creation",
  13837. fn: function (){
  13838. var self=this,$self=this;
  13839. return $core.withContext(function($ctx1) {
  13840. return $recv($self._basicNew())._initialize();
  13841. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  13842. },
  13843. args: [],
  13844. source: "new\x0a\x09^ self basicNew initialize",
  13845. referencedClasses: [],
  13846. messageSends: ["initialize", "basicNew"]
  13847. }),
  13848. $globals.Behavior);
  13849. $core.addMethod(
  13850. $core.method({
  13851. selector: "prototype",
  13852. protocol: "accessing",
  13853. fn: function (){
  13854. var self=this,$self=this;
  13855. return $core.withContext(function($ctx1) {
  13856. return self.fn.prototype;
  13857. return self;
  13858. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  13859. },
  13860. args: [],
  13861. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  13862. referencedClasses: [],
  13863. messageSends: []
  13864. }),
  13865. $globals.Behavior);
  13866. $core.addMethod(
  13867. $core.method({
  13868. selector: "subclasses",
  13869. protocol: "accessing",
  13870. fn: function (){
  13871. var self=this,$self=this;
  13872. return $core.withContext(function($ctx1) {
  13873. $self._subclassResponsibility();
  13874. return self;
  13875. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  13876. },
  13877. args: [],
  13878. source: "subclasses\x0a\x09self subclassResponsibility",
  13879. referencedClasses: [],
  13880. messageSends: ["subclassResponsibility"]
  13881. }),
  13882. $globals.Behavior);
  13883. $core.addMethod(
  13884. $core.method({
  13885. selector: "superclass",
  13886. protocol: "accessing",
  13887. fn: function (){
  13888. var self=this,$self=this;
  13889. return $core.withContext(function($ctx1) {
  13890. return self.superclass;
  13891. return self;
  13892. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  13893. },
  13894. args: [],
  13895. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  13896. referencedClasses: [],
  13897. messageSends: []
  13898. }),
  13899. $globals.Behavior);
  13900. $core.addMethod(
  13901. $core.method({
  13902. selector: "theMetaClass",
  13903. protocol: "accessing",
  13904. fn: function (){
  13905. var self=this,$self=this;
  13906. return $core.withContext(function($ctx1) {
  13907. $self._subclassResponsibility();
  13908. return self;
  13909. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  13910. },
  13911. args: [],
  13912. source: "theMetaClass\x0a\x09self subclassResponsibility",
  13913. referencedClasses: [],
  13914. messageSends: ["subclassResponsibility"]
  13915. }),
  13916. $globals.Behavior);
  13917. $core.addMethod(
  13918. $core.method({
  13919. selector: "theNonMetaClass",
  13920. protocol: "accessing",
  13921. fn: function (){
  13922. var self=this,$self=this;
  13923. return $core.withContext(function($ctx1) {
  13924. $self._subclassResponsibility();
  13925. return self;
  13926. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  13927. },
  13928. args: [],
  13929. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  13930. referencedClasses: [],
  13931. messageSends: ["subclassResponsibility"]
  13932. }),
  13933. $globals.Behavior);
  13934. $core.addMethod(
  13935. $core.method({
  13936. selector: "withAllSubclasses",
  13937. protocol: "accessing",
  13938. fn: function (){
  13939. var self=this,$self=this;
  13940. return $core.withContext(function($ctx1) {
  13941. var $1;
  13942. $1=$recv($globals.Array)._with_(self);
  13943. $recv($1)._addAll_($self._allSubclasses());
  13944. return $recv($1)._yourself();
  13945. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  13946. },
  13947. args: [],
  13948. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  13949. referencedClasses: ["Array"],
  13950. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  13951. }),
  13952. $globals.Behavior);
  13953. $core.addClass("Class", $globals.Behavior, [], "Kernel-Classes");
  13954. $globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  13955. $core.addMethod(
  13956. $core.method({
  13957. selector: "classTag",
  13958. protocol: "accessing",
  13959. fn: function (){
  13960. var self=this,$self=this;
  13961. return "class";
  13962. },
  13963. args: [],
  13964. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'class'",
  13965. referencedClasses: [],
  13966. messageSends: []
  13967. }),
  13968. $globals.Class);
  13969. $core.addMethod(
  13970. $core.method({
  13971. selector: "definition",
  13972. protocol: "accessing",
  13973. fn: function (){
  13974. var self=this,$self=this;
  13975. return $core.withContext(function($ctx1) {
  13976. var $1,$2;
  13977. return $recv($globals.String)._streamContents_((function(stream){
  13978. return $core.withContext(function($ctx2) {
  13979. $recv(stream)._print_($self._superclass());
  13980. $ctx2.sendIdx["print:"]=1;
  13981. $recv(stream)._write_(" subclass: ");
  13982. $ctx2.sendIdx["write:"]=1;
  13983. $recv(stream)._printSymbol_($self._name());
  13984. $recv(stream)._lf();
  13985. $ctx2.sendIdx["lf"]=1;
  13986. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  13987. return $core.withContext(function($ctx3) {
  13988. $1=$recv($globals.String)._tab();
  13989. $ctx3.sendIdx["tab"]=1;
  13990. $2=$recv($globals.String)._lf();
  13991. $ctx3.sendIdx["lf"]=2;
  13992. return [$1,"uses: ",tcd,$2];
  13993. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  13994. })));
  13995. $ctx2.sendIdx["write:"]=2;
  13996. $recv(stream)._tab();
  13997. $ctx2.sendIdx["tab"]=2;
  13998. $recv(stream)._write_("instanceVariableNames: ");
  13999. $ctx2.sendIdx["write:"]=3;
  14000. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14001. $ctx2.sendIdx["print:"]=2;
  14002. $recv(stream)._lf();
  14003. $recv(stream)._tab();
  14004. $recv(stream)._write_("package: ");
  14005. return $recv(stream)._print_($self._category());
  14006. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14007. }));
  14008. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14009. },
  14010. args: [],
  14011. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self superclass; write: ' subclass: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'instanceVariableNames: '; print: (' ' join: self instanceVariableNames); lf;\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  14012. referencedClasses: ["String"],
  14013. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14014. }),
  14015. $globals.Class);
  14016. $core.addMethod(
  14017. $core.method({
  14018. selector: "isClass",
  14019. protocol: "testing",
  14020. fn: function (){
  14021. var self=this,$self=this;
  14022. return true;
  14023. },
  14024. args: [],
  14025. source: "isClass\x0a\x09^ true",
  14026. referencedClasses: [],
  14027. messageSends: []
  14028. }),
  14029. $globals.Class);
  14030. $core.addMethod(
  14031. $core.method({
  14032. selector: "rename:",
  14033. protocol: "accessing",
  14034. fn: function (aString){
  14035. var self=this,$self=this;
  14036. return $core.withContext(function($ctx1) {
  14037. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  14038. return self;
  14039. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  14040. },
  14041. args: ["aString"],
  14042. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  14043. referencedClasses: ["ClassBuilder"],
  14044. messageSends: ["renameClass:to:", "new"]
  14045. }),
  14046. $globals.Class);
  14047. $core.addMethod(
  14048. $core.method({
  14049. selector: "subclasses",
  14050. protocol: "accessing",
  14051. fn: function (){
  14052. var self=this,$self=this;
  14053. return $core.withContext(function($ctx1) {
  14054. return self.subclasses._copy();
  14055. return self;
  14056. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  14057. },
  14058. args: [],
  14059. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  14060. referencedClasses: [],
  14061. messageSends: []
  14062. }),
  14063. $globals.Class);
  14064. $core.addMethod(
  14065. $core.method({
  14066. selector: "theMetaClass",
  14067. protocol: "accessing",
  14068. fn: function (){
  14069. var self=this,$self=this;
  14070. return $core.withContext(function($ctx1) {
  14071. return $self._class();
  14072. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  14073. },
  14074. args: [],
  14075. source: "theMetaClass\x0a\x09^ self class",
  14076. referencedClasses: [],
  14077. messageSends: ["class"]
  14078. }),
  14079. $globals.Class);
  14080. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  14081. $globals.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.";
  14082. $core.addMethod(
  14083. $core.method({
  14084. selector: "asJavaScriptSource",
  14085. protocol: "converting",
  14086. fn: function (){
  14087. var self=this,$self=this;
  14088. return $core.withContext(function($ctx1) {
  14089. var $1;
  14090. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  14091. $ctx1.sendIdx[","]=1;
  14092. return $1;
  14093. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  14094. },
  14095. args: [],
  14096. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  14097. referencedClasses: [],
  14098. messageSends: [",", "name", "instanceClass"]
  14099. }),
  14100. $globals.Metaclass);
  14101. $core.addMethod(
  14102. $core.method({
  14103. selector: "definition",
  14104. protocol: "accessing",
  14105. fn: function (){
  14106. var self=this,$self=this;
  14107. return $core.withContext(function($ctx1) {
  14108. var $1,$2;
  14109. return $recv($globals.String)._streamContents_((function(stream){
  14110. return $core.withContext(function($ctx2) {
  14111. $recv(stream)._print_(self);
  14112. $ctx2.sendIdx["print:"]=1;
  14113. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  14114. return " ";
  14115. }),(function(tcd){
  14116. return $core.withContext(function($ctx3) {
  14117. $1=$recv($globals.String)._lf();
  14118. $ctx3.sendIdx["lf"]=1;
  14119. $2=$recv($globals.String)._tab();
  14120. $ctx3.sendIdx["tab"]=1;
  14121. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  14122. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  14123. })));
  14124. $ctx2.sendIdx["write:"]=1;
  14125. $recv(stream)._write_("instanceVariableNames: ");
  14126. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14127. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14128. }));
  14129. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  14130. },
  14131. args: [],
  14132. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self;\x0a\x09\x09write: (self traitCompositionDefinition\x0a\x09\x09\x09ifEmpty: [' ']\x0a\x09\x09\x09ifNotEmpty: [ :tcd | { String lf. String tab. 'uses: '. tcd. String lf. String tab }]);\x0a\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09print: (' ' join: self instanceVariableNames) ]",
  14133. referencedClasses: ["String"],
  14134. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  14135. }),
  14136. $globals.Metaclass);
  14137. $core.addMethod(
  14138. $core.method({
  14139. selector: "instanceClass",
  14140. protocol: "accessing",
  14141. fn: function (){
  14142. var self=this,$self=this;
  14143. return $core.withContext(function($ctx1) {
  14144. return self.instanceClass;
  14145. return self;
  14146. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  14147. },
  14148. args: [],
  14149. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  14150. referencedClasses: [],
  14151. messageSends: []
  14152. }),
  14153. $globals.Metaclass);
  14154. $core.addMethod(
  14155. $core.method({
  14156. selector: "instanceVariableNames:",
  14157. protocol: "accessing",
  14158. fn: function (aCollection){
  14159. var self=this,$self=this;
  14160. return $core.withContext(function($ctx1) {
  14161. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  14162. return self;
  14163. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  14164. },
  14165. args: ["aCollection"],
  14166. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  14167. referencedClasses: ["ClassBuilder"],
  14168. messageSends: ["class:instanceVariableNames:", "new"]
  14169. }),
  14170. $globals.Metaclass);
  14171. $core.addMethod(
  14172. $core.method({
  14173. selector: "isMetaclass",
  14174. protocol: "testing",
  14175. fn: function (){
  14176. var self=this,$self=this;
  14177. return true;
  14178. },
  14179. args: [],
  14180. source: "isMetaclass\x0a\x09^ true",
  14181. referencedClasses: [],
  14182. messageSends: []
  14183. }),
  14184. $globals.Metaclass);
  14185. $core.addMethod(
  14186. $core.method({
  14187. selector: "name",
  14188. protocol: "accessing",
  14189. fn: function (){
  14190. var self=this,$self=this;
  14191. return $core.withContext(function($ctx1) {
  14192. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  14193. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  14194. },
  14195. args: [],
  14196. source: "name\x0a\x09^ self instanceClass name, ' class'",
  14197. referencedClasses: [],
  14198. messageSends: [",", "name", "instanceClass"]
  14199. }),
  14200. $globals.Metaclass);
  14201. $core.addMethod(
  14202. $core.method({
  14203. selector: "package",
  14204. protocol: "accessing",
  14205. fn: function (){
  14206. var self=this,$self=this;
  14207. return $core.withContext(function($ctx1) {
  14208. return $recv($self._instanceClass())._package();
  14209. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  14210. },
  14211. args: [],
  14212. source: "package\x0a\x09^ self instanceClass package",
  14213. referencedClasses: [],
  14214. messageSends: ["package", "instanceClass"]
  14215. }),
  14216. $globals.Metaclass);
  14217. $core.addMethod(
  14218. $core.method({
  14219. selector: "subclasses",
  14220. protocol: "accessing",
  14221. fn: function (){
  14222. var self=this,$self=this;
  14223. return $core.withContext(function($ctx1) {
  14224. return $core.metaSubclasses(self);
  14225. return self;
  14226. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  14227. },
  14228. args: [],
  14229. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  14230. referencedClasses: [],
  14231. messageSends: []
  14232. }),
  14233. $globals.Metaclass);
  14234. $core.addMethod(
  14235. $core.method({
  14236. selector: "theMetaClass",
  14237. protocol: "accessing",
  14238. fn: function (){
  14239. var self=this,$self=this;
  14240. return self;
  14241. },
  14242. args: [],
  14243. source: "theMetaClass\x0a\x09^ self",
  14244. referencedClasses: [],
  14245. messageSends: []
  14246. }),
  14247. $globals.Metaclass);
  14248. $core.addMethod(
  14249. $core.method({
  14250. selector: "theNonMetaClass",
  14251. protocol: "accessing",
  14252. fn: function (){
  14253. var self=this,$self=this;
  14254. return $core.withContext(function($ctx1) {
  14255. return $self._instanceClass();
  14256. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  14257. },
  14258. args: [],
  14259. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  14260. referencedClasses: [],
  14261. messageSends: ["instanceClass"]
  14262. }),
  14263. $globals.Metaclass);
  14264. $core.addMethod(
  14265. $core.method({
  14266. selector: "uses:instanceVariableNames:",
  14267. protocol: "accessing",
  14268. fn: function (aTraitCompositionDescription,aCollection){
  14269. var self=this,$self=this;
  14270. var metaclass;
  14271. return $core.withContext(function($ctx1) {
  14272. metaclass=$self._instanceVariableNames_(aCollection);
  14273. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  14274. return metaclass;
  14275. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  14276. },
  14277. args: ["aTraitCompositionDescription", "aCollection"],
  14278. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  14279. referencedClasses: [],
  14280. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  14281. }),
  14282. $globals.Metaclass);
  14283. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  14284. $globals.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:`.";
  14285. $core.addMethod(
  14286. $core.method({
  14287. selector: "addSubclassOf:named:instanceVariableNames:package:",
  14288. protocol: "class definition",
  14289. fn: function (aClass,className,aCollection,packageName){
  14290. var self=this,$self=this;
  14291. var theClass,thePackage;
  14292. return $core.withContext(function($ctx1) {
  14293. var $1,$2,$3,$receiver;
  14294. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  14295. thePackage=$recv($globals.Package)._named_(packageName);
  14296. $1=theClass;
  14297. if(($receiver = $1) == null || $receiver.a$nil){
  14298. $1;
  14299. } else {
  14300. $recv(theClass)._package_(thePackage);
  14301. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  14302. if(!$core.assert($2)){
  14303. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  14304. }
  14305. }
  14306. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  14307. $recv($3)._recompile();
  14308. return $recv($3)._yourself();
  14309. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  14310. },
  14311. args: ["aClass", "className", "aCollection", "packageName"],
  14312. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass\x0a\x09\x09\x09ifFalse: [ ^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ (self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName) recompile; yourself",
  14313. referencedClasses: ["Smalltalk", "Package"],
  14314. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  14315. }),
  14316. $globals.ClassBuilder);
  14317. $core.addMethod(
  14318. $core.method({
  14319. selector: "addTraitNamed:package:",
  14320. protocol: "class definition",
  14321. fn: function (traitName,packageName){
  14322. var self=this,$self=this;
  14323. var theTrait,thePackage;
  14324. return $core.withContext(function($ctx1) {
  14325. var $1,$2,$receiver;
  14326. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  14327. thePackage=$recv($globals.Package)._named_(packageName);
  14328. $1=theTrait;
  14329. if(($receiver = $1) == null || $receiver.a$nil){
  14330. $1;
  14331. } else {
  14332. $2=theTrait;
  14333. $recv($2)._package_(thePackage);
  14334. $recv($2)._recompile();
  14335. return $recv($2)._yourself();
  14336. }
  14337. return $self._basicAddTraitNamed_package_(traitName,packageName);
  14338. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  14339. },
  14340. args: ["traitName", "packageName"],
  14341. source: "addTraitNamed: traitName package: packageName\x0a\x09| theTrait thePackage |\x0a\x09\x0a\x09theTrait := Smalltalk globals at: traitName.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theTrait ifNotNil: [ ^ theTrait package: thePackage; recompile; yourself ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddTraitNamed: traitName\x0a\x09\x09package: packageName",
  14342. referencedClasses: ["Smalltalk", "Package"],
  14343. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  14344. }),
  14345. $globals.ClassBuilder);
  14346. $core.addMethod(
  14347. $core.method({
  14348. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  14349. protocol: "private",
  14350. fn: function (aClass,aString,aCollection,packageName){
  14351. var self=this,$self=this;
  14352. return $core.withContext(function($ctx1) {
  14353. return $core.addClass(aString, aClass, aCollection, packageName);
  14354. ;
  14355. return self;
  14356. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  14357. },
  14358. args: ["aClass", "aString", "aCollection", "packageName"],
  14359. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  14360. referencedClasses: [],
  14361. messageSends: []
  14362. }),
  14363. $globals.ClassBuilder);
  14364. $core.addMethod(
  14365. $core.method({
  14366. selector: "basicAddTraitNamed:package:",
  14367. protocol: "private",
  14368. fn: function (aString,anotherString){
  14369. var self=this,$self=this;
  14370. return $core.withContext(function($ctx1) {
  14371. return $core.addTrait(aString, anotherString);
  14372. return self;
  14373. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  14374. },
  14375. args: ["aString", "anotherString"],
  14376. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  14377. referencedClasses: [],
  14378. messageSends: []
  14379. }),
  14380. $globals.ClassBuilder);
  14381. $core.addMethod(
  14382. $core.method({
  14383. selector: "basicClass:instanceVariableNames:",
  14384. protocol: "private",
  14385. fn: function (aClass,aString){
  14386. var self=this,$self=this;
  14387. return $core.withContext(function($ctx1) {
  14388. $self._basicClass_instanceVariables_(aClass,$self._instanceVariableNamesFor_(aString));
  14389. return self;
  14390. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  14391. },
  14392. args: ["aClass", "aString"],
  14393. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  14394. referencedClasses: [],
  14395. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  14396. }),
  14397. $globals.ClassBuilder);
  14398. $core.addMethod(
  14399. $core.method({
  14400. selector: "basicClass:instanceVariables:",
  14401. protocol: "private",
  14402. fn: function (aClass,aCollection){
  14403. var self=this,$self=this;
  14404. return $core.withContext(function($ctx1) {
  14405. var $1;
  14406. $1=$recv(aClass)._isMetaclass();
  14407. if(!$core.assert($1)){
  14408. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  14409. }
  14410. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  14411. return self;
  14412. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  14413. },
  14414. args: ["aClass", "aCollection"],
  14415. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  14416. referencedClasses: [],
  14417. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  14418. }),
  14419. $globals.ClassBuilder);
  14420. $core.addMethod(
  14421. $core.method({
  14422. selector: "basicRemoveClass:",
  14423. protocol: "private",
  14424. fn: function (aClass){
  14425. var self=this,$self=this;
  14426. return $core.withContext(function($ctx1) {
  14427. $core.removeClass(aClass);
  14428. return self;
  14429. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  14430. },
  14431. args: ["aClass"],
  14432. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  14433. referencedClasses: [],
  14434. messageSends: []
  14435. }),
  14436. $globals.ClassBuilder);
  14437. $core.addMethod(
  14438. $core.method({
  14439. selector: "basicRenameClass:to:",
  14440. protocol: "private",
  14441. fn: function (aClass,aString){
  14442. var self=this,$self=this;
  14443. return $core.withContext(function($ctx1) {
  14444. $globals[aString] = aClass;
  14445. delete $globals[aClass.className];
  14446. aClass.className = aString;
  14447. ;
  14448. return self;
  14449. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  14450. },
  14451. args: ["aClass", "aString"],
  14452. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09'>",
  14453. referencedClasses: [],
  14454. messageSends: []
  14455. }),
  14456. $globals.ClassBuilder);
  14457. $core.addMethod(
  14458. $core.method({
  14459. selector: "basicSwapClassNames:with:",
  14460. protocol: "private",
  14461. fn: function (aClass,anotherClass){
  14462. var self=this,$self=this;
  14463. return $core.withContext(function($ctx1) {
  14464. var tmp = aClass.className;
  14465. aClass.className = anotherClass.className;
  14466. anotherClass.className = tmp;
  14467. ;
  14468. return self;
  14469. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  14470. },
  14471. args: ["aClass", "anotherClass"],
  14472. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09'>",
  14473. referencedClasses: [],
  14474. messageSends: []
  14475. }),
  14476. $globals.ClassBuilder);
  14477. $core.addMethod(
  14478. $core.method({
  14479. selector: "class:instanceVariableNames:",
  14480. protocol: "class definition",
  14481. fn: function (aClass,ivarNames){
  14482. var self=this,$self=this;
  14483. return $core.withContext(function($ctx1) {
  14484. var $1,$3,$2;
  14485. $self._basicClass_instanceVariableNames_(aClass,ivarNames);
  14486. $1=$recv($globals.SystemAnnouncer)._current();
  14487. $3=$recv($globals.ClassDefinitionChanged)._new();
  14488. $recv($3)._theClass_(aClass);
  14489. $2=$recv($3)._yourself();
  14490. $recv($1)._announce_($2);
  14491. return self;
  14492. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  14493. },
  14494. args: ["aClass", "ivarNames"],
  14495. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  14496. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  14497. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  14498. }),
  14499. $globals.ClassBuilder);
  14500. $core.addMethod(
  14501. $core.method({
  14502. selector: "copyClass:named:",
  14503. protocol: "copying",
  14504. fn: function (aClass,className){
  14505. var self=this,$self=this;
  14506. var newClass;
  14507. return $core.withContext(function($ctx1) {
  14508. var $1,$3,$2;
  14509. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  14510. $self._copyClass_to_(aClass,newClass);
  14511. $1=$recv($globals.SystemAnnouncer)._current();
  14512. $3=$recv($globals.ClassAdded)._new();
  14513. $recv($3)._theClass_(newClass);
  14514. $2=$recv($3)._yourself();
  14515. $recv($1)._announce_($2);
  14516. return newClass;
  14517. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  14518. },
  14519. args: ["aClass", "className"],
  14520. 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",
  14521. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  14522. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  14523. }),
  14524. $globals.ClassBuilder);
  14525. $core.addMethod(
  14526. $core.method({
  14527. selector: "copyClass:to:",
  14528. protocol: "copying",
  14529. fn: function (aClass,anotherClass){
  14530. var self=this,$self=this;
  14531. return $core.withContext(function($ctx1) {
  14532. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  14533. $recv(anotherClass)._comment_($recv(aClass)._comment());
  14534. $1=$recv(aClass)._methodDictionary();
  14535. $ctx1.sendIdx["methodDictionary"]=1;
  14536. $recv($1)._valuesDo_((function(each){
  14537. return $core.withContext(function($ctx2) {
  14538. $3=$recv(each)._methodClass();
  14539. $ctx2.sendIdx["methodClass"]=1;
  14540. $2=$recv($3).__eq(aClass);
  14541. $ctx2.sendIdx["="]=1;
  14542. if($core.assert($2)){
  14543. $4=$recv($globals.Compiler)._new();
  14544. $ctx2.sendIdx["new"]=1;
  14545. $5=$recv(each)._source();
  14546. $ctx2.sendIdx["source"]=1;
  14547. $6=$recv(each)._protocol();
  14548. $ctx2.sendIdx["protocol"]=1;
  14549. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  14550. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  14551. }
  14552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14553. }));
  14554. $ctx1.sendIdx["valuesDo:"]=1;
  14555. $7=$recv(aClass)._traitComposition();
  14556. $ctx1.sendIdx["traitComposition"]=1;
  14557. $recv(anotherClass)._setTraitComposition_($7);
  14558. $ctx1.sendIdx["setTraitComposition:"]=1;
  14559. $8=$recv(anotherClass)._class();
  14560. $ctx1.sendIdx["class"]=1;
  14561. $10=$recv(aClass)._class();
  14562. $ctx1.sendIdx["class"]=2;
  14563. $9=$recv($10)._instanceVariableNames();
  14564. $self._basicClass_instanceVariables_($8,$9);
  14565. $12=$recv(aClass)._class();
  14566. $ctx1.sendIdx["class"]=3;
  14567. $11=$recv($12)._methodDictionary();
  14568. $recv($11)._valuesDo_((function(each){
  14569. return $core.withContext(function($ctx2) {
  14570. $14=$recv(each)._methodClass();
  14571. $15=$recv(aClass)._class();
  14572. $ctx2.sendIdx["class"]=4;
  14573. $13=$recv($14).__eq($15);
  14574. if($core.assert($13)){
  14575. $16=$recv($globals.Compiler)._new();
  14576. $17=$recv(each)._source();
  14577. $18=$recv(anotherClass)._class();
  14578. $ctx2.sendIdx["class"]=5;
  14579. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  14580. }
  14581. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  14582. }));
  14583. $19=$recv(anotherClass)._class();
  14584. $ctx1.sendIdx["class"]=6;
  14585. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  14586. return self;
  14587. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  14588. },
  14589. args: ["aClass", "anotherClass"],
  14590. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ] ].\x0a\x09anotherClass setTraitComposition: aClass traitComposition.\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass class ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ].\x0a\x09anotherClass class setTraitComposition: aClass class traitComposition",
  14591. referencedClasses: ["Compiler"],
  14592. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  14593. }),
  14594. $globals.ClassBuilder);
  14595. $core.addMethod(
  14596. $core.method({
  14597. selector: "installMethod:forClass:protocol:",
  14598. protocol: "method definition",
  14599. fn: function (aCompiledMethod,aBehavior,aString){
  14600. var self=this,$self=this;
  14601. return $core.withContext(function($ctx1) {
  14602. $recv(aCompiledMethod)._protocol_(aString);
  14603. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  14604. return aCompiledMethod;
  14605. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  14606. },
  14607. args: ["aCompiledMethod", "aBehavior", "aString"],
  14608. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  14609. referencedClasses: [],
  14610. messageSends: ["protocol:", "addCompiledMethod:"]
  14611. }),
  14612. $globals.ClassBuilder);
  14613. $core.addMethod(
  14614. $core.method({
  14615. selector: "instanceVariableNamesFor:",
  14616. protocol: "accessing",
  14617. fn: function (aString){
  14618. var self=this,$self=this;
  14619. return $core.withContext(function($ctx1) {
  14620. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  14621. return $core.withContext(function($ctx2) {
  14622. return $recv(each)._isEmpty();
  14623. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14624. }));
  14625. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  14626. },
  14627. args: ["aString"],
  14628. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  14629. referencedClasses: [],
  14630. messageSends: ["reject:", "tokenize:", "isEmpty"]
  14631. }),
  14632. $globals.ClassBuilder);
  14633. $core.addMethod(
  14634. $core.method({
  14635. selector: "migrateClass:superclass:",
  14636. protocol: "class migration",
  14637. fn: function (aClass,anotherClass){
  14638. var self=this,$self=this;
  14639. return $core.withContext(function($ctx1) {
  14640. var $1;
  14641. $1=$recv(aClass)._name();
  14642. $ctx1.sendIdx["name"]=1;
  14643. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  14644. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  14645. },
  14646. args: ["aClass", "anotherClass"],
  14647. 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",
  14648. referencedClasses: [],
  14649. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  14650. }),
  14651. $globals.ClassBuilder);
  14652. $core.addMethod(
  14653. $core.method({
  14654. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  14655. protocol: "class migration",
  14656. fn: function (className,aClass,aCollection,packageName){
  14657. var self=this,$self=this;
  14658. var oldClass,newClass,tmp;
  14659. return $core.withContext(function($ctx1) {
  14660. var $1,$2,$4,$3;
  14661. tmp="new*".__comma(className);
  14662. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  14663. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  14664. $self._basicSwapClassNames_with_(oldClass,newClass);
  14665. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  14666. $recv((function(){
  14667. return $core.withContext(function($ctx2) {
  14668. return $self._copyClass_to_(oldClass,newClass);
  14669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14670. }))._on_do_($globals.Error,(function(exception){
  14671. return $core.withContext(function($ctx2) {
  14672. $self._basicSwapClassNames_with_(oldClass,newClass);
  14673. $1=$self._basicRemoveClass_(newClass);
  14674. $ctx2.sendIdx["basicRemoveClass:"]=1;
  14675. $1;
  14676. return $recv(exception)._resignal();
  14677. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  14678. }));
  14679. $self._rawRenameClass_to_(oldClass,tmp);
  14680. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  14681. $self._rawRenameClass_to_(newClass,className);
  14682. $recv($recv(oldClass)._subclasses())._do_((function(each){
  14683. return $core.withContext(function($ctx2) {
  14684. return $self._migrateClass_superclass_(each,newClass);
  14685. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  14686. }));
  14687. $self._basicRemoveClass_(oldClass);
  14688. $2=$recv($globals.SystemAnnouncer)._current();
  14689. $4=$recv($globals.ClassMigrated)._new();
  14690. $recv($4)._theClass_(newClass);
  14691. $recv($4)._oldClass_(oldClass);
  14692. $3=$recv($4)._yourself();
  14693. $recv($2)._announce_($3);
  14694. return newClass;
  14695. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},$globals.ClassBuilder)});
  14696. },
  14697. args: ["className", "aClass", "aCollection", "packageName"],
  14698. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals 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\x09\x09exception resignal ].\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\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",
  14699. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  14700. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  14701. }),
  14702. $globals.ClassBuilder);
  14703. $core.addMethod(
  14704. $core.method({
  14705. selector: "rawRenameClass:to:",
  14706. protocol: "private",
  14707. fn: function (aClass,aString){
  14708. var self=this,$self=this;
  14709. return $core.withContext(function($ctx1) {
  14710. $globals[aString] = aClass;
  14711. ;
  14712. return self;
  14713. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  14714. },
  14715. args: ["aClass", "aString"],
  14716. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  14717. referencedClasses: [],
  14718. messageSends: []
  14719. }),
  14720. $globals.ClassBuilder);
  14721. $core.addMethod(
  14722. $core.method({
  14723. selector: "renameClass:to:",
  14724. protocol: "class migration",
  14725. fn: function (aClass,className){
  14726. var self=this,$self=this;
  14727. return $core.withContext(function($ctx1) {
  14728. var $1,$3,$2;
  14729. $self._basicRenameClass_to_(aClass,className);
  14730. $recv(aClass)._recompile();
  14731. $1=$recv($globals.SystemAnnouncer)._current();
  14732. $3=$recv($globals.ClassRenamed)._new();
  14733. $recv($3)._theClass_(aClass);
  14734. $2=$recv($3)._yourself();
  14735. $recv($1)._announce_($2);
  14736. return self;
  14737. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  14738. },
  14739. args: ["aClass", "className"],
  14740. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  14741. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  14742. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  14743. }),
  14744. $globals.ClassBuilder);
  14745. $core.addMethod(
  14746. $core.method({
  14747. selector: "setupClass:",
  14748. protocol: "public",
  14749. fn: function (aClass){
  14750. var self=this,$self=this;
  14751. return $core.withContext(function($ctx1) {
  14752. $self._deprecatedAPI_("Classes are now auto-inited.");
  14753. return self;
  14754. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  14755. },
  14756. args: ["aClass"],
  14757. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  14758. referencedClasses: [],
  14759. messageSends: ["deprecatedAPI:"]
  14760. }),
  14761. $globals.ClassBuilder);
  14762. $core.addMethod(
  14763. $core.method({
  14764. selector: "superclass:subclass:",
  14765. protocol: "class definition",
  14766. fn: function (aClass,className){
  14767. var self=this,$self=this;
  14768. return $core.withContext(function($ctx1) {
  14769. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  14770. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  14771. },
  14772. args: ["aClass", "className"],
  14773. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  14774. referencedClasses: [],
  14775. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  14776. }),
  14777. $globals.ClassBuilder);
  14778. $core.addMethod(
  14779. $core.method({
  14780. selector: "superclass:subclass:instanceVariableNames:package:",
  14781. protocol: "class definition",
  14782. fn: function (aClass,className,ivarNames,packageName){
  14783. var self=this,$self=this;
  14784. var newClass;
  14785. return $core.withContext(function($ctx1) {
  14786. var $1,$2,$3,$5,$4,$receiver;
  14787. $1=$self._instanceVariableNamesFor_(ivarNames);
  14788. if(($receiver = packageName) == null || $receiver.a$nil){
  14789. $2="unclassified";
  14790. } else {
  14791. $2=packageName;
  14792. }
  14793. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  14794. $3=$recv($globals.SystemAnnouncer)._current();
  14795. $5=$recv($globals.ClassAdded)._new();
  14796. $recv($5)._theClass_(newClass);
  14797. $4=$recv($5)._yourself();
  14798. $recv($3)._announce_($4);
  14799. return newClass;
  14800. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  14801. },
  14802. args: ["aClass", "className", "ivarNames", "packageName"],
  14803. 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\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  14804. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  14805. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  14806. }),
  14807. $globals.ClassBuilder);
  14808. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  14809. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  14810. $core.addMethod(
  14811. $core.method({
  14812. selector: "getNodesFrom:",
  14813. protocol: "accessing",
  14814. fn: function (aCollection){
  14815. var self=this,$self=this;
  14816. var children,others;
  14817. return $core.withContext(function($ctx1) {
  14818. var $1;
  14819. children=[];
  14820. others=[];
  14821. $recv(aCollection)._do_((function(each){
  14822. return $core.withContext(function($ctx2) {
  14823. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  14824. if($core.assert($1)){
  14825. return $recv(children)._add_(each);
  14826. $ctx2.sendIdx["add:"]=1;
  14827. } else {
  14828. return $recv(others)._add_(each);
  14829. }
  14830. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14831. }));
  14832. $self["@nodes"]=$recv(children)._collect_((function(each){
  14833. return $core.withContext(function($ctx2) {
  14834. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  14835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  14836. }));
  14837. return self;
  14838. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  14839. },
  14840. args: ["aCollection"],
  14841. 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 ]",
  14842. referencedClasses: ["ClassSorterNode"],
  14843. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  14844. }),
  14845. $globals.ClassSorterNode);
  14846. $core.addMethod(
  14847. $core.method({
  14848. selector: "level",
  14849. protocol: "accessing",
  14850. fn: function (){
  14851. var self=this,$self=this;
  14852. return $self["@level"];
  14853. },
  14854. args: [],
  14855. source: "level\x0a\x09^ level",
  14856. referencedClasses: [],
  14857. messageSends: []
  14858. }),
  14859. $globals.ClassSorterNode);
  14860. $core.addMethod(
  14861. $core.method({
  14862. selector: "level:",
  14863. protocol: "accessing",
  14864. fn: function (anInteger){
  14865. var self=this,$self=this;
  14866. $self["@level"]=anInteger;
  14867. return self;
  14868. },
  14869. args: ["anInteger"],
  14870. source: "level: anInteger\x0a\x09level := anInteger",
  14871. referencedClasses: [],
  14872. messageSends: []
  14873. }),
  14874. $globals.ClassSorterNode);
  14875. $core.addMethod(
  14876. $core.method({
  14877. selector: "nodes",
  14878. protocol: "accessing",
  14879. fn: function (){
  14880. var self=this,$self=this;
  14881. return $self["@nodes"];
  14882. },
  14883. args: [],
  14884. source: "nodes\x0a\x09^ nodes",
  14885. referencedClasses: [],
  14886. messageSends: []
  14887. }),
  14888. $globals.ClassSorterNode);
  14889. $core.addMethod(
  14890. $core.method({
  14891. selector: "theClass",
  14892. protocol: "accessing",
  14893. fn: function (){
  14894. var self=this,$self=this;
  14895. return $self["@theClass"];
  14896. },
  14897. args: [],
  14898. source: "theClass\x0a\x09^ theClass",
  14899. referencedClasses: [],
  14900. messageSends: []
  14901. }),
  14902. $globals.ClassSorterNode);
  14903. $core.addMethod(
  14904. $core.method({
  14905. selector: "theClass:",
  14906. protocol: "accessing",
  14907. fn: function (aClass){
  14908. var self=this,$self=this;
  14909. $self["@theClass"]=aClass;
  14910. return self;
  14911. },
  14912. args: ["aClass"],
  14913. source: "theClass: aClass\x0a\x09theClass := aClass",
  14914. referencedClasses: [],
  14915. messageSends: []
  14916. }),
  14917. $globals.ClassSorterNode);
  14918. $core.addMethod(
  14919. $core.method({
  14920. selector: "traverseClassesWith:",
  14921. protocol: "visiting",
  14922. fn: function (aCollection){
  14923. var self=this,$self=this;
  14924. return $core.withContext(function($ctx1) {
  14925. var $1,$3,$2;
  14926. $1=$self._theClass();
  14927. $ctx1.sendIdx["theClass"]=1;
  14928. $recv(aCollection)._add_($1);
  14929. $recv($recv($self._nodes())._sorted_((function(a,b){
  14930. return $core.withContext(function($ctx2) {
  14931. $3=$recv(a)._theClass();
  14932. $ctx2.sendIdx["theClass"]=2;
  14933. $2=$recv($3)._name();
  14934. $ctx2.sendIdx["name"]=1;
  14935. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  14936. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  14937. })))._do_((function(aNode){
  14938. return $core.withContext(function($ctx2) {
  14939. return $recv(aNode)._traverseClassesWith_(aCollection);
  14940. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  14941. }));
  14942. return self;
  14943. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  14944. },
  14945. args: ["aCollection"],
  14946. 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 ].",
  14947. referencedClasses: [],
  14948. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  14949. }),
  14950. $globals.ClassSorterNode);
  14951. $core.addMethod(
  14952. $core.method({
  14953. selector: "on:classes:level:",
  14954. protocol: "instance creation",
  14955. fn: function (aClass,aCollection,anInteger){
  14956. var self=this,$self=this;
  14957. return $core.withContext(function($ctx1) {
  14958. var $1;
  14959. $1=$self._new();
  14960. $recv($1)._theClass_(aClass);
  14961. $recv($1)._level_(anInteger);
  14962. $recv($1)._getNodesFrom_(aCollection);
  14963. return $recv($1)._yourself();
  14964. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  14965. },
  14966. args: ["aClass", "aCollection", "anInteger"],
  14967. 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",
  14968. referencedClasses: [],
  14969. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  14970. }),
  14971. $globals.ClassSorterNode.a$cls);
  14972. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  14973. $core.addMethod(
  14974. $core.method({
  14975. selector: "allInstanceVariableNames",
  14976. protocol: "accessing",
  14977. fn: function (){
  14978. var self=this,$self=this;
  14979. return [];
  14980. },
  14981. args: [],
  14982. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  14983. referencedClasses: [],
  14984. messageSends: []
  14985. }),
  14986. $globals.TBehaviorDefaults);
  14987. $core.addMethod(
  14988. $core.method({
  14989. selector: "allSubclassesDo:",
  14990. protocol: "enumerating",
  14991. fn: function (aBlock){
  14992. var self=this,$self=this;
  14993. return self;
  14994. },
  14995. args: ["aBlock"],
  14996. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  14997. referencedClasses: [],
  14998. messageSends: []
  14999. }),
  15000. $globals.TBehaviorDefaults);
  15001. $core.addMethod(
  15002. $core.method({
  15003. selector: "name",
  15004. protocol: "accessing",
  15005. fn: function (){
  15006. var self=this,$self=this;
  15007. return nil;
  15008. },
  15009. args: [],
  15010. source: "name\x0a\x09^ nil",
  15011. referencedClasses: [],
  15012. messageSends: []
  15013. }),
  15014. $globals.TBehaviorDefaults);
  15015. $core.addMethod(
  15016. $core.method({
  15017. selector: "printOn:",
  15018. protocol: "printing",
  15019. fn: function (aStream){
  15020. var self=this,$self=this;
  15021. return $core.withContext(function($ctx1) {
  15022. var $1,$receiver;
  15023. $1=$self._name();
  15024. if(($receiver = $1) == null || $receiver.a$nil){
  15025. (
  15026. $ctx1.supercall = true,
  15027. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15028. $ctx1.supercall = false;
  15029. } else {
  15030. var name;
  15031. name=$receiver;
  15032. $recv(aStream)._nextPutAll_(name);
  15033. }
  15034. return self;
  15035. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  15036. },
  15037. args: ["aStream"],
  15038. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  15039. referencedClasses: [],
  15040. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  15041. }),
  15042. $globals.TBehaviorDefaults);
  15043. $core.addMethod(
  15044. $core.method({
  15045. selector: "superclass",
  15046. protocol: "accessing",
  15047. fn: function (){
  15048. var self=this,$self=this;
  15049. return nil;
  15050. },
  15051. args: [],
  15052. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  15053. referencedClasses: [],
  15054. messageSends: []
  15055. }),
  15056. $globals.TBehaviorDefaults);
  15057. $core.addMethod(
  15058. $core.method({
  15059. selector: "traitUsers",
  15060. protocol: "accessing",
  15061. fn: function (){
  15062. var self=this,$self=this;
  15063. return [];
  15064. },
  15065. args: [],
  15066. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  15067. referencedClasses: [],
  15068. messageSends: []
  15069. }),
  15070. $globals.TBehaviorDefaults);
  15071. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  15072. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  15073. $core.addMethod(
  15074. $core.method({
  15075. selector: ">>",
  15076. protocol: "accessing",
  15077. fn: function (aString){
  15078. var self=this,$self=this;
  15079. return $core.withContext(function($ctx1) {
  15080. return $self._methodAt_(aString);
  15081. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  15082. },
  15083. args: ["aString"],
  15084. source: ">> aString\x0a\x09^ self methodAt: aString",
  15085. referencedClasses: [],
  15086. messageSends: ["methodAt:"]
  15087. }),
  15088. $globals.TBehaviorProvider);
  15089. $core.addMethod(
  15090. $core.method({
  15091. selector: "addCompiledMethod:",
  15092. protocol: "compiling",
  15093. fn: function (aMethod){
  15094. var self=this,$self=this;
  15095. var oldMethod,announcement;
  15096. return $core.withContext(function($ctx1) {
  15097. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  15098. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  15099. return nil;
  15100. }));
  15101. $2=$self._protocols();
  15102. $3=$recv(aMethod)._protocol();
  15103. $ctx1.sendIdx["protocol"]=1;
  15104. $1=$recv($2)._includes_($3);
  15105. if(!$core.assert($1)){
  15106. $4=$self._organization();
  15107. $5=$recv(aMethod)._protocol();
  15108. $ctx1.sendIdx["protocol"]=2;
  15109. $recv($4)._addElement_($5);
  15110. }
  15111. $self._basicAddCompiledMethod_(aMethod);
  15112. $6=oldMethod;
  15113. if(($receiver = $6) == null || $receiver.a$nil){
  15114. $6;
  15115. } else {
  15116. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  15117. }
  15118. $7=oldMethod;
  15119. if(($receiver = $7) == null || $receiver.a$nil){
  15120. $8=$recv($globals.MethodAdded)._new();
  15121. $ctx1.sendIdx["new"]=1;
  15122. $recv($8)._method_(aMethod);
  15123. $ctx1.sendIdx["method:"]=1;
  15124. $9=$recv($8)._yourself();
  15125. $ctx1.sendIdx["yourself"]=1;
  15126. announcement=$9;
  15127. } else {
  15128. $10=$recv($globals.MethodModified)._new();
  15129. $recv($10)._oldMethod_(oldMethod);
  15130. $recv($10)._method_(aMethod);
  15131. announcement=$recv($10)._yourself();
  15132. }
  15133. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  15134. return self;
  15135. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  15136. },
  15137. args: ["aMethod"],
  15138. 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\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\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",
  15139. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  15140. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  15141. }),
  15142. $globals.TBehaviorProvider);
  15143. $core.addMethod(
  15144. $core.method({
  15145. selector: "basicAddCompiledMethod:",
  15146. protocol: "private",
  15147. fn: function (aMethod){
  15148. var self=this,$self=this;
  15149. return $core.withContext(function($ctx1) {
  15150. $core.addMethod(aMethod, self);
  15151. return self;
  15152. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15153. },
  15154. args: ["aMethod"],
  15155. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  15156. referencedClasses: [],
  15157. messageSends: []
  15158. }),
  15159. $globals.TBehaviorProvider);
  15160. $core.addMethod(
  15161. $core.method({
  15162. selector: "basicRemoveCompiledMethod:",
  15163. protocol: "private",
  15164. fn: function (aMethod){
  15165. var self=this,$self=this;
  15166. return $core.withContext(function($ctx1) {
  15167. $core.removeMethod(aMethod,self);
  15168. return self;
  15169. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15170. },
  15171. args: ["aMethod"],
  15172. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  15173. referencedClasses: [],
  15174. messageSends: []
  15175. }),
  15176. $globals.TBehaviorProvider);
  15177. $core.addMethod(
  15178. $core.method({
  15179. selector: "compile:protocol:",
  15180. protocol: "compiling",
  15181. fn: function (aString,anotherString){
  15182. var self=this,$self=this;
  15183. return $core.withContext(function($ctx1) {
  15184. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  15185. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  15186. },
  15187. args: ["aString", "anotherString"],
  15188. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  15189. referencedClasses: ["Compiler"],
  15190. messageSends: ["install:forClass:protocol:", "new"]
  15191. }),
  15192. $globals.TBehaviorProvider);
  15193. $core.addMethod(
  15194. $core.method({
  15195. selector: "includesSelector:",
  15196. protocol: "testing",
  15197. fn: function (aString){
  15198. var self=this,$self=this;
  15199. return $core.withContext(function($ctx1) {
  15200. return $recv($self._methodDictionary())._includesKey_(aString);
  15201. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  15202. },
  15203. args: ["aString"],
  15204. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  15205. referencedClasses: [],
  15206. messageSends: ["includesKey:", "methodDictionary"]
  15207. }),
  15208. $globals.TBehaviorProvider);
  15209. $core.addMethod(
  15210. $core.method({
  15211. selector: "methodAt:",
  15212. protocol: "accessing",
  15213. fn: function (aString){
  15214. var self=this,$self=this;
  15215. return $core.withContext(function($ctx1) {
  15216. return $recv($self._methodDictionary())._at_(aString);
  15217. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  15218. },
  15219. args: ["aString"],
  15220. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  15221. referencedClasses: [],
  15222. messageSends: ["at:", "methodDictionary"]
  15223. }),
  15224. $globals.TBehaviorProvider);
  15225. $core.addMethod(
  15226. $core.method({
  15227. selector: "methodDictionary",
  15228. protocol: "accessing",
  15229. fn: function (){
  15230. var self=this,$self=this;
  15231. return $core.withContext(function($ctx1) {
  15232. var dict = $globals.HashedCollection._new();
  15233. var methods = self.methods;
  15234. Object.keys(methods).forEach(function(i) {
  15235. if(methods[i].selector) {
  15236. dict._at_put_(methods[i].selector, methods[i]);
  15237. }
  15238. });
  15239. return dict;
  15240. return self;
  15241. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  15242. },
  15243. args: [],
  15244. source: "methodDictionary\x0a\x09<inlineJS: 'var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\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'>",
  15245. referencedClasses: [],
  15246. messageSends: []
  15247. }),
  15248. $globals.TBehaviorProvider);
  15249. $core.addMethod(
  15250. $core.method({
  15251. selector: "methodTemplate",
  15252. protocol: "accessing",
  15253. fn: function (){
  15254. var self=this,$self=this;
  15255. return $core.withContext(function($ctx1) {
  15256. return $recv($globals.String)._streamContents_((function(stream){
  15257. return $core.withContext(function($ctx2) {
  15258. $recv(stream)._write_("messageSelectorAndArgumentNames");
  15259. $ctx2.sendIdx["write:"]=1;
  15260. $recv(stream)._lf();
  15261. $ctx2.sendIdx["lf"]=1;
  15262. $recv(stream)._tab();
  15263. $ctx2.sendIdx["tab"]=1;
  15264. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  15265. $ctx2.sendIdx["write:"]=2;
  15266. $recv(stream)._lf();
  15267. $ctx2.sendIdx["lf"]=2;
  15268. $recv(stream)._lf();
  15269. $ctx2.sendIdx["lf"]=3;
  15270. $recv(stream)._tab();
  15271. $ctx2.sendIdx["tab"]=2;
  15272. $recv(stream)._write_("| temporary variable names |");
  15273. $ctx2.sendIdx["write:"]=3;
  15274. $recv(stream)._lf();
  15275. $recv(stream)._tab();
  15276. return $recv(stream)._write_("statements");
  15277. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15278. }));
  15279. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  15280. },
  15281. args: [],
  15282. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: 'messageSelectorAndArgumentNames'; lf;\x0a\x09\x09tab; write: '\x22comment stating purpose of message\x22'; lf;\x0a\x09\x09lf;\x0a\x09\x09tab; write: '| temporary variable names |'; lf;\x0a\x09\x09tab; write: 'statements' ]",
  15283. referencedClasses: ["String"],
  15284. messageSends: ["streamContents:", "write:", "lf", "tab"]
  15285. }),
  15286. $globals.TBehaviorProvider);
  15287. $core.addMethod(
  15288. $core.method({
  15289. selector: "methods",
  15290. protocol: "accessing",
  15291. fn: function (){
  15292. var self=this,$self=this;
  15293. return $core.withContext(function($ctx1) {
  15294. return $recv($self._methodDictionary())._values();
  15295. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  15296. },
  15297. args: [],
  15298. source: "methods\x0a\x09^ self methodDictionary values",
  15299. referencedClasses: [],
  15300. messageSends: ["values", "methodDictionary"]
  15301. }),
  15302. $globals.TBehaviorProvider);
  15303. $core.addMethod(
  15304. $core.method({
  15305. selector: "methodsInProtocol:",
  15306. protocol: "accessing",
  15307. fn: function (aString){
  15308. var self=this,$self=this;
  15309. return $core.withContext(function($ctx1) {
  15310. return $recv($self._methods())._select_((function(each){
  15311. return $core.withContext(function($ctx2) {
  15312. return $recv($recv(each)._protocol()).__eq(aString);
  15313. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15314. }));
  15315. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  15316. },
  15317. args: ["aString"],
  15318. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  15319. referencedClasses: [],
  15320. messageSends: ["select:", "methods", "=", "protocol"]
  15321. }),
  15322. $globals.TBehaviorProvider);
  15323. $core.addMethod(
  15324. $core.method({
  15325. selector: "organization",
  15326. protocol: "accessing",
  15327. fn: function (){
  15328. var self=this,$self=this;
  15329. return $core.withContext(function($ctx1) {
  15330. return $self._basicAt_("organization");
  15331. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  15332. },
  15333. args: [],
  15334. source: "organization\x0a\x09^ self basicAt: 'organization'",
  15335. referencedClasses: [],
  15336. messageSends: ["basicAt:"]
  15337. }),
  15338. $globals.TBehaviorProvider);
  15339. $core.addMethod(
  15340. $core.method({
  15341. selector: "ownMethods",
  15342. protocol: "accessing",
  15343. fn: function (){
  15344. var self=this,$self=this;
  15345. return $core.withContext(function($ctx1) {
  15346. var $1;
  15347. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  15348. return $core.withContext(function($ctx2) {
  15349. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  15350. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  15351. })))._sorted_((function(a,b){
  15352. return $core.withContext(function($ctx2) {
  15353. $1=$recv(a)._selector();
  15354. $ctx2.sendIdx["selector"]=1;
  15355. return $recv($1).__lt_eq($recv(b)._selector());
  15356. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  15357. }));
  15358. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  15359. },
  15360. args: [],
  15361. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x0a\x09nor obtained via trait composition\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self ownMethodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  15362. referencedClasses: ["OrderedCollection"],
  15363. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  15364. }),
  15365. $globals.TBehaviorProvider);
  15366. $core.addMethod(
  15367. $core.method({
  15368. selector: "ownMethodsInProtocol:",
  15369. protocol: "accessing",
  15370. fn: function (aString){
  15371. var self=this,$self=this;
  15372. return $core.withContext(function($ctx1) {
  15373. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  15374. return $core.withContext(function($ctx2) {
  15375. return $recv($recv(each)._methodClass()).__eq(self);
  15376. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15377. }));
  15378. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  15379. },
  15380. args: ["aString"],
  15381. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  15382. referencedClasses: [],
  15383. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  15384. }),
  15385. $globals.TBehaviorProvider);
  15386. $core.addMethod(
  15387. $core.method({
  15388. selector: "ownProtocols",
  15389. protocol: "accessing",
  15390. fn: function (){
  15391. var self=this,$self=this;
  15392. return $core.withContext(function($ctx1) {
  15393. return $recv($self._protocols())._reject_((function(each){
  15394. return $core.withContext(function($ctx2) {
  15395. return $recv(each)._match_("^\x5c*");
  15396. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15397. }));
  15398. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  15399. },
  15400. args: [],
  15401. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  15402. referencedClasses: [],
  15403. messageSends: ["reject:", "protocols", "match:"]
  15404. }),
  15405. $globals.TBehaviorProvider);
  15406. $core.addMethod(
  15407. $core.method({
  15408. selector: "packageOfProtocol:",
  15409. protocol: "accessing",
  15410. fn: function (aString){
  15411. var self=this,$self=this;
  15412. return $core.withContext(function($ctx1) {
  15413. var $1;
  15414. $1=$recv(aString)._beginsWith_("*");
  15415. if(!$core.assert($1)){
  15416. return $self._package();
  15417. }
  15418. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  15419. return nil;
  15420. }));
  15421. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  15422. },
  15423. args: ["aString"],
  15424. source: "packageOfProtocol: aString\x0a\x09\x22Answer the package the method of receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the receiver's package\x22\x0a\x09\x0a\x09(aString beginsWith: '*') ifFalse: [\x0a\x09\x09^ self package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: aString allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  15425. referencedClasses: ["Package"],
  15426. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  15427. }),
  15428. $globals.TBehaviorProvider);
  15429. $core.addMethod(
  15430. $core.method({
  15431. selector: "protocols",
  15432. protocol: "accessing",
  15433. fn: function (){
  15434. var self=this,$self=this;
  15435. return $core.withContext(function($ctx1) {
  15436. return $recv($recv($self._organization())._elements())._sorted();
  15437. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  15438. },
  15439. args: [],
  15440. source: "protocols\x0a\x09^ self organization elements sorted",
  15441. referencedClasses: [],
  15442. messageSends: ["sorted", "elements", "organization"]
  15443. }),
  15444. $globals.TBehaviorProvider);
  15445. $core.addMethod(
  15446. $core.method({
  15447. selector: "protocolsDo:",
  15448. protocol: "enumerating",
  15449. fn: function (aBlock){
  15450. var self=this,$self=this;
  15451. var methodsByProtocol;
  15452. return $core.withContext(function($ctx1) {
  15453. methodsByProtocol=$recv($globals.HashedCollection)._new();
  15454. $ctx1.sendIdx["new"]=1;
  15455. $recv($self._methodDictionary())._valuesDo_((function(m){
  15456. return $core.withContext(function($ctx2) {
  15457. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  15458. return $core.withContext(function($ctx3) {
  15459. return $recv($globals.Array)._new();
  15460. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  15461. })))._add_(m);
  15462. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  15463. }));
  15464. $recv($self._protocols())._do_((function(protocol){
  15465. return $core.withContext(function($ctx2) {
  15466. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  15467. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  15468. }));
  15469. return self;
  15470. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  15471. },
  15472. args: ["aBlock"],
  15473. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
  15474. referencedClasses: ["HashedCollection", "Array"],
  15475. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  15476. }),
  15477. $globals.TBehaviorProvider);
  15478. $core.addMethod(
  15479. $core.method({
  15480. selector: "recompile",
  15481. protocol: "compiling",
  15482. fn: function (){
  15483. var self=this,$self=this;
  15484. return $core.withContext(function($ctx1) {
  15485. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  15486. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  15487. },
  15488. args: [],
  15489. source: "recompile\x0a\x09^ Compiler new recompile: self",
  15490. referencedClasses: ["Compiler"],
  15491. messageSends: ["recompile:", "new"]
  15492. }),
  15493. $globals.TBehaviorProvider);
  15494. $core.addMethod(
  15495. $core.method({
  15496. selector: "removeCompiledMethod:",
  15497. protocol: "compiling",
  15498. fn: function (aMethod){
  15499. var self=this,$self=this;
  15500. return $core.withContext(function($ctx1) {
  15501. var $1,$3,$2;
  15502. $self._basicRemoveCompiledMethod_(aMethod);
  15503. $self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  15504. $1=$recv($globals.SystemAnnouncer)._current();
  15505. $3=$recv($globals.MethodRemoved)._new();
  15506. $recv($3)._method_(aMethod);
  15507. $2=$recv($3)._yourself();
  15508. $recv($1)._announce_($2);
  15509. return self;
  15510. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15511. },
  15512. args: ["aMethod"],
  15513. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  15514. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  15515. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  15516. }),
  15517. $globals.TBehaviorProvider);
  15518. $core.addMethod(
  15519. $core.method({
  15520. selector: "removeProtocolIfEmpty:",
  15521. protocol: "accessing",
  15522. fn: function (aString){
  15523. var self=this,$self=this;
  15524. return $core.withContext(function($ctx1) {
  15525. $recv($self._methods())._detect_ifNone_((function(each){
  15526. return $core.withContext(function($ctx2) {
  15527. return $recv($recv(each)._protocol()).__eq(aString);
  15528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15529. }),(function(){
  15530. return $core.withContext(function($ctx2) {
  15531. return $recv($self._organization())._removeElement_(aString);
  15532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15533. }));
  15534. return self;
  15535. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  15536. },
  15537. args: ["aString"],
  15538. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  15539. referencedClasses: [],
  15540. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  15541. }),
  15542. $globals.TBehaviorProvider);
  15543. $core.addMethod(
  15544. $core.method({
  15545. selector: "selectors",
  15546. protocol: "accessing",
  15547. fn: function (){
  15548. var self=this,$self=this;
  15549. return $core.withContext(function($ctx1) {
  15550. return $recv($self._methodDictionary())._keys();
  15551. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  15552. },
  15553. args: [],
  15554. source: "selectors\x0a\x09^ self methodDictionary keys",
  15555. referencedClasses: [],
  15556. messageSends: ["keys", "methodDictionary"]
  15557. }),
  15558. $globals.TBehaviorProvider);
  15559. $core.addMethod(
  15560. $core.method({
  15561. selector: "setTraitComposition:",
  15562. protocol: "compiling",
  15563. fn: function (aTraitComposition){
  15564. var self=this,$self=this;
  15565. return $core.withContext(function($ctx1) {
  15566. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  15567. return self;
  15568. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  15569. },
  15570. args: ["aTraitComposition"],
  15571. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  15572. referencedClasses: [],
  15573. messageSends: []
  15574. }),
  15575. $globals.TBehaviorProvider);
  15576. $core.addMethod(
  15577. $core.method({
  15578. selector: "traitComposition",
  15579. protocol: "accessing",
  15580. fn: function (){
  15581. var self=this,$self=this;
  15582. return $core.withContext(function($ctx1) {
  15583. return $recv($self._basicAt_("traitComposition"))._collect_((function(each){
  15584. return $core.withContext(function($ctx2) {
  15585. return $recv($globals.TraitTransformation)._fromJSON_(each);
  15586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15587. }));
  15588. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  15589. },
  15590. args: [],
  15591. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition') collect: [ :each | TraitTransformation fromJSON: each ]",
  15592. referencedClasses: ["TraitTransformation"],
  15593. messageSends: ["collect:", "basicAt:", "fromJSON:"]
  15594. }),
  15595. $globals.TBehaviorProvider);
  15596. $core.addMethod(
  15597. $core.method({
  15598. selector: "traitCompositionDefinition",
  15599. protocol: "accessing",
  15600. fn: function (){
  15601. var self=this,$self=this;
  15602. return $core.withContext(function($ctx1) {
  15603. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  15604. return $core.withContext(function($ctx2) {
  15605. return $recv($globals.String)._streamContents_((function(str){
  15606. return $core.withContext(function($ctx3) {
  15607. $recv(str)._write_("{");
  15608. $ctx3.sendIdx["write:"]=1;
  15609. $recv(traitComposition)._do_separatedBy_((function(each){
  15610. return $core.withContext(function($ctx4) {
  15611. return $recv(str)._write_($recv(each)._definition());
  15612. $ctx4.sendIdx["write:"]=2;
  15613. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  15614. }),(function(){
  15615. return $core.withContext(function($ctx4) {
  15616. return $recv(str)._write_(". ");
  15617. $ctx4.sendIdx["write:"]=3;
  15618. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  15619. }));
  15620. return $recv(str)._write_("}");
  15621. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  15622. }));
  15623. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  15624. }));
  15625. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  15626. },
  15627. args: [],
  15628. source: "traitCompositionDefinition\x0a\x09^ self traitComposition ifNotEmpty: [ :traitComposition |\x0a\x09\x09String streamContents: [ :str |\x0a\x09\x09\x09str write: '{'.\x0a\x09\x09\x09traitComposition\x0a\x09\x09\x09\x09do: [ :each | str write: each definition ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ] ]",
  15629. referencedClasses: ["String"],
  15630. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  15631. }),
  15632. $globals.TBehaviorProvider);
  15633. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  15634. $globals.TMasterBehavior.comment="I am the behavior on the instance-side of the browser.\x0a\x0aI define things like package, category, name, comment etc.\x0aas opposed to derived behaviors (metaclass, class trait, ...)\x0athat relate to me.";
  15635. $core.addMethod(
  15636. $core.method({
  15637. selector: "asJavaScriptSource",
  15638. protocol: "converting",
  15639. fn: function (){
  15640. var self=this,$self=this;
  15641. return $core.withContext(function($ctx1) {
  15642. return "$globals.".__comma($self._name());
  15643. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  15644. },
  15645. args: [],
  15646. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  15647. referencedClasses: [],
  15648. messageSends: [",", "name"]
  15649. }),
  15650. $globals.TMasterBehavior);
  15651. $core.addMethod(
  15652. $core.method({
  15653. selector: "browse",
  15654. protocol: "browsing",
  15655. fn: function (){
  15656. var self=this,$self=this;
  15657. return $core.withContext(function($ctx1) {
  15658. $recv($globals.Finder)._findClass_(self);
  15659. return self;
  15660. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  15661. },
  15662. args: [],
  15663. source: "browse\x0a\x09Finder findClass: self",
  15664. referencedClasses: ["Finder"],
  15665. messageSends: ["findClass:"]
  15666. }),
  15667. $globals.TMasterBehavior);
  15668. $core.addMethod(
  15669. $core.method({
  15670. selector: "category",
  15671. protocol: "accessing",
  15672. fn: function (){
  15673. var self=this,$self=this;
  15674. return $core.withContext(function($ctx1) {
  15675. var $1,$receiver;
  15676. $1=$self._package();
  15677. $ctx1.sendIdx["package"]=1;
  15678. if(($receiver = $1) == null || $receiver.a$nil){
  15679. return "Unclassified";
  15680. } else {
  15681. return $recv($self._package())._name();
  15682. }
  15683. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  15684. },
  15685. args: [],
  15686. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  15687. referencedClasses: [],
  15688. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  15689. }),
  15690. $globals.TMasterBehavior);
  15691. $core.addMethod(
  15692. $core.method({
  15693. selector: "classTag",
  15694. protocol: "accessing",
  15695. fn: function (){
  15696. var self=this,$self=this;
  15697. return $core.withContext(function($ctx1) {
  15698. return $self._subclassResponsibility();
  15699. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  15700. },
  15701. args: [],
  15702. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  15703. referencedClasses: [],
  15704. messageSends: ["subclassResponsibility"]
  15705. }),
  15706. $globals.TMasterBehavior);
  15707. $core.addMethod(
  15708. $core.method({
  15709. selector: "comment",
  15710. protocol: "accessing",
  15711. fn: function (){
  15712. var self=this,$self=this;
  15713. return $core.withContext(function($ctx1) {
  15714. var $1,$receiver;
  15715. $1=$self._basicAt_("comment");
  15716. if(($receiver = $1) == null || $receiver.a$nil){
  15717. return "";
  15718. } else {
  15719. return $1;
  15720. }
  15721. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  15722. },
  15723. args: [],
  15724. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  15725. referencedClasses: [],
  15726. messageSends: ["ifNil:", "basicAt:"]
  15727. }),
  15728. $globals.TMasterBehavior);
  15729. $core.addMethod(
  15730. $core.method({
  15731. selector: "comment:",
  15732. protocol: "accessing",
  15733. fn: function (aString){
  15734. var self=this,$self=this;
  15735. return $core.withContext(function($ctx1) {
  15736. var $1,$3,$2;
  15737. $self._basicAt_put_("comment",aString);
  15738. $1=$recv($globals.SystemAnnouncer)._current();
  15739. $3=$recv($globals.ClassCommentChanged)._new();
  15740. $recv($3)._theClass_(self);
  15741. $2=$recv($3)._yourself();
  15742. $recv($1)._announce_($2);
  15743. return self;
  15744. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  15745. },
  15746. args: ["aString"],
  15747. 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)",
  15748. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  15749. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  15750. }),
  15751. $globals.TMasterBehavior);
  15752. $core.addMethod(
  15753. $core.method({
  15754. selector: "name",
  15755. protocol: "accessing",
  15756. fn: function (){
  15757. var self=this,$self=this;
  15758. return $core.withContext(function($ctx1) {
  15759. return self.className;
  15760. return self;
  15761. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  15762. },
  15763. args: [],
  15764. source: "name\x0a\x09<inlineJS: 'return self.className'>",
  15765. referencedClasses: [],
  15766. messageSends: []
  15767. }),
  15768. $globals.TMasterBehavior);
  15769. $core.addMethod(
  15770. $core.method({
  15771. selector: "package",
  15772. protocol: "accessing",
  15773. fn: function (){
  15774. var self=this,$self=this;
  15775. return $core.withContext(function($ctx1) {
  15776. return $self._basicAt_("pkg");
  15777. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.TMasterBehavior)});
  15778. },
  15779. args: [],
  15780. source: "package\x0a\x09^ self basicAt: 'pkg'",
  15781. referencedClasses: [],
  15782. messageSends: ["basicAt:"]
  15783. }),
  15784. $globals.TMasterBehavior);
  15785. $core.addMethod(
  15786. $core.method({
  15787. selector: "package:",
  15788. protocol: "accessing",
  15789. fn: function (aPackage){
  15790. var self=this,$self=this;
  15791. var oldPackage;
  15792. return $core.withContext(function($ctx1) {
  15793. var $2,$1,$3,$4,$6,$5;
  15794. $2=$self._package();
  15795. $ctx1.sendIdx["package"]=1;
  15796. $1=$recv($2).__eq(aPackage);
  15797. if($core.assert($1)){
  15798. return self;
  15799. }
  15800. oldPackage=$self._package();
  15801. $self._basicAt_put_("pkg",aPackage);
  15802. $3=$recv(oldPackage)._organization();
  15803. $ctx1.sendIdx["organization"]=1;
  15804. $recv($3)._removeElement_(self);
  15805. $recv($recv(aPackage)._organization())._addElement_(self);
  15806. $4=$recv($globals.SystemAnnouncer)._current();
  15807. $6=$recv($globals.ClassMoved)._new();
  15808. $recv($6)._theClass_(self);
  15809. $recv($6)._oldPackage_(oldPackage);
  15810. $5=$recv($6)._yourself();
  15811. $recv($4)._announce_($5);
  15812. return self;
  15813. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  15814. },
  15815. args: ["aPackage"],
  15816. 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)",
  15817. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  15818. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  15819. }),
  15820. $globals.TMasterBehavior);
  15821. $core.addMethod(
  15822. $core.method({
  15823. selector: "theNonMetaClass",
  15824. protocol: "accessing",
  15825. fn: function (){
  15826. var self=this,$self=this;
  15827. return self;
  15828. },
  15829. args: [],
  15830. source: "theNonMetaClass\x0a\x09^ self",
  15831. referencedClasses: [],
  15832. messageSends: []
  15833. }),
  15834. $globals.TMasterBehavior);
  15835. $core.addClass("Trait", $globals.Object, [], "Kernel-Classes");
  15836. $core.addMethod(
  15837. $core.method({
  15838. selector: "-",
  15839. protocol: "composition",
  15840. fn: function (anArray){
  15841. var self=this,$self=this;
  15842. return $core.withContext(function($ctx1) {
  15843. return $recv($self._asTraitTransformation()).__minus(anArray);
  15844. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  15845. },
  15846. args: ["anArray"],
  15847. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  15848. referencedClasses: [],
  15849. messageSends: ["-", "asTraitTransformation"]
  15850. }),
  15851. $globals.Trait);
  15852. $core.addMethod(
  15853. $core.method({
  15854. selector: "@",
  15855. protocol: "composition",
  15856. fn: function (anArrayOfAssociations){
  15857. var self=this,$self=this;
  15858. return $core.withContext(function($ctx1) {
  15859. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  15860. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  15861. },
  15862. args: ["anArrayOfAssociations"],
  15863. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  15864. referencedClasses: [],
  15865. messageSends: ["@", "asTraitTransformation"]
  15866. }),
  15867. $globals.Trait);
  15868. $core.addMethod(
  15869. $core.method({
  15870. selector: "asTraitComposition",
  15871. protocol: "converting",
  15872. fn: function (){
  15873. var self=this,$self=this;
  15874. return $core.withContext(function($ctx1) {
  15875. return $recv($self._asTraitTransformation())._asTraitComposition();
  15876. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  15877. },
  15878. args: [],
  15879. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  15880. referencedClasses: [],
  15881. messageSends: ["asTraitComposition", "asTraitTransformation"]
  15882. }),
  15883. $globals.Trait);
  15884. $core.addMethod(
  15885. $core.method({
  15886. selector: "asTraitTransformation",
  15887. protocol: "converting",
  15888. fn: function (){
  15889. var self=this,$self=this;
  15890. return $core.withContext(function($ctx1) {
  15891. return $recv($globals.TraitTransformation)._on_(self);
  15892. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  15893. },
  15894. args: [],
  15895. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  15896. referencedClasses: ["TraitTransformation"],
  15897. messageSends: ["on:"]
  15898. }),
  15899. $globals.Trait);
  15900. $core.addMethod(
  15901. $core.method({
  15902. selector: "classTag",
  15903. protocol: "accessing",
  15904. fn: function (){
  15905. var self=this,$self=this;
  15906. return "trait";
  15907. },
  15908. args: [],
  15909. source: "classTag\x0a\x09^ 'trait'",
  15910. referencedClasses: [],
  15911. messageSends: []
  15912. }),
  15913. $globals.Trait);
  15914. $core.addMethod(
  15915. $core.method({
  15916. selector: "definition",
  15917. protocol: "accessing",
  15918. fn: function (){
  15919. var self=this,$self=this;
  15920. return $core.withContext(function($ctx1) {
  15921. var $1;
  15922. return $recv($globals.String)._streamContents_((function(stream){
  15923. return $core.withContext(function($ctx2) {
  15924. $recv(stream)._write_("Trait named: ");
  15925. $ctx2.sendIdx["write:"]=1;
  15926. $recv(stream)._printSymbol_($self._name());
  15927. $recv(stream)._lf();
  15928. $ctx2.sendIdx["lf"]=1;
  15929. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  15930. return $core.withContext(function($ctx3) {
  15931. $1=$recv($globals.String)._tab();
  15932. $ctx3.sendIdx["tab"]=1;
  15933. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  15934. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  15935. })));
  15936. $ctx2.sendIdx["write:"]=2;
  15937. $recv(stream)._tab();
  15938. $recv(stream)._write_("package: ");
  15939. return $recv(stream)._print_($self._category());
  15940. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15941. }));
  15942. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  15943. },
  15944. args: [],
  15945. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Trait named: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  15946. referencedClasses: ["String"],
  15947. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  15948. }),
  15949. $globals.Trait);
  15950. $core.addMethod(
  15951. $core.method({
  15952. selector: "theMetaClass",
  15953. protocol: "accessing",
  15954. fn: function (){
  15955. var self=this,$self=this;
  15956. return nil;
  15957. },
  15958. args: [],
  15959. source: "theMetaClass\x0a\x09^ nil",
  15960. referencedClasses: [],
  15961. messageSends: []
  15962. }),
  15963. $globals.Trait);
  15964. $core.addMethod(
  15965. $core.method({
  15966. selector: "traitUsers",
  15967. protocol: "accessing",
  15968. fn: function (){
  15969. var self=this,$self=this;
  15970. return $core.withContext(function($ctx1) {
  15971. return $recv($self._basicAt_("traitUsers"))._copy();
  15972. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  15973. },
  15974. args: [],
  15975. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  15976. referencedClasses: [],
  15977. messageSends: ["copy", "basicAt:"]
  15978. }),
  15979. $globals.Trait);
  15980. $core.addMethod(
  15981. $core.method({
  15982. selector: "named:package:",
  15983. protocol: "instance creation",
  15984. fn: function (aString,anotherString){
  15985. var self=this,$self=this;
  15986. return $core.withContext(function($ctx1) {
  15987. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  15988. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  15989. },
  15990. args: ["aString", "anotherString"],
  15991. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  15992. referencedClasses: ["ClassBuilder"],
  15993. messageSends: ["addTraitNamed:package:", "new"]
  15994. }),
  15995. $globals.Trait.a$cls);
  15996. $core.addMethod(
  15997. $core.method({
  15998. selector: "named:uses:package:",
  15999. protocol: "instance creation",
  16000. fn: function (aString,aTraitCompositionDescription,anotherString){
  16001. var self=this,$self=this;
  16002. var trait;
  16003. return $core.withContext(function($ctx1) {
  16004. trait=$self._named_package_(aString,anotherString);
  16005. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  16006. return trait;
  16007. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  16008. },
  16009. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  16010. source: "named: aString uses: aTraitCompositionDescription package: anotherString\x0a\x09| trait |\x0a\x09trait := self named: aString package: anotherString.\x0a\x09trait setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ trait",
  16011. referencedClasses: [],
  16012. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  16013. }),
  16014. $globals.Trait.a$cls);
  16015. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  16016. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  16017. $core.addMethod(
  16018. $core.method({
  16019. selector: "-",
  16020. protocol: "composition",
  16021. fn: function (anArray){
  16022. var self=this,$self=this;
  16023. return $core.withContext(function($ctx1) {
  16024. var $1;
  16025. $1=$self._copy();
  16026. $recv($1)._addExclusions_(anArray);
  16027. return $recv($1)._yourself();
  16028. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  16029. },
  16030. args: ["anArray"],
  16031. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  16032. referencedClasses: [],
  16033. messageSends: ["addExclusions:", "copy", "yourself"]
  16034. }),
  16035. $globals.TraitTransformation);
  16036. $core.addMethod(
  16037. $core.method({
  16038. selector: "@",
  16039. protocol: "composition",
  16040. fn: function (anArrayOfAssociations){
  16041. var self=this,$self=this;
  16042. return $core.withContext(function($ctx1) {
  16043. var $1;
  16044. $1=$self._copy();
  16045. $recv($1)._addAliases_(anArrayOfAssociations);
  16046. return $recv($1)._yourself();
  16047. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  16048. },
  16049. args: ["anArrayOfAssociations"],
  16050. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  16051. referencedClasses: [],
  16052. messageSends: ["addAliases:", "copy", "yourself"]
  16053. }),
  16054. $globals.TraitTransformation);
  16055. $core.addMethod(
  16056. $core.method({
  16057. selector: "addAliases:",
  16058. protocol: "accessing",
  16059. fn: function (anArrayOfAssociations){
  16060. var self=this,$self=this;
  16061. return $core.withContext(function($ctx1) {
  16062. $recv(anArrayOfAssociations)._do_((function(each){
  16063. var key;
  16064. return $core.withContext(function($ctx2) {
  16065. key=$recv(each)._key();
  16066. key;
  16067. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  16068. return $core.withContext(function($ctx3) {
  16069. return $self._error_("Cannot use same alias name twice.");
  16070. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16071. }),(function(){
  16072. return $core.withContext(function($ctx3) {
  16073. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  16074. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  16075. }));
  16076. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  16077. }));
  16078. return anArrayOfAssociations;
  16079. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  16080. },
  16081. args: ["anArrayOfAssociations"],
  16082. source: "addAliases: anArrayOfAssociations\x0a\x09anArrayOfAssociations do: [ :each |\x0a\x09\x09| key |\x0a\x09\x09key := each key.\x0a\x09\x09aliases at: key\x0a\x09\x09\x09ifPresent: [ self error: 'Cannot use same alias name twice.' ]\x0a\x09\x09\x09ifAbsent: [ aliases at: key put: each value ] ].\x0a\x09^ anArrayOfAssociations",
  16083. referencedClasses: [],
  16084. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  16085. }),
  16086. $globals.TraitTransformation);
  16087. $core.addMethod(
  16088. $core.method({
  16089. selector: "addExclusions:",
  16090. protocol: "accessing",
  16091. fn: function (anArray){
  16092. var self=this,$self=this;
  16093. return $core.withContext(function($ctx1) {
  16094. $recv($self["@exclusions"])._addAll_(anArray);
  16095. return anArray;
  16096. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  16097. },
  16098. args: ["anArray"],
  16099. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  16100. referencedClasses: [],
  16101. messageSends: ["addAll:"]
  16102. }),
  16103. $globals.TraitTransformation);
  16104. $core.addMethod(
  16105. $core.method({
  16106. selector: "aliases",
  16107. protocol: "accessing",
  16108. fn: function (){
  16109. var self=this,$self=this;
  16110. return $self["@aliases"];
  16111. },
  16112. args: [],
  16113. source: "aliases\x0a\x09^ aliases",
  16114. referencedClasses: [],
  16115. messageSends: []
  16116. }),
  16117. $globals.TraitTransformation);
  16118. $core.addMethod(
  16119. $core.method({
  16120. selector: "asJavaScriptObject",
  16121. protocol: "converting",
  16122. fn: function (){
  16123. var self=this,$self=this;
  16124. return $core.withContext(function($ctx1) {
  16125. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  16126. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  16127. },
  16128. args: [],
  16129. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  16130. referencedClasses: [],
  16131. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  16132. }),
  16133. $globals.TraitTransformation);
  16134. $core.addMethod(
  16135. $core.method({
  16136. selector: "asJavaScriptSource",
  16137. protocol: "converting",
  16138. fn: function (){
  16139. var self=this,$self=this;
  16140. return $core.withContext(function($ctx1) {
  16141. var $2,$3,$1;
  16142. return $recv($globals.String)._streamContents_((function(str){
  16143. return $core.withContext(function($ctx2) {
  16144. $2=$recv($self._trait())._asJavaScriptSource();
  16145. $ctx2.sendIdx["asJavaScriptSource"]=1;
  16146. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  16147. return $core.withContext(function($ctx3) {
  16148. return [", aliases: ",$recv(al)._asJSONString()];
  16149. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  16150. }));
  16151. $ctx2.sendIdx["ifNotEmpty:"]=1;
  16152. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  16153. return $core.withContext(function($ctx3) {
  16154. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  16155. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  16156. })),"}"];
  16157. return $recv(str)._write_($1);
  16158. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  16159. }));
  16160. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  16161. },
  16162. args: [],
  16163. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str | str write: {\x0a\x09\x09'{trait: '. self trait asJavaScriptSource.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09{', aliases: '. al asJSONString} ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09{', exclusions: '. ex asArray sorted asJavaScriptSource} ].\x0a\x09\x09'}' } ]",
  16164. referencedClasses: ["String"],
  16165. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  16166. }),
  16167. $globals.TraitTransformation);
  16168. $core.addMethod(
  16169. $core.method({
  16170. selector: "asTraitComposition",
  16171. protocol: "converting",
  16172. fn: function (){
  16173. var self=this,$self=this;
  16174. return [self];
  16175. },
  16176. args: [],
  16177. source: "asTraitComposition\x0a\x09^ { self }",
  16178. referencedClasses: [],
  16179. messageSends: []
  16180. }),
  16181. $globals.TraitTransformation);
  16182. $core.addMethod(
  16183. $core.method({
  16184. selector: "asTraitTransformation",
  16185. protocol: "converting",
  16186. fn: function (){
  16187. var self=this,$self=this;
  16188. return self;
  16189. },
  16190. args: [],
  16191. source: "asTraitTransformation\x0a\x09^ self",
  16192. referencedClasses: [],
  16193. messageSends: []
  16194. }),
  16195. $globals.TraitTransformation);
  16196. $core.addMethod(
  16197. $core.method({
  16198. selector: "definition",
  16199. protocol: "accessing",
  16200. fn: function (){
  16201. var self=this,$self=this;
  16202. return $core.withContext(function($ctx1) {
  16203. return $recv($globals.String)._streamContents_((function(str){
  16204. return $core.withContext(function($ctx2) {
  16205. $recv(str)._print_($self._trait());
  16206. $recv($self._aliases())._ifNotEmpty_((function(al){
  16207. return $core.withContext(function($ctx3) {
  16208. $recv(str)._write_(" @ {");
  16209. $ctx3.sendIdx["write:"]=1;
  16210. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  16211. return $core.withContext(function($ctx4) {
  16212. $recv(str)._printSymbol_($recv(each)._key());
  16213. $ctx4.sendIdx["printSymbol:"]=1;
  16214. $recv(str)._write_(" -> ");
  16215. $ctx4.sendIdx["write:"]=2;
  16216. return $recv(str)._printSymbol_($recv(each)._value());
  16217. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16218. }),(function(){
  16219. return $core.withContext(function($ctx4) {
  16220. return $recv(str)._write_(". ");
  16221. $ctx4.sendIdx["write:"]=3;
  16222. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16223. }));
  16224. $ctx3.sendIdx["do:separatedBy:"]=1;
  16225. return $recv(str)._write_("}");
  16226. $ctx3.sendIdx["write:"]=4;
  16227. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  16228. }));
  16229. $ctx2.sendIdx["ifNotEmpty:"]=1;
  16230. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  16231. return $core.withContext(function($ctx3) {
  16232. $recv(str)._write_(" - #(");
  16233. $ctx3.sendIdx["write:"]=5;
  16234. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  16235. return $core.withContext(function($ctx4) {
  16236. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  16237. $ctx4.sendIdx["write:"]=6;
  16238. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  16239. }),(function(){
  16240. return $core.withContext(function($ctx4) {
  16241. return $recv(str)._space();
  16242. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  16243. }));
  16244. return $recv(str)._write_(")");
  16245. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  16246. }));
  16247. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  16248. }));
  16249. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  16250. },
  16251. args: [],
  16252. source: "definition\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str print: self trait.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09str write: ' @ {'.\x0a\x09\x09\x09al associations\x0a\x09\x09\x09\x09do: [ :each | str printSymbol: each key; write: ' -> '; printSymbol: each value ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09str write: ' - #('.\x0a\x09\x09\x09ex asArray sorted \x0a\x09\x09\x09\x09do: [ :each | str write: each symbolPrintString allButFirst ]\x0a\x09\x09\x09\x09separatedBy: [ str space ].\x0a\x09\x09\x09str write: ')' ] ]",
  16253. referencedClasses: ["String"],
  16254. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  16255. }),
  16256. $globals.TraitTransformation);
  16257. $core.addMethod(
  16258. $core.method({
  16259. selector: "exclusions",
  16260. protocol: "accessing",
  16261. fn: function (){
  16262. var self=this,$self=this;
  16263. return $self["@exclusions"];
  16264. },
  16265. args: [],
  16266. source: "exclusions\x0a\x09^ exclusions",
  16267. referencedClasses: [],
  16268. messageSends: []
  16269. }),
  16270. $globals.TraitTransformation);
  16271. $core.addMethod(
  16272. $core.method({
  16273. selector: "initialize",
  16274. protocol: "initialization",
  16275. fn: function (){
  16276. var self=this,$self=this;
  16277. return $core.withContext(function($ctx1) {
  16278. (
  16279. $ctx1.supercall = true,
  16280. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  16281. $ctx1.supercall = false;
  16282. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  16283. $self["@exclusions"]=$recv($globals.Set)._new();
  16284. $self["@trait"]=nil;
  16285. return self;
  16286. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  16287. },
  16288. args: [],
  16289. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  16290. referencedClasses: ["Set"],
  16291. messageSends: ["initialize", "new"]
  16292. }),
  16293. $globals.TraitTransformation);
  16294. $core.addMethod(
  16295. $core.method({
  16296. selector: "postCopy",
  16297. protocol: "copying",
  16298. fn: function (){
  16299. var self=this,$self=this;
  16300. return $core.withContext(function($ctx1) {
  16301. $self["@aliases"]=$recv($self["@aliases"])._copy();
  16302. $ctx1.sendIdx["copy"]=1;
  16303. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  16304. return self;
  16305. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  16306. },
  16307. args: [],
  16308. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  16309. referencedClasses: [],
  16310. messageSends: ["copy"]
  16311. }),
  16312. $globals.TraitTransformation);
  16313. $core.addMethod(
  16314. $core.method({
  16315. selector: "trait",
  16316. protocol: "accessing",
  16317. fn: function (){
  16318. var self=this,$self=this;
  16319. return $self["@trait"];
  16320. },
  16321. args: [],
  16322. source: "trait\x0a\x09^ trait",
  16323. referencedClasses: [],
  16324. messageSends: []
  16325. }),
  16326. $globals.TraitTransformation);
  16327. $core.addMethod(
  16328. $core.method({
  16329. selector: "trait:",
  16330. protocol: "accessing",
  16331. fn: function (anObject){
  16332. var self=this,$self=this;
  16333. $self["@trait"]=anObject;
  16334. return self;
  16335. },
  16336. args: ["anObject"],
  16337. source: "trait: anObject\x0a\x09trait := anObject",
  16338. referencedClasses: [],
  16339. messageSends: []
  16340. }),
  16341. $globals.TraitTransformation);
  16342. $core.addMethod(
  16343. $core.method({
  16344. selector: "fromJSON:",
  16345. protocol: "instance creation",
  16346. fn: function (aJSObject){
  16347. var self=this,$self=this;
  16348. return $core.withContext(function($ctx1) {
  16349. var $1,$4,$3,$2;
  16350. $1=(
  16351. $ctx1.supercall = true,
  16352. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  16353. $ctx1.supercall = false;
  16354. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  16355. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  16356. return $globals.HashedCollection._newFromPairs_([]);
  16357. }));
  16358. $ctx1.sendIdx["at:ifAbsent:"]=1;
  16359. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  16360. $2=$recv($3)._associations();
  16361. $recv($1)._addAliases_($2);
  16362. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  16363. return [];
  16364. })));
  16365. return $recv($1)._yourself();
  16366. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  16367. },
  16368. args: ["aJSObject"],
  16369. source: "fromJSON: aJSObject\x0a\x09^ super new\x0a\x09\x09trait: (aJSObject at: #trait);\x0a\x09\x09addAliases: (Smalltalk readJSObject: (aJSObject at: #aliases ifAbsent: [#{}])) associations;\x0a\x09\x09addExclusions: (aJSObject at: #exclusions ifAbsent: [#()]);\x0a\x09\x09yourself",
  16370. referencedClasses: ["Smalltalk"],
  16371. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  16372. }),
  16373. $globals.TraitTransformation.a$cls);
  16374. $core.addMethod(
  16375. $core.method({
  16376. selector: "on:",
  16377. protocol: "instance creation",
  16378. fn: function (aTrait){
  16379. var self=this,$self=this;
  16380. return $core.withContext(function($ctx1) {
  16381. var $1;
  16382. $1=(
  16383. $ctx1.supercall = true,
  16384. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  16385. $ctx1.supercall = false;
  16386. $recv($1)._trait_(aTrait);
  16387. return $recv($1)._yourself();
  16388. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  16389. },
  16390. args: ["aTrait"],
  16391. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  16392. referencedClasses: [],
  16393. messageSends: ["trait:", "new", "yourself"]
  16394. }),
  16395. $globals.TraitTransformation.a$cls);
  16396. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  16397. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  16398. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  16399. $core.addMethod(
  16400. $core.method({
  16401. selector: "asTraitComposition",
  16402. protocol: "*Kernel-Classes",
  16403. fn: function (){
  16404. var self=this,$self=this;
  16405. return $core.withContext(function($ctx1) {
  16406. return $self._collect_((function(each){
  16407. return $core.withContext(function($ctx2) {
  16408. return $recv(each)._asTraitTransformation();
  16409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16410. }));
  16411. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  16412. },
  16413. args: [],
  16414. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  16415. referencedClasses: [],
  16416. messageSends: ["collect:", "asTraitTransformation"]
  16417. }),
  16418. $globals.Array);
  16419. });
  16420. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  16421. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  16422. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  16423. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  16424. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  16425. $core.addPackage("Kernel-Methods");
  16426. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  16427. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  16428. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  16429. $globals.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 | ... ] `";
  16430. $core.addMethod(
  16431. $core.method({
  16432. selector: "applyTo:arguments:",
  16433. protocol: "evaluating",
  16434. fn: function (anObject,aCollection){
  16435. var self=this,$self=this;
  16436. return $core.withContext(function($ctx1) {
  16437. return self.apply(anObject, aCollection);
  16438. return self;
  16439. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  16440. },
  16441. args: ["anObject", "aCollection"],
  16442. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  16443. referencedClasses: [],
  16444. messageSends: []
  16445. }),
  16446. $globals.BlockClosure);
  16447. $core.addMethod(
  16448. $core.method({
  16449. selector: "asCompiledMethod:",
  16450. protocol: "converting",
  16451. fn: function (aString){
  16452. var self=this,$self=this;
  16453. return $core.withContext(function($ctx1) {
  16454. return $core.method({selector:aString, fn:self});;
  16455. return self;
  16456. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  16457. },
  16458. args: ["aString"],
  16459. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  16460. referencedClasses: [],
  16461. messageSends: []
  16462. }),
  16463. $globals.BlockClosure);
  16464. $core.addMethod(
  16465. $core.method({
  16466. selector: "compiledSource",
  16467. protocol: "accessing",
  16468. fn: function (){
  16469. var self=this,$self=this;
  16470. return $core.withContext(function($ctx1) {
  16471. return self.toString();
  16472. return self;
  16473. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  16474. },
  16475. args: [],
  16476. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  16477. referencedClasses: [],
  16478. messageSends: []
  16479. }),
  16480. $globals.BlockClosure);
  16481. $core.addMethod(
  16482. $core.method({
  16483. selector: "currySelf",
  16484. protocol: "converting",
  16485. fn: function (){
  16486. var self=this,$self=this;
  16487. return $core.withContext(function($ctx1) {
  16488. return function () {
  16489. var args = [ this ];
  16490. args.push.apply(args, arguments);
  16491. return self.apply(null, args);
  16492. }
  16493. ;
  16494. return self;
  16495. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  16496. },
  16497. args: [],
  16498. 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<inlineJS: '\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'>",
  16499. referencedClasses: [],
  16500. messageSends: []
  16501. }),
  16502. $globals.BlockClosure);
  16503. $core.addMethod(
  16504. $core.method({
  16505. selector: "ensure:",
  16506. protocol: "evaluating",
  16507. fn: function (aBlock){
  16508. var self=this,$self=this;
  16509. return $core.withContext(function($ctx1) {
  16510. try{return $self._value()}finally{aBlock._value()};
  16511. return self;
  16512. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  16513. },
  16514. args: ["aBlock"],
  16515. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  16516. referencedClasses: [],
  16517. messageSends: []
  16518. }),
  16519. $globals.BlockClosure);
  16520. $core.addMethod(
  16521. $core.method({
  16522. selector: "fork",
  16523. protocol: "timeout/interval",
  16524. fn: function (){
  16525. var self=this,$self=this;
  16526. return $core.withContext(function($ctx1) {
  16527. $recv($recv($globals.ForkPool)._default())._fork_(self);
  16528. return self;
  16529. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  16530. },
  16531. args: [],
  16532. source: "fork\x0a\x09ForkPool default fork: self",
  16533. referencedClasses: ["ForkPool"],
  16534. messageSends: ["fork:", "default"]
  16535. }),
  16536. $globals.BlockClosure);
  16537. $core.addMethod(
  16538. $core.method({
  16539. selector: "new",
  16540. protocol: "evaluating",
  16541. fn: function (){
  16542. var self=this,$self=this;
  16543. return $core.withContext(function($ctx1) {
  16544. return new self();
  16545. return self;
  16546. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  16547. },
  16548. args: [],
  16549. 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<inlineJS: 'return new self()'>",
  16550. referencedClasses: [],
  16551. messageSends: []
  16552. }),
  16553. $globals.BlockClosure);
  16554. $core.addMethod(
  16555. $core.method({
  16556. selector: "newValue:",
  16557. protocol: "evaluating",
  16558. fn: function (anObject){
  16559. var self=this,$self=this;
  16560. return $core.withContext(function($ctx1) {
  16561. return $self._newWithValues_([anObject]);
  16562. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  16563. },
  16564. args: ["anObject"],
  16565. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  16566. referencedClasses: [],
  16567. messageSends: ["newWithValues:"]
  16568. }),
  16569. $globals.BlockClosure);
  16570. $core.addMethod(
  16571. $core.method({
  16572. selector: "newValue:value:",
  16573. protocol: "evaluating",
  16574. fn: function (anObject,anObject2){
  16575. var self=this,$self=this;
  16576. return $core.withContext(function($ctx1) {
  16577. return $self._newWithValues_([anObject,anObject2]);
  16578. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  16579. },
  16580. args: ["anObject", "anObject2"],
  16581. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  16582. referencedClasses: [],
  16583. messageSends: ["newWithValues:"]
  16584. }),
  16585. $globals.BlockClosure);
  16586. $core.addMethod(
  16587. $core.method({
  16588. selector: "newValue:value:value:",
  16589. protocol: "evaluating",
  16590. fn: function (anObject,anObject2,anObject3){
  16591. var self=this,$self=this;
  16592. return $core.withContext(function($ctx1) {
  16593. return $self._newWithValues_([anObject,anObject2,anObject3]);
  16594. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  16595. },
  16596. args: ["anObject", "anObject2", "anObject3"],
  16597. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  16598. referencedClasses: [],
  16599. messageSends: ["newWithValues:"]
  16600. }),
  16601. $globals.BlockClosure);
  16602. $core.addMethod(
  16603. $core.method({
  16604. selector: "newWithValues:",
  16605. protocol: "evaluating",
  16606. fn: function (aCollection){
  16607. var self=this,$self=this;
  16608. return $core.withContext(function($ctx1) {
  16609. var object = Object.create(self.prototype);
  16610. var result = self.apply(object, aCollection);
  16611. return typeof result === "object" ? result : object;
  16612. ;
  16613. return self;
  16614. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  16615. },
  16616. args: ["aCollection"],
  16617. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<inlineJS: '\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09'>",
  16618. referencedClasses: [],
  16619. messageSends: []
  16620. }),
  16621. $globals.BlockClosure);
  16622. $core.addMethod(
  16623. $core.method({
  16624. selector: "numArgs",
  16625. protocol: "accessing",
  16626. fn: function (){
  16627. var self=this,$self=this;
  16628. return $core.withContext(function($ctx1) {
  16629. return self.length;
  16630. return self;
  16631. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  16632. },
  16633. args: [],
  16634. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  16635. referencedClasses: [],
  16636. messageSends: []
  16637. }),
  16638. $globals.BlockClosure);
  16639. $core.addMethod(
  16640. $core.method({
  16641. selector: "on:do:",
  16642. protocol: "error handling",
  16643. fn: function (anErrorClass,aBlock){
  16644. var self=this,$self=this;
  16645. return $core.withContext(function($ctx1) {
  16646. var $1;
  16647. return $self._tryCatch_((function(error){
  16648. var smalltalkError;
  16649. return $core.withContext(function($ctx2) {
  16650. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  16651. smalltalkError;
  16652. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  16653. if($core.assert($1)){
  16654. return $recv(aBlock)._value_(smalltalkError);
  16655. } else {
  16656. return $recv(smalltalkError)._resignal();
  16657. }
  16658. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  16659. }));
  16660. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  16661. },
  16662. args: ["anErrorClass", "aBlock"],
  16663. 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 tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  16664. referencedClasses: ["Smalltalk"],
  16665. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  16666. }),
  16667. $globals.BlockClosure);
  16668. $core.addMethod(
  16669. $core.method({
  16670. selector: "receiver",
  16671. protocol: "accessing",
  16672. fn: function (){
  16673. var self=this,$self=this;
  16674. return nil;
  16675. },
  16676. args: [],
  16677. source: "receiver\x0a\x09^ nil",
  16678. referencedClasses: [],
  16679. messageSends: []
  16680. }),
  16681. $globals.BlockClosure);
  16682. $core.addMethod(
  16683. $core.method({
  16684. selector: "timeToRun",
  16685. protocol: "evaluating",
  16686. fn: function (){
  16687. var self=this,$self=this;
  16688. return $core.withContext(function($ctx1) {
  16689. return $recv($globals.Date)._millisecondsToRun_(self);
  16690. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  16691. },
  16692. args: [],
  16693. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  16694. referencedClasses: ["Date"],
  16695. messageSends: ["millisecondsToRun:"]
  16696. }),
  16697. $globals.BlockClosure);
  16698. $core.addMethod(
  16699. $core.method({
  16700. selector: "tryCatch:",
  16701. protocol: "error handling",
  16702. fn: function (aBlock){
  16703. var self=this,$self=this;
  16704. return $core.withContext(function($ctx1) {
  16705. try {
  16706. return $self._value();
  16707. } catch(error) {
  16708. // pass non-local returns undetected
  16709. if (Array.isArray(error) && error.length === 1) throw error;
  16710. return aBlock._value_(error);
  16711. }
  16712. ;
  16713. return self;
  16714. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  16715. },
  16716. args: ["aBlock"],
  16717. source: "tryCatch: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09try {\x0a\x09\x09\x09return $self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09'>",
  16718. referencedClasses: [],
  16719. messageSends: []
  16720. }),
  16721. $globals.BlockClosure);
  16722. $core.addMethod(
  16723. $core.method({
  16724. selector: "value",
  16725. protocol: "evaluating",
  16726. fn: function (){
  16727. var self=this,$self=this;
  16728. return $core.withContext(function($ctx1) {
  16729. return self();;
  16730. return self;
  16731. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  16732. },
  16733. args: [],
  16734. source: "value\x0a\x09<inlineJS: 'return self();'>",
  16735. referencedClasses: [],
  16736. messageSends: []
  16737. }),
  16738. $globals.BlockClosure);
  16739. $core.addMethod(
  16740. $core.method({
  16741. selector: "value:",
  16742. protocol: "evaluating",
  16743. fn: function (anArg){
  16744. var self=this,$self=this;
  16745. return $core.withContext(function($ctx1) {
  16746. return self(anArg);;
  16747. return self;
  16748. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  16749. },
  16750. args: ["anArg"],
  16751. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  16752. referencedClasses: [],
  16753. messageSends: []
  16754. }),
  16755. $globals.BlockClosure);
  16756. $core.addMethod(
  16757. $core.method({
  16758. selector: "value:value:",
  16759. protocol: "evaluating",
  16760. fn: function (firstArg,secondArg){
  16761. var self=this,$self=this;
  16762. return $core.withContext(function($ctx1) {
  16763. return self(firstArg, secondArg);;
  16764. return self;
  16765. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  16766. },
  16767. args: ["firstArg", "secondArg"],
  16768. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  16769. referencedClasses: [],
  16770. messageSends: []
  16771. }),
  16772. $globals.BlockClosure);
  16773. $core.addMethod(
  16774. $core.method({
  16775. selector: "value:value:value:",
  16776. protocol: "evaluating",
  16777. fn: function (firstArg,secondArg,thirdArg){
  16778. var self=this,$self=this;
  16779. return $core.withContext(function($ctx1) {
  16780. return self(firstArg, secondArg, thirdArg);;
  16781. return self;
  16782. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  16783. },
  16784. args: ["firstArg", "secondArg", "thirdArg"],
  16785. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  16786. referencedClasses: [],
  16787. messageSends: []
  16788. }),
  16789. $globals.BlockClosure);
  16790. $core.addMethod(
  16791. $core.method({
  16792. selector: "valueWithInterval:",
  16793. protocol: "timeout/interval",
  16794. fn: function (aNumber){
  16795. var self=this,$self=this;
  16796. return $core.withContext(function($ctx1) {
  16797. var interval = setInterval(self, aNumber);
  16798. return $globals.Timeout._on_(interval);
  16799. ;
  16800. return self;
  16801. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  16802. },
  16803. args: ["aNumber"],
  16804. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  16805. referencedClasses: [],
  16806. messageSends: []
  16807. }),
  16808. $globals.BlockClosure);
  16809. $core.addMethod(
  16810. $core.method({
  16811. selector: "valueWithPossibleArguments:",
  16812. protocol: "evaluating",
  16813. fn: function (aCollection){
  16814. var self=this,$self=this;
  16815. return $core.withContext(function($ctx1) {
  16816. return self.apply(null, aCollection);;
  16817. return self;
  16818. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  16819. },
  16820. args: ["aCollection"],
  16821. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  16822. referencedClasses: [],
  16823. messageSends: []
  16824. }),
  16825. $globals.BlockClosure);
  16826. $core.addMethod(
  16827. $core.method({
  16828. selector: "valueWithTimeout:",
  16829. protocol: "timeout/interval",
  16830. fn: function (aNumber){
  16831. var self=this,$self=this;
  16832. return $core.withContext(function($ctx1) {
  16833. var timeout = setTimeout(self, aNumber);
  16834. return $globals.Timeout._on_(timeout);
  16835. ;
  16836. return self;
  16837. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  16838. },
  16839. args: ["aNumber"],
  16840. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  16841. referencedClasses: [],
  16842. messageSends: []
  16843. }),
  16844. $globals.BlockClosure);
  16845. $core.addMethod(
  16846. $core.method({
  16847. selector: "whileFalse",
  16848. protocol: "controlling",
  16849. fn: function (){
  16850. var self=this,$self=this;
  16851. return $core.withContext(function($ctx1) {
  16852. $self._whileFalse_((function(){
  16853. }));
  16854. return self;
  16855. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  16856. },
  16857. args: [],
  16858. source: "whileFalse\x0a\x09self whileFalse: []",
  16859. referencedClasses: [],
  16860. messageSends: ["whileFalse:"]
  16861. }),
  16862. $globals.BlockClosure);
  16863. $core.addMethod(
  16864. $core.method({
  16865. selector: "whileFalse:",
  16866. protocol: "controlling",
  16867. fn: function (aBlock){
  16868. var self=this,$self=this;
  16869. return $core.withContext(function($ctx1) {
  16870. while(!$core.assert($self._value())) {aBlock._value()};
  16871. return self;
  16872. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  16873. },
  16874. args: ["aBlock"],
  16875. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  16876. referencedClasses: [],
  16877. messageSends: []
  16878. }),
  16879. $globals.BlockClosure);
  16880. $core.addMethod(
  16881. $core.method({
  16882. selector: "whileTrue",
  16883. protocol: "controlling",
  16884. fn: function (){
  16885. var self=this,$self=this;
  16886. return $core.withContext(function($ctx1) {
  16887. $self._whileTrue_((function(){
  16888. }));
  16889. return self;
  16890. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  16891. },
  16892. args: [],
  16893. source: "whileTrue\x0a\x09self whileTrue: []",
  16894. referencedClasses: [],
  16895. messageSends: ["whileTrue:"]
  16896. }),
  16897. $globals.BlockClosure);
  16898. $core.addMethod(
  16899. $core.method({
  16900. selector: "whileTrue:",
  16901. protocol: "controlling",
  16902. fn: function (aBlock){
  16903. var self=this,$self=this;
  16904. return $core.withContext(function($ctx1) {
  16905. while($core.assert($self._value())) {aBlock._value()};
  16906. return self;
  16907. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  16908. },
  16909. args: ["aBlock"],
  16910. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  16911. referencedClasses: [],
  16912. messageSends: []
  16913. }),
  16914. $globals.BlockClosure);
  16915. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  16916. $globals.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";
  16917. $core.addMethod(
  16918. $core.method({
  16919. selector: "arguments",
  16920. protocol: "accessing",
  16921. fn: function (){
  16922. var self=this,$self=this;
  16923. return $core.withContext(function($ctx1) {
  16924. return self.args || [];
  16925. return self;
  16926. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  16927. },
  16928. args: [],
  16929. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  16930. referencedClasses: [],
  16931. messageSends: []
  16932. }),
  16933. $globals.CompiledMethod);
  16934. $core.addMethod(
  16935. $core.method({
  16936. selector: "browse",
  16937. protocol: "browsing",
  16938. fn: function (){
  16939. var self=this,$self=this;
  16940. return $core.withContext(function($ctx1) {
  16941. $recv($globals.Finder)._findMethod_(self);
  16942. return self;
  16943. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  16944. },
  16945. args: [],
  16946. source: "browse\x0a\x09Finder findMethod: self",
  16947. referencedClasses: ["Finder"],
  16948. messageSends: ["findMethod:"]
  16949. }),
  16950. $globals.CompiledMethod);
  16951. $core.addMethod(
  16952. $core.method({
  16953. selector: "category",
  16954. protocol: "accessing",
  16955. fn: function (){
  16956. var self=this,$self=this;
  16957. return $core.withContext(function($ctx1) {
  16958. return $self._protocol();
  16959. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  16960. },
  16961. args: [],
  16962. source: "category\x0a\x09^ self protocol",
  16963. referencedClasses: [],
  16964. messageSends: ["protocol"]
  16965. }),
  16966. $globals.CompiledMethod);
  16967. $core.addMethod(
  16968. $core.method({
  16969. selector: "defaultProtocol",
  16970. protocol: "defaults",
  16971. fn: function (){
  16972. var self=this,$self=this;
  16973. return "as yet unclassified";
  16974. },
  16975. args: [],
  16976. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  16977. referencedClasses: [],
  16978. messageSends: []
  16979. }),
  16980. $globals.CompiledMethod);
  16981. $core.addMethod(
  16982. $core.method({
  16983. selector: "fn",
  16984. protocol: "accessing",
  16985. fn: function (){
  16986. var self=this,$self=this;
  16987. return $core.withContext(function($ctx1) {
  16988. return $self._basicAt_("fn");
  16989. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  16990. },
  16991. args: [],
  16992. source: "fn\x0a\x09^ self basicAt: 'fn'",
  16993. referencedClasses: [],
  16994. messageSends: ["basicAt:"]
  16995. }),
  16996. $globals.CompiledMethod);
  16997. $core.addMethod(
  16998. $core.method({
  16999. selector: "fn:",
  17000. protocol: "accessing",
  17001. fn: function (aBlock){
  17002. var self=this,$self=this;
  17003. return $core.withContext(function($ctx1) {
  17004. $self._basicAt_put_("fn",aBlock);
  17005. return self;
  17006. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  17007. },
  17008. args: ["aBlock"],
  17009. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  17010. referencedClasses: [],
  17011. messageSends: ["basicAt:put:"]
  17012. }),
  17013. $globals.CompiledMethod);
  17014. $core.addMethod(
  17015. $core.method({
  17016. selector: "isCompiledMethod",
  17017. protocol: "testing",
  17018. fn: function (){
  17019. var self=this,$self=this;
  17020. return true;
  17021. },
  17022. args: [],
  17023. source: "isCompiledMethod\x0a\x09^ true",
  17024. referencedClasses: [],
  17025. messageSends: []
  17026. }),
  17027. $globals.CompiledMethod);
  17028. $core.addMethod(
  17029. $core.method({
  17030. selector: "isOverridden",
  17031. protocol: "testing",
  17032. fn: function (){
  17033. var self=this,$self=this;
  17034. var selector;
  17035. return $core.withContext(function($ctx1) {
  17036. var $1;
  17037. var $early={};
  17038. try {
  17039. selector=$self._selector();
  17040. $recv($self._methodClass())._allSubclassesDo_((function(each){
  17041. return $core.withContext(function($ctx2) {
  17042. $1=$recv(each)._includesSelector_(selector);
  17043. if($core.assert($1)){
  17044. throw $early=[true];
  17045. }
  17046. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17047. }));
  17048. return false;
  17049. }
  17050. catch(e) {if(e===$early)return e[0]; throw e}
  17051. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  17052. },
  17053. args: [],
  17054. 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",
  17055. referencedClasses: [],
  17056. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  17057. }),
  17058. $globals.CompiledMethod);
  17059. $core.addMethod(
  17060. $core.method({
  17061. selector: "isOverride",
  17062. protocol: "testing",
  17063. fn: function (){
  17064. var self=this,$self=this;
  17065. var superclass;
  17066. return $core.withContext(function($ctx1) {
  17067. var $1,$2,$receiver;
  17068. $1=$self._methodClass();
  17069. $ctx1.sendIdx["methodClass"]=1;
  17070. superclass=$recv($1)._superclass();
  17071. $ctx1.sendIdx["superclass"]=1;
  17072. $2=superclass;
  17073. if(($receiver = $2) == null || $receiver.a$nil){
  17074. return false;
  17075. } else {
  17076. $2;
  17077. }
  17078. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  17079. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  17080. },
  17081. args: [],
  17082. 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",
  17083. referencedClasses: [],
  17084. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  17085. }),
  17086. $globals.CompiledMethod);
  17087. $core.addMethod(
  17088. $core.method({
  17089. selector: "messageSends",
  17090. protocol: "accessing",
  17091. fn: function (){
  17092. var self=this,$self=this;
  17093. return $core.withContext(function($ctx1) {
  17094. return $self._basicAt_("messageSends");
  17095. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  17096. },
  17097. args: [],
  17098. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  17099. referencedClasses: [],
  17100. messageSends: ["basicAt:"]
  17101. }),
  17102. $globals.CompiledMethod);
  17103. $core.addMethod(
  17104. $core.method({
  17105. selector: "methodClass",
  17106. protocol: "accessing",
  17107. fn: function (){
  17108. var self=this,$self=this;
  17109. return $core.withContext(function($ctx1) {
  17110. return $self._basicAt_("methodClass");
  17111. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  17112. },
  17113. args: [],
  17114. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  17115. referencedClasses: [],
  17116. messageSends: ["basicAt:"]
  17117. }),
  17118. $globals.CompiledMethod);
  17119. $core.addMethod(
  17120. $core.method({
  17121. selector: "package",
  17122. protocol: "accessing",
  17123. fn: function (){
  17124. var self=this,$self=this;
  17125. return $core.withContext(function($ctx1) {
  17126. var $1,$receiver;
  17127. $1=$self._methodClass();
  17128. if(($receiver = $1) == null || $receiver.a$nil){
  17129. return $1;
  17130. } else {
  17131. var class_;
  17132. class_=$receiver;
  17133. return $recv(class_)._packageOfProtocol_($self._protocol());
  17134. }
  17135. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  17136. },
  17137. args: [],
  17138. source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09^ self methodClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  17139. referencedClasses: [],
  17140. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  17141. }),
  17142. $globals.CompiledMethod);
  17143. $core.addMethod(
  17144. $core.method({
  17145. selector: "protocol",
  17146. protocol: "accessing",
  17147. fn: function (){
  17148. var self=this,$self=this;
  17149. return $core.withContext(function($ctx1) {
  17150. var $1,$receiver;
  17151. $1=$self._basicAt_("protocol");
  17152. if(($receiver = $1) == null || $receiver.a$nil){
  17153. return $self._defaultProtocol();
  17154. } else {
  17155. return $1;
  17156. }
  17157. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  17158. },
  17159. args: [],
  17160. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  17161. referencedClasses: [],
  17162. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  17163. }),
  17164. $globals.CompiledMethod);
  17165. $core.addMethod(
  17166. $core.method({
  17167. selector: "protocol:",
  17168. protocol: "accessing",
  17169. fn: function (aString){
  17170. var self=this,$self=this;
  17171. var oldProtocol;
  17172. return $core.withContext(function($ctx1) {
  17173. var $1,$3,$2,$4,$receiver;
  17174. oldProtocol=$self._protocol();
  17175. $self._basicAt_put_("protocol",aString);
  17176. $1=$recv($globals.SystemAnnouncer)._current();
  17177. $3=$recv($globals.MethodMoved)._new();
  17178. $recv($3)._method_(self);
  17179. $recv($3)._oldProtocol_(oldProtocol);
  17180. $2=$recv($3)._yourself();
  17181. $recv($1)._announce_($2);
  17182. $4=$self._methodClass();
  17183. if(($receiver = $4) == null || $receiver.a$nil){
  17184. $4;
  17185. } else {
  17186. var methodClass;
  17187. methodClass=$receiver;
  17188. $recv($recv(methodClass)._organization())._addElement_(aString);
  17189. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  17190. }
  17191. return self;
  17192. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  17193. },
  17194. args: ["aString"],
  17195. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' 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: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
  17196. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  17197. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  17198. }),
  17199. $globals.CompiledMethod);
  17200. $core.addMethod(
  17201. $core.method({
  17202. selector: "referencedClasses",
  17203. protocol: "accessing",
  17204. fn: function (){
  17205. var self=this,$self=this;
  17206. return $core.withContext(function($ctx1) {
  17207. return $self._basicAt_("referencedClasses");
  17208. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  17209. },
  17210. args: [],
  17211. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  17212. referencedClasses: [],
  17213. messageSends: ["basicAt:"]
  17214. }),
  17215. $globals.CompiledMethod);
  17216. $core.addMethod(
  17217. $core.method({
  17218. selector: "selector",
  17219. protocol: "accessing",
  17220. fn: function (){
  17221. var self=this,$self=this;
  17222. return $core.withContext(function($ctx1) {
  17223. return $self._basicAt_("selector");
  17224. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  17225. },
  17226. args: [],
  17227. source: "selector\x0a\x09^ self basicAt: 'selector'",
  17228. referencedClasses: [],
  17229. messageSends: ["basicAt:"]
  17230. }),
  17231. $globals.CompiledMethod);
  17232. $core.addMethod(
  17233. $core.method({
  17234. selector: "selector:",
  17235. protocol: "accessing",
  17236. fn: function (aString){
  17237. var self=this,$self=this;
  17238. return $core.withContext(function($ctx1) {
  17239. $self._basicAt_put_("selector",aString);
  17240. return self;
  17241. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  17242. },
  17243. args: ["aString"],
  17244. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  17245. referencedClasses: [],
  17246. messageSends: ["basicAt:put:"]
  17247. }),
  17248. $globals.CompiledMethod);
  17249. $core.addMethod(
  17250. $core.method({
  17251. selector: "sendTo:arguments:",
  17252. protocol: "evaluating",
  17253. fn: function (anObject,aCollection){
  17254. var self=this,$self=this;
  17255. return $core.withContext(function($ctx1) {
  17256. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  17257. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  17258. },
  17259. args: ["anObject", "aCollection"],
  17260. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  17261. referencedClasses: [],
  17262. messageSends: ["applyTo:arguments:", "fn"]
  17263. }),
  17264. $globals.CompiledMethod);
  17265. $core.addMethod(
  17266. $core.method({
  17267. selector: "source",
  17268. protocol: "accessing",
  17269. fn: function (){
  17270. var self=this,$self=this;
  17271. return $core.withContext(function($ctx1) {
  17272. var $1,$receiver;
  17273. $1=$self._basicAt_("source");
  17274. if(($receiver = $1) == null || $receiver.a$nil){
  17275. return "";
  17276. } else {
  17277. return $1;
  17278. }
  17279. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  17280. },
  17281. args: [],
  17282. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  17283. referencedClasses: [],
  17284. messageSends: ["ifNil:", "basicAt:"]
  17285. }),
  17286. $globals.CompiledMethod);
  17287. $core.addMethod(
  17288. $core.method({
  17289. selector: "source:",
  17290. protocol: "accessing",
  17291. fn: function (aString){
  17292. var self=this,$self=this;
  17293. return $core.withContext(function($ctx1) {
  17294. $self._basicAt_put_("source",aString);
  17295. return self;
  17296. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  17297. },
  17298. args: ["aString"],
  17299. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  17300. referencedClasses: [],
  17301. messageSends: ["basicAt:put:"]
  17302. }),
  17303. $globals.CompiledMethod);
  17304. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  17305. $globals.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`";
  17306. $core.addMethod(
  17307. $core.method({
  17308. selector: "addWorker",
  17309. protocol: "private",
  17310. fn: function (){
  17311. var self=this,$self=this;
  17312. return $core.withContext(function($ctx1) {
  17313. $recv($self["@worker"])._valueWithTimeout_((0));
  17314. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  17315. return self;
  17316. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  17317. },
  17318. args: [],
  17319. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  17320. referencedClasses: [],
  17321. messageSends: ["valueWithTimeout:", "+"]
  17322. }),
  17323. $globals.ForkPool);
  17324. $core.addMethod(
  17325. $core.method({
  17326. selector: "defaultMaxPoolSize",
  17327. protocol: "defaults",
  17328. fn: function (){
  17329. var self=this,$self=this;
  17330. return $core.withContext(function($ctx1) {
  17331. return $recv($self._class())._defaultMaxPoolSize();
  17332. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  17333. },
  17334. args: [],
  17335. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  17336. referencedClasses: [],
  17337. messageSends: ["defaultMaxPoolSize", "class"]
  17338. }),
  17339. $globals.ForkPool);
  17340. $core.addMethod(
  17341. $core.method({
  17342. selector: "fork:",
  17343. protocol: "actions",
  17344. fn: function (aBlock){
  17345. var self=this,$self=this;
  17346. return $core.withContext(function($ctx1) {
  17347. var $1;
  17348. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  17349. if($core.assert($1)){
  17350. $self._addWorker();
  17351. }
  17352. $recv($self["@queue"])._nextPut_(aBlock);
  17353. return self;
  17354. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  17355. },
  17356. args: ["aBlock"],
  17357. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  17358. referencedClasses: [],
  17359. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  17360. }),
  17361. $globals.ForkPool);
  17362. $core.addMethod(
  17363. $core.method({
  17364. selector: "initialize",
  17365. protocol: "initialization",
  17366. fn: function (){
  17367. var self=this,$self=this;
  17368. return $core.withContext(function($ctx1) {
  17369. (
  17370. $ctx1.supercall = true,
  17371. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17372. $ctx1.supercall = false;
  17373. $self["@poolSize"]=(0);
  17374. $self["@queue"]=$recv($globals.Queue)._new();
  17375. $self["@worker"]=$self._makeWorker();
  17376. return self;
  17377. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  17378. },
  17379. args: [],
  17380. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  17381. referencedClasses: ["Queue"],
  17382. messageSends: ["initialize", "new", "makeWorker"]
  17383. }),
  17384. $globals.ForkPool);
  17385. $core.addMethod(
  17386. $core.method({
  17387. selector: "makeWorker",
  17388. protocol: "initialization",
  17389. fn: function (){
  17390. var self=this,$self=this;
  17391. var sentinel;
  17392. return $core.withContext(function($ctx1) {
  17393. var $1;
  17394. sentinel=$recv($globals.Object)._new();
  17395. return (function(){
  17396. var block;
  17397. return $core.withContext(function($ctx2) {
  17398. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  17399. $self["@poolSize"];
  17400. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  17401. return sentinel;
  17402. }));
  17403. block;
  17404. $1=$recv(block).__eq_eq(sentinel);
  17405. if(!$core.assert($1)){
  17406. return $recv((function(){
  17407. return $core.withContext(function($ctx3) {
  17408. return $recv(block)._value();
  17409. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  17410. }))._ensure_((function(){
  17411. return $core.withContext(function($ctx3) {
  17412. return $self._addWorker();
  17413. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  17414. }));
  17415. }
  17416. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  17417. });
  17418. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  17419. },
  17420. args: [],
  17421. 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 ] ]]",
  17422. referencedClasses: ["Object"],
  17423. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  17424. }),
  17425. $globals.ForkPool);
  17426. $core.addMethod(
  17427. $core.method({
  17428. selector: "maxPoolSize",
  17429. protocol: "accessing",
  17430. fn: function (){
  17431. var self=this,$self=this;
  17432. return $core.withContext(function($ctx1) {
  17433. var $1,$receiver;
  17434. $1=$self["@maxPoolSize"];
  17435. if(($receiver = $1) == null || $receiver.a$nil){
  17436. return $self._defaultMaxPoolSize();
  17437. } else {
  17438. return $1;
  17439. }
  17440. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  17441. },
  17442. args: [],
  17443. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  17444. referencedClasses: [],
  17445. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  17446. }),
  17447. $globals.ForkPool);
  17448. $core.addMethod(
  17449. $core.method({
  17450. selector: "maxPoolSize:",
  17451. protocol: "accessing",
  17452. fn: function (anInteger){
  17453. var self=this,$self=this;
  17454. $self["@maxPoolSize"]=anInteger;
  17455. return self;
  17456. },
  17457. args: ["anInteger"],
  17458. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  17459. referencedClasses: [],
  17460. messageSends: []
  17461. }),
  17462. $globals.ForkPool);
  17463. $globals.ForkPool.a$cls.iVarNames = ["default"];
  17464. $core.addMethod(
  17465. $core.method({
  17466. selector: "default",
  17467. protocol: "accessing",
  17468. fn: function (){
  17469. var self=this,$self=this;
  17470. return $core.withContext(function($ctx1) {
  17471. var $1,$receiver;
  17472. $1=$self["@default"];
  17473. if(($receiver = $1) == null || $receiver.a$nil){
  17474. $self["@default"]=$self._new();
  17475. return $self["@default"];
  17476. } else {
  17477. return $1;
  17478. }
  17479. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  17480. },
  17481. args: [],
  17482. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  17483. referencedClasses: [],
  17484. messageSends: ["ifNil:", "new"]
  17485. }),
  17486. $globals.ForkPool.a$cls);
  17487. $core.addMethod(
  17488. $core.method({
  17489. selector: "defaultMaxPoolSize",
  17490. protocol: "accessing",
  17491. fn: function (){
  17492. var self=this,$self=this;
  17493. return (100);
  17494. },
  17495. args: [],
  17496. source: "defaultMaxPoolSize\x0a\x09^ 100",
  17497. referencedClasses: [],
  17498. messageSends: []
  17499. }),
  17500. $globals.ForkPool.a$cls);
  17501. $core.addMethod(
  17502. $core.method({
  17503. selector: "resetDefault",
  17504. protocol: "accessing",
  17505. fn: function (){
  17506. var self=this,$self=this;
  17507. $self["@default"]=nil;
  17508. return self;
  17509. },
  17510. args: [],
  17511. source: "resetDefault\x0a\x09default := nil",
  17512. referencedClasses: [],
  17513. messageSends: []
  17514. }),
  17515. $globals.ForkPool.a$cls);
  17516. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  17517. $globals.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.";
  17518. $core.addMethod(
  17519. $core.method({
  17520. selector: "arguments",
  17521. protocol: "accessing",
  17522. fn: function (){
  17523. var self=this,$self=this;
  17524. return $self["@arguments"];
  17525. },
  17526. args: [],
  17527. source: "arguments\x0a\x09^ arguments",
  17528. referencedClasses: [],
  17529. messageSends: []
  17530. }),
  17531. $globals.Message);
  17532. $core.addMethod(
  17533. $core.method({
  17534. selector: "arguments:",
  17535. protocol: "accessing",
  17536. fn: function (anArray){
  17537. var self=this,$self=this;
  17538. $self["@arguments"]=anArray;
  17539. return self;
  17540. },
  17541. args: ["anArray"],
  17542. source: "arguments: anArray\x0a\x09arguments := anArray",
  17543. referencedClasses: [],
  17544. messageSends: []
  17545. }),
  17546. $globals.Message);
  17547. $core.addMethod(
  17548. $core.method({
  17549. selector: "printOn:",
  17550. protocol: "printing",
  17551. fn: function (aStream){
  17552. var self=this,$self=this;
  17553. return $core.withContext(function($ctx1) {
  17554. (
  17555. $ctx1.supercall = true,
  17556. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  17557. $ctx1.supercall = false;
  17558. $recv(aStream)._nextPutAll_("(");
  17559. $ctx1.sendIdx["nextPutAll:"]=1;
  17560. $recv(aStream)._nextPutAll_($self._selector());
  17561. $ctx1.sendIdx["nextPutAll:"]=2;
  17562. $recv(aStream)._nextPutAll_(")");
  17563. return self;
  17564. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  17565. },
  17566. args: ["aStream"],
  17567. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  17568. referencedClasses: [],
  17569. messageSends: ["printOn:", "nextPutAll:", "selector"]
  17570. }),
  17571. $globals.Message);
  17572. $core.addMethod(
  17573. $core.method({
  17574. selector: "selector",
  17575. protocol: "accessing",
  17576. fn: function (){
  17577. var self=this,$self=this;
  17578. return $self["@selector"];
  17579. },
  17580. args: [],
  17581. source: "selector\x0a\x09^ selector",
  17582. referencedClasses: [],
  17583. messageSends: []
  17584. }),
  17585. $globals.Message);
  17586. $core.addMethod(
  17587. $core.method({
  17588. selector: "selector:",
  17589. protocol: "accessing",
  17590. fn: function (aString){
  17591. var self=this,$self=this;
  17592. $self["@selector"]=aString;
  17593. return self;
  17594. },
  17595. args: ["aString"],
  17596. source: "selector: aString\x0a\x09selector := aString",
  17597. referencedClasses: [],
  17598. messageSends: []
  17599. }),
  17600. $globals.Message);
  17601. $core.addMethod(
  17602. $core.method({
  17603. selector: "sendTo:",
  17604. protocol: "actions",
  17605. fn: function (anObject){
  17606. var self=this,$self=this;
  17607. return $core.withContext(function($ctx1) {
  17608. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  17609. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  17610. },
  17611. args: ["anObject"],
  17612. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  17613. referencedClasses: [],
  17614. messageSends: ["perform:withArguments:", "selector", "arguments"]
  17615. }),
  17616. $globals.Message);
  17617. $core.addMethod(
  17618. $core.method({
  17619. selector: "selector:arguments:",
  17620. protocol: "instance creation",
  17621. fn: function (aString,anArray){
  17622. var self=this,$self=this;
  17623. return $core.withContext(function($ctx1) {
  17624. var $1;
  17625. $1=$self._new();
  17626. $recv($1)._selector_(aString);
  17627. $recv($1)._arguments_(anArray);
  17628. return $recv($1)._yourself();
  17629. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  17630. },
  17631. args: ["aString", "anArray"],
  17632. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  17633. referencedClasses: [],
  17634. messageSends: ["selector:", "new", "arguments:", "yourself"]
  17635. }),
  17636. $globals.Message.a$cls);
  17637. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  17638. $globals.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.";
  17639. $core.addMethod(
  17640. $core.method({
  17641. selector: "arguments",
  17642. protocol: "accessing",
  17643. fn: function (){
  17644. var self=this,$self=this;
  17645. return $core.withContext(function($ctx1) {
  17646. return $recv($self["@message"])._arguments();
  17647. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  17648. },
  17649. args: [],
  17650. source: "arguments\x0a\x09^ message arguments",
  17651. referencedClasses: [],
  17652. messageSends: ["arguments"]
  17653. }),
  17654. $globals.MessageSend);
  17655. $core.addMethod(
  17656. $core.method({
  17657. selector: "arguments:",
  17658. protocol: "accessing",
  17659. fn: function (aCollection){
  17660. var self=this,$self=this;
  17661. return $core.withContext(function($ctx1) {
  17662. $recv($self["@message"])._arguments_(aCollection);
  17663. return self;
  17664. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  17665. },
  17666. args: ["aCollection"],
  17667. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  17668. referencedClasses: [],
  17669. messageSends: ["arguments:"]
  17670. }),
  17671. $globals.MessageSend);
  17672. $core.addMethod(
  17673. $core.method({
  17674. selector: "initialize",
  17675. protocol: "initialization",
  17676. fn: function (){
  17677. var self=this,$self=this;
  17678. return $core.withContext(function($ctx1) {
  17679. (
  17680. $ctx1.supercall = true,
  17681. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17682. $ctx1.supercall = false;
  17683. $self["@message"]=$recv($globals.Message)._new();
  17684. return self;
  17685. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  17686. },
  17687. args: [],
  17688. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  17689. referencedClasses: ["Message"],
  17690. messageSends: ["initialize", "new"]
  17691. }),
  17692. $globals.MessageSend);
  17693. $core.addMethod(
  17694. $core.method({
  17695. selector: "printOn:",
  17696. protocol: "printing",
  17697. fn: function (aStream){
  17698. var self=this,$self=this;
  17699. return $core.withContext(function($ctx1) {
  17700. (
  17701. $ctx1.supercall = true,
  17702. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  17703. $ctx1.supercall = false;
  17704. $recv(aStream)._nextPutAll_("(");
  17705. $ctx1.sendIdx["nextPutAll:"]=1;
  17706. $recv(aStream)._nextPutAll_($self._receiver());
  17707. $ctx1.sendIdx["nextPutAll:"]=2;
  17708. $recv(aStream)._nextPutAll_(" >> ");
  17709. $ctx1.sendIdx["nextPutAll:"]=3;
  17710. $recv(aStream)._nextPutAll_($self._selector());
  17711. $ctx1.sendIdx["nextPutAll:"]=4;
  17712. $recv(aStream)._nextPutAll_(")");
  17713. return self;
  17714. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  17715. },
  17716. args: ["aStream"],
  17717. 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: ')'",
  17718. referencedClasses: [],
  17719. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  17720. }),
  17721. $globals.MessageSend);
  17722. $core.addMethod(
  17723. $core.method({
  17724. selector: "receiver",
  17725. protocol: "accessing",
  17726. fn: function (){
  17727. var self=this,$self=this;
  17728. return $self["@receiver"];
  17729. },
  17730. args: [],
  17731. source: "receiver\x0a\x09^ receiver",
  17732. referencedClasses: [],
  17733. messageSends: []
  17734. }),
  17735. $globals.MessageSend);
  17736. $core.addMethod(
  17737. $core.method({
  17738. selector: "receiver:",
  17739. protocol: "accessing",
  17740. fn: function (anObject){
  17741. var self=this,$self=this;
  17742. $self["@receiver"]=anObject;
  17743. return self;
  17744. },
  17745. args: ["anObject"],
  17746. source: "receiver: anObject\x0a\x09receiver := anObject",
  17747. referencedClasses: [],
  17748. messageSends: []
  17749. }),
  17750. $globals.MessageSend);
  17751. $core.addMethod(
  17752. $core.method({
  17753. selector: "selector",
  17754. protocol: "accessing",
  17755. fn: function (){
  17756. var self=this,$self=this;
  17757. return $core.withContext(function($ctx1) {
  17758. return $recv($self["@message"])._selector();
  17759. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  17760. },
  17761. args: [],
  17762. source: "selector\x0a\x09^ message selector",
  17763. referencedClasses: [],
  17764. messageSends: ["selector"]
  17765. }),
  17766. $globals.MessageSend);
  17767. $core.addMethod(
  17768. $core.method({
  17769. selector: "selector:",
  17770. protocol: "accessing",
  17771. fn: function (aString){
  17772. var self=this,$self=this;
  17773. return $core.withContext(function($ctx1) {
  17774. $recv($self["@message"])._selector_(aString);
  17775. return self;
  17776. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  17777. },
  17778. args: ["aString"],
  17779. source: "selector: aString\x0a\x09message selector: aString",
  17780. referencedClasses: [],
  17781. messageSends: ["selector:"]
  17782. }),
  17783. $globals.MessageSend);
  17784. $core.addMethod(
  17785. $core.method({
  17786. selector: "value",
  17787. protocol: "evaluating",
  17788. fn: function (){
  17789. var self=this,$self=this;
  17790. return $core.withContext(function($ctx1) {
  17791. return $recv($self["@message"])._sendTo_($self._receiver());
  17792. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  17793. },
  17794. args: [],
  17795. source: "value\x0a\x09^ message sendTo: self receiver",
  17796. referencedClasses: [],
  17797. messageSends: ["sendTo:", "receiver"]
  17798. }),
  17799. $globals.MessageSend);
  17800. $core.addMethod(
  17801. $core.method({
  17802. selector: "value:",
  17803. protocol: "evaluating",
  17804. fn: function (anObject){
  17805. var self=this,$self=this;
  17806. return $core.withContext(function($ctx1) {
  17807. var $1;
  17808. $1=$self["@message"];
  17809. $recv($1)._arguments_([anObject]);
  17810. return $recv($1)._sendTo_($self._receiver());
  17811. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  17812. },
  17813. args: ["anObject"],
  17814. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  17815. referencedClasses: [],
  17816. messageSends: ["arguments:", "sendTo:", "receiver"]
  17817. }),
  17818. $globals.MessageSend);
  17819. $core.addMethod(
  17820. $core.method({
  17821. selector: "value:value:",
  17822. protocol: "evaluating",
  17823. fn: function (firstArgument,secondArgument){
  17824. var self=this,$self=this;
  17825. return $core.withContext(function($ctx1) {
  17826. var $1;
  17827. $1=$self["@message"];
  17828. $recv($1)._arguments_([firstArgument,secondArgument]);
  17829. return $recv($1)._sendTo_($self._receiver());
  17830. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  17831. },
  17832. args: ["firstArgument", "secondArgument"],
  17833. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  17834. referencedClasses: [],
  17835. messageSends: ["arguments:", "sendTo:", "receiver"]
  17836. }),
  17837. $globals.MessageSend);
  17838. $core.addMethod(
  17839. $core.method({
  17840. selector: "value:value:value:",
  17841. protocol: "evaluating",
  17842. fn: function (firstArgument,secondArgument,thirdArgument){
  17843. var self=this,$self=this;
  17844. return $core.withContext(function($ctx1) {
  17845. var $1;
  17846. $1=$self["@message"];
  17847. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  17848. return $recv($1)._sendTo_($self._receiver());
  17849. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  17850. },
  17851. args: ["firstArgument", "secondArgument", "thirdArgument"],
  17852. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  17853. referencedClasses: [],
  17854. messageSends: ["arguments:", "sendTo:", "receiver"]
  17855. }),
  17856. $globals.MessageSend);
  17857. $core.addMethod(
  17858. $core.method({
  17859. selector: "valueWithPossibleArguments:",
  17860. protocol: "evaluating",
  17861. fn: function (aCollection){
  17862. var self=this,$self=this;
  17863. return $core.withContext(function($ctx1) {
  17864. $self._arguments_(aCollection);
  17865. return $self._value();
  17866. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  17867. },
  17868. args: ["aCollection"],
  17869. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  17870. referencedClasses: [],
  17871. messageSends: ["arguments:", "value"]
  17872. }),
  17873. $globals.MessageSend);
  17874. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  17875. $globals.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`.";
  17876. $core.addMethod(
  17877. $core.method({
  17878. selector: "asString",
  17879. protocol: "converting",
  17880. fn: function (){
  17881. var self=this,$self=this;
  17882. return $core.withContext(function($ctx1) {
  17883. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  17884. $2=$self._isBlockContext();
  17885. if($core.assert($2)){
  17886. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  17887. $ctx1.sendIdx[","]=2;
  17888. $1=$recv($3).__comma(")");
  17889. $ctx1.sendIdx[","]=1;
  17890. } else {
  17891. var methodClass;
  17892. methodClass=$recv($self._method())._methodClass();
  17893. methodClass;
  17894. $5=methodClass;
  17895. $7=$self._receiver();
  17896. $ctx1.sendIdx["receiver"]=1;
  17897. $6=$recv($7)._class();
  17898. $ctx1.sendIdx["class"]=1;
  17899. $4=$recv($5).__eq($6);
  17900. if($core.assert($4)){
  17901. $11=$self._receiver();
  17902. $ctx1.sendIdx["receiver"]=2;
  17903. $10=$recv($11)._class();
  17904. $ctx1.sendIdx["class"]=2;
  17905. $9=$recv($10)._name();
  17906. $ctx1.sendIdx["name"]=1;
  17907. $8=$recv($9).__comma(" >> ");
  17908. $ctx1.sendIdx[","]=4;
  17909. $12=$self._selector();
  17910. $ctx1.sendIdx["selector"]=1;
  17911. $1=$recv($8).__comma($12);
  17912. $ctx1.sendIdx[","]=3;
  17913. } else {
  17914. $16=$recv($recv($self._receiver())._class())._name();
  17915. $ctx1.sendIdx["name"]=2;
  17916. $15=$recv($16).__comma("(");
  17917. $14=$recv($15).__comma($recv(methodClass)._name());
  17918. $ctx1.sendIdx[","]=7;
  17919. $13=$recv($14).__comma(") >> ");
  17920. $ctx1.sendIdx[","]=6;
  17921. $1=$recv($13).__comma($self._selector());
  17922. $ctx1.sendIdx[","]=5;
  17923. }
  17924. }
  17925. return $1;
  17926. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  17927. },
  17928. args: [],
  17929. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]",
  17930. referencedClasses: [],
  17931. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  17932. }),
  17933. $globals.MethodContext);
  17934. $core.addMethod(
  17935. $core.method({
  17936. selector: "basicReceiver",
  17937. protocol: "accessing",
  17938. fn: function (){
  17939. var self=this,$self=this;
  17940. return $core.withContext(function($ctx1) {
  17941. return self.receiver;
  17942. return self;
  17943. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  17944. },
  17945. args: [],
  17946. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  17947. referencedClasses: [],
  17948. messageSends: []
  17949. }),
  17950. $globals.MethodContext);
  17951. $core.addMethod(
  17952. $core.method({
  17953. selector: "evaluatedSelector",
  17954. protocol: "accessing",
  17955. fn: function (){
  17956. var self=this,$self=this;
  17957. return $core.withContext(function($ctx1) {
  17958. return self.evaluatedSelector;
  17959. return self;
  17960. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  17961. },
  17962. args: [],
  17963. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  17964. referencedClasses: [],
  17965. messageSends: []
  17966. }),
  17967. $globals.MethodContext);
  17968. $core.addMethod(
  17969. $core.method({
  17970. selector: "findContextSuchThat:",
  17971. protocol: "accessing",
  17972. fn: function (testBlock){
  17973. var self=this,$self=this;
  17974. var context;
  17975. return $core.withContext(function($ctx1) {
  17976. var $1;
  17977. var $early={};
  17978. try {
  17979. context=self;
  17980. $recv((function(){
  17981. return $core.withContext(function($ctx2) {
  17982. return $recv(context)._isNil();
  17983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17984. }))._whileFalse_((function(){
  17985. return $core.withContext(function($ctx2) {
  17986. $1=$recv(testBlock)._value_(context);
  17987. if($core.assert($1)){
  17988. throw $early=[context];
  17989. }
  17990. context=$recv(context)._outerContext();
  17991. return context;
  17992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  17993. }));
  17994. return nil;
  17995. }
  17996. catch(e) {if(e===$early)return e[0]; throw e}
  17997. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  17998. },
  17999. args: ["testBlock"],
  18000. source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
  18001. referencedClasses: [],
  18002. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  18003. }),
  18004. $globals.MethodContext);
  18005. $core.addMethod(
  18006. $core.method({
  18007. selector: "home",
  18008. protocol: "accessing",
  18009. fn: function (){
  18010. var self=this,$self=this;
  18011. return $core.withContext(function($ctx1) {
  18012. return self.homeContext;
  18013. return self;
  18014. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  18015. },
  18016. args: [],
  18017. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  18018. referencedClasses: [],
  18019. messageSends: []
  18020. }),
  18021. $globals.MethodContext);
  18022. $core.addMethod(
  18023. $core.method({
  18024. selector: "index",
  18025. protocol: "accessing",
  18026. fn: function (){
  18027. var self=this,$self=this;
  18028. return $core.withContext(function($ctx1) {
  18029. return self.index || 0;
  18030. return self;
  18031. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  18032. },
  18033. args: [],
  18034. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  18035. referencedClasses: [],
  18036. messageSends: []
  18037. }),
  18038. $globals.MethodContext);
  18039. $core.addMethod(
  18040. $core.method({
  18041. selector: "isBlockContext",
  18042. protocol: "testing",
  18043. fn: function (){
  18044. var self=this,$self=this;
  18045. return $core.withContext(function($ctx1) {
  18046. return $recv($self._selector())._isNil();
  18047. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  18048. },
  18049. args: [],
  18050. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  18051. referencedClasses: [],
  18052. messageSends: ["isNil", "selector"]
  18053. }),
  18054. $globals.MethodContext);
  18055. $core.addMethod(
  18056. $core.method({
  18057. selector: "locals",
  18058. protocol: "accessing",
  18059. fn: function (){
  18060. var self=this,$self=this;
  18061. return $core.withContext(function($ctx1) {
  18062. return self.locals || {};
  18063. return self;
  18064. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  18065. },
  18066. args: [],
  18067. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  18068. referencedClasses: [],
  18069. messageSends: []
  18070. }),
  18071. $globals.MethodContext);
  18072. $core.addMethod(
  18073. $core.method({
  18074. selector: "method",
  18075. protocol: "accessing",
  18076. fn: function (){
  18077. var self=this,$self=this;
  18078. var method,lookupClass,receiverClass,supercall;
  18079. return $core.withContext(function($ctx1) {
  18080. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  18081. $1=$self._methodContext();
  18082. $ctx1.sendIdx["methodContext"]=1;
  18083. if(($receiver = $1) == null || $receiver.a$nil){
  18084. return nil;
  18085. } else {
  18086. $1;
  18087. }
  18088. $3=$self._methodContext();
  18089. $ctx1.sendIdx["methodContext"]=2;
  18090. $2=$recv($3)._receiver();
  18091. receiverClass=$recv($2)._class();
  18092. $4=receiverClass;
  18093. $6=$self._methodContext();
  18094. $ctx1.sendIdx["methodContext"]=3;
  18095. $5=$recv($6)._selector();
  18096. $ctx1.sendIdx["selector"]=1;
  18097. method=$recv($4)._lookupSelector_($5);
  18098. $ctx1.sendIdx["lookupSelector:"]=1;
  18099. $7=$self._outerContext();
  18100. if(($receiver = $7) == null || $receiver.a$nil){
  18101. supercall=false;
  18102. } else {
  18103. var outer;
  18104. outer=$receiver;
  18105. supercall=$recv(outer)._supercall();
  18106. }
  18107. $8=supercall;
  18108. if($core.assert($8)){
  18109. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  18110. } else {
  18111. return method;
  18112. }
  18113. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  18114. },
  18115. args: [],
  18116. source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
  18117. referencedClasses: [],
  18118. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  18119. }),
  18120. $globals.MethodContext);
  18121. $core.addMethod(
  18122. $core.method({
  18123. selector: "methodContext",
  18124. protocol: "accessing",
  18125. fn: function (){
  18126. var self=this,$self=this;
  18127. return $core.withContext(function($ctx1) {
  18128. var $1,$2,$receiver;
  18129. $1=$self._isBlockContext();
  18130. if(!$core.assert($1)){
  18131. return self;
  18132. }
  18133. $2=$self._outerContext();
  18134. if(($receiver = $2) == null || $receiver.a$nil){
  18135. return $2;
  18136. } else {
  18137. var outer;
  18138. outer=$receiver;
  18139. return $recv(outer)._methodContext();
  18140. }
  18141. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  18142. },
  18143. args: [],
  18144. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  18145. referencedClasses: [],
  18146. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  18147. }),
  18148. $globals.MethodContext);
  18149. $core.addMethod(
  18150. $core.method({
  18151. selector: "outerContext",
  18152. protocol: "accessing",
  18153. fn: function (){
  18154. var self=this,$self=this;
  18155. return $core.withContext(function($ctx1) {
  18156. return self.outerContext || self.homeContext;
  18157. return self;
  18158. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  18159. },
  18160. args: [],
  18161. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  18162. referencedClasses: [],
  18163. messageSends: []
  18164. }),
  18165. $globals.MethodContext);
  18166. $core.addMethod(
  18167. $core.method({
  18168. selector: "printOn:",
  18169. protocol: "printing",
  18170. fn: function (aStream){
  18171. var self=this,$self=this;
  18172. return $core.withContext(function($ctx1) {
  18173. (
  18174. $ctx1.supercall = true,
  18175. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18176. $ctx1.supercall = false;
  18177. $recv(aStream)._nextPutAll_("(");
  18178. $ctx1.sendIdx["nextPutAll:"]=1;
  18179. $recv(aStream)._nextPutAll_($self._asString());
  18180. $ctx1.sendIdx["nextPutAll:"]=2;
  18181. $recv(aStream)._nextPutAll_(")");
  18182. return self;
  18183. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  18184. },
  18185. args: ["aStream"],
  18186. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  18187. referencedClasses: [],
  18188. messageSends: ["printOn:", "nextPutAll:", "asString"]
  18189. }),
  18190. $globals.MethodContext);
  18191. $core.addMethod(
  18192. $core.method({
  18193. selector: "receiver",
  18194. protocol: "accessing",
  18195. fn: function (){
  18196. var self=this,$self=this;
  18197. return $core.withContext(function($ctx1) {
  18198. var $2,$1;
  18199. $1=$recv($self._isBlockContext())._and_((function(){
  18200. return $core.withContext(function($ctx2) {
  18201. $2=$self._outerContext();
  18202. $ctx2.sendIdx["outerContext"]=1;
  18203. return $recv($2)._notNil();
  18204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18205. }));
  18206. if($core.assert($1)){
  18207. return $recv($self._outerContext())._receiver();
  18208. } else {
  18209. return $self._basicReceiver();
  18210. }
  18211. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  18212. },
  18213. args: [],
  18214. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  18215. referencedClasses: [],
  18216. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  18217. }),
  18218. $globals.MethodContext);
  18219. $core.addMethod(
  18220. $core.method({
  18221. selector: "selector",
  18222. protocol: "accessing",
  18223. fn: function (){
  18224. var self=this,$self=this;
  18225. return $core.withContext(function($ctx1) {
  18226. if(self.selector) {
  18227. return $core.js2st(self.selector);
  18228. } else {
  18229. return nil;
  18230. }
  18231. ;
  18232. return self;
  18233. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  18234. },
  18235. args: [],
  18236. source: "selector\x0a\x09<inlineJS: '\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return $core.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09'>",
  18237. referencedClasses: [],
  18238. messageSends: []
  18239. }),
  18240. $globals.MethodContext);
  18241. $core.addMethod(
  18242. $core.method({
  18243. selector: "sendIndexAt:",
  18244. protocol: "accessing",
  18245. fn: function (aSelector){
  18246. var self=this,$self=this;
  18247. return $core.withContext(function($ctx1) {
  18248. return self.sendIdx[aSelector] || 0;
  18249. return self;
  18250. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  18251. },
  18252. args: ["aSelector"],
  18253. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  18254. referencedClasses: [],
  18255. messageSends: []
  18256. }),
  18257. $globals.MethodContext);
  18258. $core.addMethod(
  18259. $core.method({
  18260. selector: "sendIndexes",
  18261. protocol: "accessing",
  18262. fn: function (){
  18263. var self=this,$self=this;
  18264. return $core.withContext(function($ctx1) {
  18265. return self.sendIdx;
  18266. return self;
  18267. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  18268. },
  18269. args: [],
  18270. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  18271. referencedClasses: [],
  18272. messageSends: []
  18273. }),
  18274. $globals.MethodContext);
  18275. $core.addMethod(
  18276. $core.method({
  18277. selector: "supercall",
  18278. protocol: "accessing",
  18279. fn: function (){
  18280. var self=this,$self=this;
  18281. return $core.withContext(function($ctx1) {
  18282. return self.supercall == true;
  18283. return self;
  18284. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  18285. },
  18286. args: [],
  18287. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  18288. referencedClasses: [],
  18289. messageSends: []
  18290. }),
  18291. $globals.MethodContext);
  18292. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  18293. $globals.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' ]";
  18294. $core.addMethod(
  18295. $core.method({
  18296. selector: "constructorNamed:",
  18297. protocol: "instance creation",
  18298. fn: function (aString){
  18299. var self=this,$self=this;
  18300. return $core.withContext(function($ctx1) {
  18301. var nativeFunc=(new Function('return this'))()[aString];
  18302. return new nativeFunc();
  18303. ;
  18304. return self;
  18305. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  18306. },
  18307. args: ["aString"],
  18308. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  18309. referencedClasses: [],
  18310. messageSends: []
  18311. }),
  18312. $globals.NativeFunction.a$cls);
  18313. $core.addMethod(
  18314. $core.method({
  18315. selector: "constructorNamed:value:",
  18316. protocol: "instance creation",
  18317. fn: function (aString,anObject){
  18318. var self=this,$self=this;
  18319. return $core.withContext(function($ctx1) {
  18320. var nativeFunc=(new Function('return this'))()[aString];
  18321. return new nativeFunc(anObject);
  18322. ;
  18323. return self;
  18324. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  18325. },
  18326. args: ["aString", "anObject"],
  18327. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  18328. referencedClasses: [],
  18329. messageSends: []
  18330. }),
  18331. $globals.NativeFunction.a$cls);
  18332. $core.addMethod(
  18333. $core.method({
  18334. selector: "constructorNamed:value:value:",
  18335. protocol: "instance creation",
  18336. fn: function (aString,anObject,anObject2){
  18337. var self=this,$self=this;
  18338. return $core.withContext(function($ctx1) {
  18339. var nativeFunc=(new Function('return this'))()[aString];
  18340. return new nativeFunc(anObject,anObject2);
  18341. ;
  18342. return self;
  18343. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  18344. },
  18345. args: ["aString", "anObject", "anObject2"],
  18346. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  18347. referencedClasses: [],
  18348. messageSends: []
  18349. }),
  18350. $globals.NativeFunction.a$cls);
  18351. $core.addMethod(
  18352. $core.method({
  18353. selector: "constructorNamed:value:value:value:",
  18354. protocol: "instance creation",
  18355. fn: function (aString,anObject,anObject2,anObject3){
  18356. var self=this,$self=this;
  18357. return $core.withContext(function($ctx1) {
  18358. var nativeFunc=(new Function('return this'))()[aString];
  18359. return new nativeFunc(anObject,anObject2, anObject3);
  18360. ;
  18361. return self;
  18362. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  18363. },
  18364. args: ["aString", "anObject", "anObject2", "anObject3"],
  18365. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18366. referencedClasses: [],
  18367. messageSends: []
  18368. }),
  18369. $globals.NativeFunction.a$cls);
  18370. $core.addMethod(
  18371. $core.method({
  18372. selector: "constructorOf:",
  18373. protocol: "instance creation",
  18374. fn: function (nativeFunc){
  18375. var self=this,$self=this;
  18376. return $core.withContext(function($ctx1) {
  18377. return new nativeFunc();
  18378. ;
  18379. return self;
  18380. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  18381. },
  18382. args: ["nativeFunc"],
  18383. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  18384. referencedClasses: [],
  18385. messageSends: []
  18386. }),
  18387. $globals.NativeFunction.a$cls);
  18388. $core.addMethod(
  18389. $core.method({
  18390. selector: "constructorOf:value:",
  18391. protocol: "instance creation",
  18392. fn: function (nativeFunc,anObject){
  18393. var self=this,$self=this;
  18394. return $core.withContext(function($ctx1) {
  18395. return new nativeFunc(anObject);
  18396. ;
  18397. return self;
  18398. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  18399. },
  18400. args: ["nativeFunc", "anObject"],
  18401. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  18402. referencedClasses: [],
  18403. messageSends: []
  18404. }),
  18405. $globals.NativeFunction.a$cls);
  18406. $core.addMethod(
  18407. $core.method({
  18408. selector: "constructorOf:value:value:",
  18409. protocol: "instance creation",
  18410. fn: function (nativeFunc,anObject,anObject2){
  18411. var self=this,$self=this;
  18412. return $core.withContext(function($ctx1) {
  18413. return new nativeFunc(anObject,anObject2);
  18414. ;
  18415. return self;
  18416. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  18417. },
  18418. args: ["nativeFunc", "anObject", "anObject2"],
  18419. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  18420. referencedClasses: [],
  18421. messageSends: []
  18422. }),
  18423. $globals.NativeFunction.a$cls);
  18424. $core.addMethod(
  18425. $core.method({
  18426. selector: "constructorOf:value:value:value:",
  18427. protocol: "instance creation",
  18428. fn: function (nativeFunc,anObject,anObject2,anObject3){
  18429. var self=this,$self=this;
  18430. return $core.withContext(function($ctx1) {
  18431. return new nativeFunc(anObject,anObject2, anObject3);
  18432. ;
  18433. return self;
  18434. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  18435. },
  18436. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  18437. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18438. referencedClasses: [],
  18439. messageSends: []
  18440. }),
  18441. $globals.NativeFunction.a$cls);
  18442. $core.addMethod(
  18443. $core.method({
  18444. selector: "exists:",
  18445. protocol: "testing",
  18446. fn: function (aString){
  18447. var self=this,$self=this;
  18448. return $core.withContext(function($ctx1) {
  18449. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  18450. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  18451. },
  18452. args: ["aString"],
  18453. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  18454. referencedClasses: ["Smalltalk"],
  18455. messageSends: ["existsJsGlobal:"]
  18456. }),
  18457. $globals.NativeFunction.a$cls);
  18458. $core.addMethod(
  18459. $core.method({
  18460. selector: "functionNamed:",
  18461. protocol: "function calling",
  18462. fn: function (aString){
  18463. var self=this,$self=this;
  18464. return $core.withContext(function($ctx1) {
  18465. var nativeFunc=(new Function('return this'))()[aString];
  18466. return nativeFunc();
  18467. ;
  18468. return self;
  18469. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  18470. },
  18471. args: ["aString"],
  18472. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  18473. referencedClasses: [],
  18474. messageSends: []
  18475. }),
  18476. $globals.NativeFunction.a$cls);
  18477. $core.addMethod(
  18478. $core.method({
  18479. selector: "functionNamed:value:",
  18480. protocol: "function calling",
  18481. fn: function (aString,anObject){
  18482. var self=this,$self=this;
  18483. return $core.withContext(function($ctx1) {
  18484. var nativeFunc=(new Function('return this'))()[aString];
  18485. return nativeFunc(anObject);
  18486. ;
  18487. return self;
  18488. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  18489. },
  18490. args: ["aString", "anObject"],
  18491. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  18492. referencedClasses: [],
  18493. messageSends: []
  18494. }),
  18495. $globals.NativeFunction.a$cls);
  18496. $core.addMethod(
  18497. $core.method({
  18498. selector: "functionNamed:value:value:",
  18499. protocol: "function calling",
  18500. fn: function (aString,anObject,anObject2){
  18501. var self=this,$self=this;
  18502. return $core.withContext(function($ctx1) {
  18503. var nativeFunc=(new Function('return this'))()[aString];
  18504. return nativeFunc(anObject,anObject2);
  18505. ;
  18506. return self;
  18507. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  18508. },
  18509. args: ["aString", "anObject", "anObject2"],
  18510. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  18511. referencedClasses: [],
  18512. messageSends: []
  18513. }),
  18514. $globals.NativeFunction.a$cls);
  18515. $core.addMethod(
  18516. $core.method({
  18517. selector: "functionNamed:value:value:value:",
  18518. protocol: "function calling",
  18519. fn: function (aString,anObject,anObject2,anObject3){
  18520. var self=this,$self=this;
  18521. return $core.withContext(function($ctx1) {
  18522. var nativeFunc=(new Function('return this'))()[aString];
  18523. return nativeFunc(anObject,anObject2, anObject3);
  18524. ;
  18525. return self;
  18526. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  18527. },
  18528. args: ["aString", "anObject", "anObject2", "anObject3"],
  18529. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18530. referencedClasses: [],
  18531. messageSends: []
  18532. }),
  18533. $globals.NativeFunction.a$cls);
  18534. $core.addMethod(
  18535. $core.method({
  18536. selector: "functionNamed:valueWithArgs:",
  18537. protocol: "function calling",
  18538. fn: function (aString,args){
  18539. var self=this,$self=this;
  18540. return $core.withContext(function($ctx1) {
  18541. var nativeFunc=(new Function('return this'))()[aString];
  18542. return Function.prototype.apply.call(nativeFunc, null, args);
  18543. ;
  18544. return self;
  18545. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  18546. },
  18547. args: ["aString", "args"],
  18548. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  18549. referencedClasses: [],
  18550. messageSends: []
  18551. }),
  18552. $globals.NativeFunction.a$cls);
  18553. $core.addMethod(
  18554. $core.method({
  18555. selector: "functionOf:",
  18556. protocol: "function calling",
  18557. fn: function (nativeFunc){
  18558. var self=this,$self=this;
  18559. return $core.withContext(function($ctx1) {
  18560. return nativeFunc();
  18561. ;
  18562. return self;
  18563. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  18564. },
  18565. args: ["nativeFunc"],
  18566. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  18567. referencedClasses: [],
  18568. messageSends: []
  18569. }),
  18570. $globals.NativeFunction.a$cls);
  18571. $core.addMethod(
  18572. $core.method({
  18573. selector: "functionOf:value:",
  18574. protocol: "function calling",
  18575. fn: function (nativeFunc,anObject){
  18576. var self=this,$self=this;
  18577. return $core.withContext(function($ctx1) {
  18578. return nativeFunc(anObject);
  18579. ;
  18580. return self;
  18581. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  18582. },
  18583. args: ["nativeFunc", "anObject"],
  18584. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  18585. referencedClasses: [],
  18586. messageSends: []
  18587. }),
  18588. $globals.NativeFunction.a$cls);
  18589. $core.addMethod(
  18590. $core.method({
  18591. selector: "functionOf:value:value:",
  18592. protocol: "function calling",
  18593. fn: function (nativeFunc,anObject,anObject2){
  18594. var self=this,$self=this;
  18595. return $core.withContext(function($ctx1) {
  18596. return nativeFunc(anObject,anObject2);
  18597. ;
  18598. return self;
  18599. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  18600. },
  18601. args: ["nativeFunc", "anObject", "anObject2"],
  18602. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  18603. referencedClasses: [],
  18604. messageSends: []
  18605. }),
  18606. $globals.NativeFunction.a$cls);
  18607. $core.addMethod(
  18608. $core.method({
  18609. selector: "functionOf:value:value:value:",
  18610. protocol: "function calling",
  18611. fn: function (nativeFunc,anObject,anObject2,anObject3){
  18612. var self=this,$self=this;
  18613. return $core.withContext(function($ctx1) {
  18614. return nativeFunc(anObject,anObject2, anObject3);
  18615. ;
  18616. return self;
  18617. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  18618. },
  18619. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  18620. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18621. referencedClasses: [],
  18622. messageSends: []
  18623. }),
  18624. $globals.NativeFunction.a$cls);
  18625. $core.addMethod(
  18626. $core.method({
  18627. selector: "functionOf:valueWithArgs:",
  18628. protocol: "function calling",
  18629. fn: function (nativeFunc,args){
  18630. var self=this,$self=this;
  18631. return $core.withContext(function($ctx1) {
  18632. return Function.prototype.apply.call(nativeFunc, null, args);
  18633. ;
  18634. return self;
  18635. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  18636. },
  18637. args: ["nativeFunc", "args"],
  18638. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  18639. referencedClasses: [],
  18640. messageSends: []
  18641. }),
  18642. $globals.NativeFunction.a$cls);
  18643. $core.addMethod(
  18644. $core.method({
  18645. selector: "isNativeFunction:",
  18646. protocol: "testing",
  18647. fn: function (anObject){
  18648. var self=this,$self=this;
  18649. return $core.withContext(function($ctx1) {
  18650. return typeof anObject === "function";
  18651. return self;
  18652. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  18653. },
  18654. args: ["anObject"],
  18655. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  18656. referencedClasses: [],
  18657. messageSends: []
  18658. }),
  18659. $globals.NativeFunction.a$cls);
  18660. $core.addMethod(
  18661. $core.method({
  18662. selector: "methodOf:this:",
  18663. protocol: "method calling",
  18664. fn: function (nativeFunc,thisObject){
  18665. var self=this,$self=this;
  18666. return $core.withContext(function($ctx1) {
  18667. return Function.prototype.call.call(nativeFunc, thisObject);
  18668. ;
  18669. return self;
  18670. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  18671. },
  18672. args: ["nativeFunc", "thisObject"],
  18673. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  18674. referencedClasses: [],
  18675. messageSends: []
  18676. }),
  18677. $globals.NativeFunction.a$cls);
  18678. $core.addMethod(
  18679. $core.method({
  18680. selector: "methodOf:this:value:",
  18681. protocol: "method calling",
  18682. fn: function (nativeFunc,thisObject,anObject){
  18683. var self=this,$self=this;
  18684. return $core.withContext(function($ctx1) {
  18685. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  18686. ;
  18687. return self;
  18688. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  18689. },
  18690. args: ["nativeFunc", "thisObject", "anObject"],
  18691. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  18692. referencedClasses: [],
  18693. messageSends: []
  18694. }),
  18695. $globals.NativeFunction.a$cls);
  18696. $core.addMethod(
  18697. $core.method({
  18698. selector: "methodOf:this:value:value:",
  18699. protocol: "method calling",
  18700. fn: function (nativeFunc,thisObject,anObject,anObject2){
  18701. var self=this,$self=this;
  18702. return $core.withContext(function($ctx1) {
  18703. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  18704. ;
  18705. return self;
  18706. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  18707. },
  18708. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  18709. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09'>",
  18710. referencedClasses: [],
  18711. messageSends: []
  18712. }),
  18713. $globals.NativeFunction.a$cls);
  18714. $core.addMethod(
  18715. $core.method({
  18716. selector: "methodOf:this:value:value:value:",
  18717. protocol: "method calling",
  18718. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  18719. var self=this,$self=this;
  18720. return $core.withContext(function($ctx1) {
  18721. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  18722. ;
  18723. return self;
  18724. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  18725. },
  18726. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  18727. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09'>",
  18728. referencedClasses: [],
  18729. messageSends: []
  18730. }),
  18731. $globals.NativeFunction.a$cls);
  18732. $core.addMethod(
  18733. $core.method({
  18734. selector: "methodOf:this:valueWithArgs:",
  18735. protocol: "method calling",
  18736. fn: function (nativeFunc,thisObject,args){
  18737. var self=this,$self=this;
  18738. return $core.withContext(function($ctx1) {
  18739. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  18740. ;
  18741. return self;
  18742. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  18743. },
  18744. args: ["nativeFunc", "thisObject", "args"],
  18745. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  18746. referencedClasses: [],
  18747. messageSends: []
  18748. }),
  18749. $globals.NativeFunction.a$cls);
  18750. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  18751. $globals.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.";
  18752. $core.addMethod(
  18753. $core.method({
  18754. selector: "clearInterval",
  18755. protocol: "timeout/interval",
  18756. fn: function (){
  18757. var self=this,$self=this;
  18758. return $core.withContext(function($ctx1) {
  18759. var interval = $self["@rawTimeout"];
  18760. clearInterval(interval);
  18761. ;
  18762. return self;
  18763. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  18764. },
  18765. args: [],
  18766. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  18767. referencedClasses: [],
  18768. messageSends: []
  18769. }),
  18770. $globals.Timeout);
  18771. $core.addMethod(
  18772. $core.method({
  18773. selector: "clearTimeout",
  18774. protocol: "timeout/interval",
  18775. fn: function (){
  18776. var self=this,$self=this;
  18777. return $core.withContext(function($ctx1) {
  18778. var timeout = $self["@rawTimeout"];
  18779. clearTimeout(timeout);
  18780. ;
  18781. return self;
  18782. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  18783. },
  18784. args: [],
  18785. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  18786. referencedClasses: [],
  18787. messageSends: []
  18788. }),
  18789. $globals.Timeout);
  18790. $core.addMethod(
  18791. $core.method({
  18792. selector: "rawTimeout:",
  18793. protocol: "accessing",
  18794. fn: function (anObject){
  18795. var self=this,$self=this;
  18796. $self["@rawTimeout"]=anObject;
  18797. return self;
  18798. },
  18799. args: ["anObject"],
  18800. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  18801. referencedClasses: [],
  18802. messageSends: []
  18803. }),
  18804. $globals.Timeout);
  18805. $core.addMethod(
  18806. $core.method({
  18807. selector: "on:",
  18808. protocol: "instance creation",
  18809. fn: function (anObject){
  18810. var self=this,$self=this;
  18811. return $core.withContext(function($ctx1) {
  18812. var $1;
  18813. $1=$self._new();
  18814. $recv($1)._rawTimeout_(anObject);
  18815. return $recv($1)._yourself();
  18816. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  18817. },
  18818. args: ["anObject"],
  18819. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  18820. referencedClasses: [],
  18821. messageSends: ["rawTimeout:", "new", "yourself"]
  18822. }),
  18823. $globals.Timeout.a$cls);
  18824. });
  18825. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  18826. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  18827. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  18828. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  18829. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  18830. $core.addPackage("Kernel-Dag");
  18831. $core.packages["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  18832. $core.packages["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  18833. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  18834. $globals.AbstractDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aConcrete classes should implement `visitDagNode:`,\x0athey can reuse possible variants of implementation\x0aoffered directly: `visitDagNodeVariantSimple:`\x0aand `visitDagNodeVariantRedux:`.";
  18835. $core.addMethod(
  18836. $core.method({
  18837. selector: "value:",
  18838. protocol: "evaluating",
  18839. fn: function (anObject){
  18840. var self=this,$self=this;
  18841. return $core.withContext(function($ctx1) {
  18842. return $self._visit_(anObject);
  18843. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  18844. },
  18845. args: ["anObject"],
  18846. source: "value: anObject\x0a\x09^ self visit: anObject",
  18847. referencedClasses: [],
  18848. messageSends: ["visit:"]
  18849. }),
  18850. $globals.AbstractDagVisitor);
  18851. $core.addMethod(
  18852. $core.method({
  18853. selector: "visit:",
  18854. protocol: "visiting",
  18855. fn: function (aNode){
  18856. var self=this,$self=this;
  18857. return $core.withContext(function($ctx1) {
  18858. return $recv(aNode)._acceptDagVisitor_(self);
  18859. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  18860. },
  18861. args: ["aNode"],
  18862. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  18863. referencedClasses: [],
  18864. messageSends: ["acceptDagVisitor:"]
  18865. }),
  18866. $globals.AbstractDagVisitor);
  18867. $core.addMethod(
  18868. $core.method({
  18869. selector: "visitAll:",
  18870. protocol: "visiting",
  18871. fn: function (aCollection){
  18872. var self=this,$self=this;
  18873. return $core.withContext(function($ctx1) {
  18874. return $recv(aCollection)._collect_((function(each){
  18875. return $core.withContext(function($ctx2) {
  18876. return $self._visit_(each);
  18877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18878. }));
  18879. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  18880. },
  18881. args: ["aCollection"],
  18882. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  18883. referencedClasses: [],
  18884. messageSends: ["collect:", "visit:"]
  18885. }),
  18886. $globals.AbstractDagVisitor);
  18887. $core.addMethod(
  18888. $core.method({
  18889. selector: "visitAllChildren:",
  18890. protocol: "visiting",
  18891. fn: function (aDagNode){
  18892. var self=this,$self=this;
  18893. return $core.withContext(function($ctx1) {
  18894. return $self._visitAll_($recv(aDagNode)._dagChildren());
  18895. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  18896. },
  18897. args: ["aDagNode"],
  18898. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  18899. referencedClasses: [],
  18900. messageSends: ["visitAll:", "dagChildren"]
  18901. }),
  18902. $globals.AbstractDagVisitor);
  18903. $core.addMethod(
  18904. $core.method({
  18905. selector: "visitDagNode:",
  18906. protocol: "visiting",
  18907. fn: function (aNode){
  18908. var self=this,$self=this;
  18909. return $core.withContext(function($ctx1) {
  18910. $self._subclassResponsibility();
  18911. return self;
  18912. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  18913. },
  18914. args: ["aNode"],
  18915. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  18916. referencedClasses: [],
  18917. messageSends: ["subclassResponsibility"]
  18918. }),
  18919. $globals.AbstractDagVisitor);
  18920. $core.addMethod(
  18921. $core.method({
  18922. selector: "visitDagNodeVariantRedux:",
  18923. protocol: "visiting",
  18924. fn: function (aNode){
  18925. var self=this,$self=this;
  18926. var newChildren,oldChildren;
  18927. return $core.withContext(function($ctx1) {
  18928. var $2,$3,$1,$4,$5;
  18929. var $early={};
  18930. try {
  18931. oldChildren=$recv(aNode)._dagChildren();
  18932. newChildren=$self._visitAllChildren_(aNode);
  18933. $2=$recv(oldChildren)._size();
  18934. $ctx1.sendIdx["size"]=1;
  18935. $3=$recv(newChildren)._size();
  18936. $ctx1.sendIdx["size"]=2;
  18937. $1=$recv($2).__eq($3);
  18938. if($core.assert($1)){
  18939. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  18940. return $core.withContext(function($ctx2) {
  18941. $4=$recv(oldChildren)._at_(i);
  18942. $ctx2.sendIdx["at:"]=1;
  18943. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  18944. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  18945. }),(function(){
  18946. throw $early=[aNode];
  18947. }));
  18948. }
  18949. $5=$recv(aNode)._copy();
  18950. $recv($5)._dagChildren_(newChildren);
  18951. return $recv($5)._yourself();
  18952. }
  18953. catch(e) {if(e===$early)return e[0]; throw e}
  18954. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  18955. },
  18956. args: ["aNode"],
  18957. source: "visitDagNodeVariantRedux: aNode\x0a\x09\x22Immutable-guarded implementation of visitDagNode:.\x0a\x09Visits all children and checks if there were changes.\x0a\x09If not, returns aNode.\x0a\x09If yes, returns copy of aNode with new children.\x22\x0a\x0a\x09| newChildren oldChildren |\x0a\x09oldChildren := aNode dagChildren.\x0a\x09newChildren := self visitAllChildren: aNode.\x0a\x09oldChildren size = newChildren size ifTrue: [\x0a\x09\x09(1 to: oldChildren size) detect: [ :i |\x0a\x09\x09\x09(oldChildren at: i) ~= (newChildren at: i)\x0a\x09\x09] ifNone: [ \x22no change\x22 ^ aNode ] ].\x0a\x09^ aNode copy dagChildren: newChildren; yourself",
  18958. referencedClasses: [],
  18959. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  18960. }),
  18961. $globals.AbstractDagVisitor);
  18962. $core.addMethod(
  18963. $core.method({
  18964. selector: "visitDagNodeVariantSimple:",
  18965. protocol: "visiting",
  18966. fn: function (aNode){
  18967. var self=this,$self=this;
  18968. return $core.withContext(function($ctx1) {
  18969. $self._visitAllChildren_(aNode);
  18970. return aNode;
  18971. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  18972. },
  18973. args: ["aNode"],
  18974. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  18975. referencedClasses: [],
  18976. messageSends: ["visitAllChildren:"]
  18977. }),
  18978. $globals.AbstractDagVisitor);
  18979. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  18980. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  18981. $core.addMethod(
  18982. $core.method({
  18983. selector: "initialize",
  18984. protocol: "initialization",
  18985. fn: function (){
  18986. var self=this,$self=this;
  18987. return $core.withContext(function($ctx1) {
  18988. (
  18989. $ctx1.supercall = true,
  18990. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18991. $ctx1.supercall = false;
  18992. $self["@path"]=[];
  18993. return self;
  18994. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  18995. },
  18996. args: [],
  18997. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  18998. referencedClasses: [],
  18999. messageSends: ["initialize"]
  19000. }),
  19001. $globals.PathDagVisitor);
  19002. $core.addMethod(
  19003. $core.method({
  19004. selector: "path",
  19005. protocol: "accessing",
  19006. fn: function (){
  19007. var self=this,$self=this;
  19008. return $self["@path"];
  19009. },
  19010. args: [],
  19011. source: "path\x0a\x09^ path",
  19012. referencedClasses: [],
  19013. messageSends: []
  19014. }),
  19015. $globals.PathDagVisitor);
  19016. $core.addMethod(
  19017. $core.method({
  19018. selector: "visit:",
  19019. protocol: "visiting",
  19020. fn: function (aNode){
  19021. var self=this,$self=this;
  19022. var oldPath,result;
  19023. return $core.withContext(function($ctx1) {
  19024. result=aNode;
  19025. oldPath=$self["@path"];
  19026. $recv((function(){
  19027. return $core.withContext(function($ctx2) {
  19028. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  19029. $self["@path"];
  19030. result=(
  19031. $ctx2.supercall = true,
  19032. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  19033. $ctx2.supercall = false;
  19034. return result;
  19035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19036. }))._ensure_((function(){
  19037. $self["@path"]=oldPath;
  19038. return $self["@path"];
  19039. }));
  19040. return result;
  19041. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  19042. },
  19043. args: ["aNode"],
  19044. source: "visit: aNode\x0a\x09| oldPath result |\x0a\x09result := aNode.\x0a\x09oldPath := path.\x0a\x09[\x0a\x09\x09path := path, {aNode}.\x0a\x09\x09result := super visit: aNode\x0a\x09] ensure: [ path := oldPath ].\x0a\x09^ result",
  19045. referencedClasses: [],
  19046. messageSends: ["ensure:", ",", "visit:"]
  19047. }),
  19048. $globals.PathDagVisitor);
  19049. $core.addMethod(
  19050. $core.method({
  19051. selector: "visitDagNodeVariantRedux:",
  19052. protocol: "visiting",
  19053. fn: function (aNode){
  19054. var self=this,$self=this;
  19055. var newNode;
  19056. return $core.withContext(function($ctx1) {
  19057. var $1;
  19058. newNode=(
  19059. $ctx1.supercall = true,
  19060. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  19061. $ctx1.supercall = false;
  19062. $1=$recv(aNode).__eq_eq(newNode);
  19063. if(!$core.assert($1)){
  19064. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  19065. }
  19066. return newNode;
  19067. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  19068. },
  19069. args: ["aNode"],
  19070. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  19071. referencedClasses: [],
  19072. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  19073. }),
  19074. $globals.PathDagVisitor);
  19075. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  19076. $globals.DagNode.comment="I am the abstract root class of any directed acyclic graph.\x0a\x0aConcrete classes should implement `dagChildren` and `dagChildren:`\x0ato get / set direct successor nodes (aka child nodes / subnodes).";
  19077. $core.addMethod(
  19078. $core.method({
  19079. selector: "acceptDagVisitor:",
  19080. protocol: "visiting",
  19081. fn: function (aVisitor){
  19082. var self=this,$self=this;
  19083. return $core.withContext(function($ctx1) {
  19084. return $recv(aVisitor)._visitDagNode_(self);
  19085. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  19086. },
  19087. args: ["aVisitor"],
  19088. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  19089. referencedClasses: [],
  19090. messageSends: ["visitDagNode:"]
  19091. }),
  19092. $globals.DagNode);
  19093. $core.addMethod(
  19094. $core.method({
  19095. selector: "allDagChildren",
  19096. protocol: "accessing",
  19097. fn: function (){
  19098. var self=this,$self=this;
  19099. var allNodes;
  19100. return $core.withContext(function($ctx1) {
  19101. var $1;
  19102. $1=$self._dagChildren();
  19103. $ctx1.sendIdx["dagChildren"]=1;
  19104. allNodes=$recv($1)._asSet();
  19105. $recv($self._dagChildren())._do_((function(each){
  19106. return $core.withContext(function($ctx2) {
  19107. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  19108. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19109. }));
  19110. return allNodes;
  19111. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  19112. },
  19113. args: [],
  19114. source: "allDagChildren\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self dagChildren asSet.\x0a\x09self dagChildren do: [ :each | \x0a\x09\x09allNodes addAll: each allDagChildren ].\x0a\x09\x0a\x09^ allNodes",
  19115. referencedClasses: [],
  19116. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  19117. }),
  19118. $globals.DagNode);
  19119. $core.addMethod(
  19120. $core.method({
  19121. selector: "dagChildren",
  19122. protocol: "accessing",
  19123. fn: function (){
  19124. var self=this,$self=this;
  19125. return $core.withContext(function($ctx1) {
  19126. $self._subclassResponsibility();
  19127. return self;
  19128. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  19129. },
  19130. args: [],
  19131. source: "dagChildren\x0a\x09self subclassResponsibility",
  19132. referencedClasses: [],
  19133. messageSends: ["subclassResponsibility"]
  19134. }),
  19135. $globals.DagNode);
  19136. $core.addMethod(
  19137. $core.method({
  19138. selector: "dagChildren:",
  19139. protocol: "accessing",
  19140. fn: function (aCollection){
  19141. var self=this,$self=this;
  19142. return $core.withContext(function($ctx1) {
  19143. $self._subclassResponsibility();
  19144. return self;
  19145. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  19146. },
  19147. args: ["aCollection"],
  19148. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  19149. referencedClasses: [],
  19150. messageSends: ["subclassResponsibility"]
  19151. }),
  19152. $globals.DagNode);
  19153. $core.addMethod(
  19154. $core.method({
  19155. selector: "isDagNode",
  19156. protocol: "testing",
  19157. fn: function (){
  19158. var self=this,$self=this;
  19159. return true;
  19160. },
  19161. args: [],
  19162. source: "isDagNode\x0a\x09^ true",
  19163. referencedClasses: [],
  19164. messageSends: []
  19165. }),
  19166. $globals.DagNode);
  19167. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  19168. $globals.DagParentNode.comment="I am `DagNode` that stores a collection of its children,\x0alazy initialized to empty array.\x0a\x0aI can `addDagChild:` to add a child.";
  19169. $core.addMethod(
  19170. $core.method({
  19171. selector: "addDagChild:",
  19172. protocol: "accessing",
  19173. fn: function (aDagNode){
  19174. var self=this,$self=this;
  19175. return $core.withContext(function($ctx1) {
  19176. $recv($self._dagChildren())._add_(aDagNode);
  19177. return self;
  19178. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  19179. },
  19180. args: ["aDagNode"],
  19181. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  19182. referencedClasses: [],
  19183. messageSends: ["add:", "dagChildren"]
  19184. }),
  19185. $globals.DagParentNode);
  19186. $core.addMethod(
  19187. $core.method({
  19188. selector: "dagChildren",
  19189. protocol: "accessing",
  19190. fn: function (){
  19191. var self=this,$self=this;
  19192. return $core.withContext(function($ctx1) {
  19193. var $1,$receiver;
  19194. $1=$self["@nodes"];
  19195. if(($receiver = $1) == null || $receiver.a$nil){
  19196. $self["@nodes"]=$recv($globals.Array)._new();
  19197. return $self["@nodes"];
  19198. } else {
  19199. return $1;
  19200. }
  19201. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  19202. },
  19203. args: [],
  19204. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  19205. referencedClasses: ["Array"],
  19206. messageSends: ["ifNil:", "new"]
  19207. }),
  19208. $globals.DagParentNode);
  19209. $core.addMethod(
  19210. $core.method({
  19211. selector: "dagChildren:",
  19212. protocol: "accessing",
  19213. fn: function (aCollection){
  19214. var self=this,$self=this;
  19215. $self["@nodes"]=aCollection;
  19216. return self;
  19217. },
  19218. args: ["aCollection"],
  19219. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  19220. referencedClasses: [],
  19221. messageSends: []
  19222. }),
  19223. $globals.DagParentNode);
  19224. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  19225. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  19226. $core.addMethod(
  19227. $core.method({
  19228. selector: "dagChildren",
  19229. protocol: "accessing",
  19230. fn: function (){
  19231. var self=this,$self=this;
  19232. return [];
  19233. },
  19234. args: [],
  19235. source: "dagChildren\x0a\x09^ #()",
  19236. referencedClasses: [],
  19237. messageSends: []
  19238. }),
  19239. $globals.DagSink);
  19240. $core.addMethod(
  19241. $core.method({
  19242. selector: "dagChildren:",
  19243. protocol: "accessing",
  19244. fn: function (aCollection){
  19245. var self=this,$self=this;
  19246. return $core.withContext(function($ctx1) {
  19247. $recv(aCollection)._ifNotEmpty_((function(){
  19248. return $core.withContext(function($ctx2) {
  19249. return $self._error_("A DagSink cannot have children.");
  19250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19251. }));
  19252. return self;
  19253. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  19254. },
  19255. args: ["aCollection"],
  19256. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  19257. referencedClasses: [],
  19258. messageSends: ["ifNotEmpty:", "error:"]
  19259. }),
  19260. $globals.DagSink);
  19261. $core.addMethod(
  19262. $core.method({
  19263. selector: "isDagNode",
  19264. protocol: "*Kernel-Dag",
  19265. fn: function (){
  19266. var self=this,$self=this;
  19267. return false;
  19268. },
  19269. args: [],
  19270. source: "isDagNode\x0a\x09^ false",
  19271. referencedClasses: [],
  19272. messageSends: []
  19273. }),
  19274. $globals.Object);
  19275. });
  19276. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19277. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  19278. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  19279. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19280. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  19281. $core.addPackage("Kernel-Exceptions");
  19282. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  19283. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19284. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  19285. $globals.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.";
  19286. $core.addMethod(
  19287. $core.method({
  19288. selector: "beHandled",
  19289. protocol: "accessing",
  19290. fn: function (){
  19291. var self=this,$self=this;
  19292. return $core.withContext(function($ctx1) {
  19293. self.amberHandled = true;
  19294. return self;
  19295. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  19296. },
  19297. args: [],
  19298. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  19299. referencedClasses: [],
  19300. messageSends: []
  19301. }),
  19302. $globals.Error);
  19303. $core.addMethod(
  19304. $core.method({
  19305. selector: "beUnhandled",
  19306. protocol: "accessing",
  19307. fn: function (){
  19308. var self=this,$self=this;
  19309. return $core.withContext(function($ctx1) {
  19310. self.amberHandled = false;
  19311. return self;
  19312. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  19313. },
  19314. args: [],
  19315. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  19316. referencedClasses: [],
  19317. messageSends: []
  19318. }),
  19319. $globals.Error);
  19320. $core.addMethod(
  19321. $core.method({
  19322. selector: "context",
  19323. protocol: "accessing",
  19324. fn: function (){
  19325. var self=this,$self=this;
  19326. return $core.withContext(function($ctx1) {
  19327. return self.context;
  19328. return self;
  19329. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  19330. },
  19331. args: [],
  19332. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  19333. referencedClasses: [],
  19334. messageSends: []
  19335. }),
  19336. $globals.Error);
  19337. $core.addMethod(
  19338. $core.method({
  19339. selector: "initialize",
  19340. protocol: "initialization",
  19341. fn: function (){
  19342. var self=this,$self=this;
  19343. return $core.withContext(function($ctx1) {
  19344. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  19345. return self;
  19346. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  19347. },
  19348. args: [],
  19349. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  19350. referencedClasses: [],
  19351. messageSends: ["messageText:", ",", "name", "class"]
  19352. }),
  19353. $globals.Error);
  19354. $core.addMethod(
  19355. $core.method({
  19356. selector: "isSmalltalkError",
  19357. protocol: "testing",
  19358. fn: function (){
  19359. var self=this,$self=this;
  19360. return $core.withContext(function($ctx1) {
  19361. return self.smalltalkError === true;
  19362. return self;
  19363. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  19364. },
  19365. args: [],
  19366. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  19367. referencedClasses: [],
  19368. messageSends: []
  19369. }),
  19370. $globals.Error);
  19371. $core.addMethod(
  19372. $core.method({
  19373. selector: "jsStack",
  19374. protocol: "accessing",
  19375. fn: function (){
  19376. var self=this,$self=this;
  19377. return $core.withContext(function($ctx1) {
  19378. return self.stack;
  19379. return self;
  19380. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  19381. },
  19382. args: [],
  19383. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  19384. referencedClasses: [],
  19385. messageSends: []
  19386. }),
  19387. $globals.Error);
  19388. $core.addMethod(
  19389. $core.method({
  19390. selector: "messageText",
  19391. protocol: "accessing",
  19392. fn: function (){
  19393. var self=this,$self=this;
  19394. return $self["@messageText"];
  19395. },
  19396. args: [],
  19397. source: "messageText\x0a\x09^ messageText",
  19398. referencedClasses: [],
  19399. messageSends: []
  19400. }),
  19401. $globals.Error);
  19402. $core.addMethod(
  19403. $core.method({
  19404. selector: "messageText:",
  19405. protocol: "accessing",
  19406. fn: function (aString){
  19407. var self=this,$self=this;
  19408. $self["@messageText"]=aString;
  19409. return self;
  19410. },
  19411. args: ["aString"],
  19412. source: "messageText: aString\x0a\x09messageText := aString",
  19413. referencedClasses: [],
  19414. messageSends: []
  19415. }),
  19416. $globals.Error);
  19417. $core.addMethod(
  19418. $core.method({
  19419. selector: "resignal",
  19420. protocol: "signaling",
  19421. fn: function (){
  19422. var self=this,$self=this;
  19423. return $core.withContext(function($ctx1) {
  19424. self.amberHandled = false;
  19425. throw(self);
  19426. ;
  19427. return self;
  19428. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  19429. },
  19430. args: [],
  19431. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09'>",
  19432. referencedClasses: [],
  19433. messageSends: []
  19434. }),
  19435. $globals.Error);
  19436. $core.addMethod(
  19437. $core.method({
  19438. selector: "signal",
  19439. protocol: "signaling",
  19440. fn: function (){
  19441. var self=this,$self=this;
  19442. return $core.withContext(function($ctx1) {
  19443. self.amberHandled = false;
  19444. self.context = $core.getThisContext();
  19445. self.smalltalkError = true;
  19446. throw self;
  19447. ;
  19448. return self;
  19449. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  19450. },
  19451. args: [],
  19452. source: "signal\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09'>",
  19453. referencedClasses: [],
  19454. messageSends: []
  19455. }),
  19456. $globals.Error);
  19457. $core.addMethod(
  19458. $core.method({
  19459. selector: "signal:",
  19460. protocol: "signaling",
  19461. fn: function (aString){
  19462. var self=this,$self=this;
  19463. return $core.withContext(function($ctx1) {
  19464. $self._messageText_(aString);
  19465. $self._signal();
  19466. return self;
  19467. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  19468. },
  19469. args: ["aString"],
  19470. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  19471. referencedClasses: [],
  19472. messageSends: ["messageText:", "signal"]
  19473. }),
  19474. $globals.Error);
  19475. $core.addMethod(
  19476. $core.method({
  19477. selector: "signalerContext",
  19478. protocol: "accessing",
  19479. fn: function (){
  19480. var self=this,$self=this;
  19481. return $core.withContext(function($ctx1) {
  19482. return $self._signalerContextFrom_($self._context());
  19483. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  19484. },
  19485. args: [],
  19486. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  19487. referencedClasses: [],
  19488. messageSends: ["signalerContextFrom:", "context"]
  19489. }),
  19490. $globals.Error);
  19491. $core.addMethod(
  19492. $core.method({
  19493. selector: "signalerContextFrom:",
  19494. protocol: "accessing",
  19495. fn: function (aContext){
  19496. var self=this,$self=this;
  19497. return $core.withContext(function($ctx1) {
  19498. var $3,$2,$1;
  19499. return $recv(aContext)._findContextSuchThat_((function(context){
  19500. return $core.withContext(function($ctx2) {
  19501. $3=$recv(context)._receiver();
  19502. $ctx2.sendIdx["receiver"]=1;
  19503. $2=$recv($3).__eq_eq(self);
  19504. $ctx2.sendIdx["=="]=1;
  19505. $1=$recv($2)._or_((function(){
  19506. return $core.withContext(function($ctx3) {
  19507. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  19508. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19509. }));
  19510. return $recv($1)._not();
  19511. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  19512. }));
  19513. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  19514. },
  19515. args: ["aContext"],
  19516. source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
  19517. referencedClasses: [],
  19518. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  19519. }),
  19520. $globals.Error);
  19521. $core.addMethod(
  19522. $core.method({
  19523. selector: "wasHandled",
  19524. protocol: "testing",
  19525. fn: function (){
  19526. var self=this,$self=this;
  19527. return $core.withContext(function($ctx1) {
  19528. return self.amberHandled || false;
  19529. return self;
  19530. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  19531. },
  19532. args: [],
  19533. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  19534. referencedClasses: [],
  19535. messageSends: []
  19536. }),
  19537. $globals.Error);
  19538. $core.addMethod(
  19539. $core.method({
  19540. selector: "classTag",
  19541. protocol: "accessing",
  19542. fn: function (){
  19543. var self=this,$self=this;
  19544. return "exception";
  19545. },
  19546. args: [],
  19547. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'exception'",
  19548. referencedClasses: [],
  19549. messageSends: []
  19550. }),
  19551. $globals.Error.a$cls);
  19552. $core.addMethod(
  19553. $core.method({
  19554. selector: "signal",
  19555. protocol: "instance creation",
  19556. fn: function (){
  19557. var self=this,$self=this;
  19558. return $core.withContext(function($ctx1) {
  19559. return $recv($self._new())._signal();
  19560. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  19561. },
  19562. args: [],
  19563. source: "signal\x0a\x09^ self new signal",
  19564. referencedClasses: [],
  19565. messageSends: ["signal", "new"]
  19566. }),
  19567. $globals.Error.a$cls);
  19568. $core.addMethod(
  19569. $core.method({
  19570. selector: "signal:",
  19571. protocol: "instance creation",
  19572. fn: function (aString){
  19573. var self=this,$self=this;
  19574. return $core.withContext(function($ctx1) {
  19575. return $recv($self._new())._signal_(aString);
  19576. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  19577. },
  19578. args: ["aString"],
  19579. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  19580. referencedClasses: [],
  19581. messageSends: ["signal:", "new"]
  19582. }),
  19583. $globals.Error.a$cls);
  19584. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  19585. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  19586. $core.addMethod(
  19587. $core.method({
  19588. selector: "messageText",
  19589. protocol: "accessing",
  19590. fn: function (){
  19591. var self=this,$self=this;
  19592. return "Halt encountered";
  19593. },
  19594. args: [],
  19595. source: "messageText\x0a\x09^ 'Halt encountered'",
  19596. referencedClasses: [],
  19597. messageSends: []
  19598. }),
  19599. $globals.Halt);
  19600. $core.addMethod(
  19601. $core.method({
  19602. selector: "signalerContextFrom:",
  19603. protocol: "accessing",
  19604. fn: function (aContext){
  19605. var self=this,$self=this;
  19606. return $core.withContext(function($ctx1) {
  19607. var $3,$2,$1;
  19608. return $recv(aContext)._findContextSuchThat_((function(context){
  19609. return $core.withContext(function($ctx2) {
  19610. $3=$recv(context)._receiver();
  19611. $ctx2.sendIdx["receiver"]=1;
  19612. $2=$recv($3).__eq_eq(self);
  19613. $ctx2.sendIdx["=="]=1;
  19614. $1=$recv($2)._or_((function(){
  19615. return $core.withContext(function($ctx3) {
  19616. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  19617. return $core.withContext(function($ctx4) {
  19618. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  19619. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  19620. }));
  19621. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19622. }));
  19623. $ctx2.sendIdx["or:"]=1;
  19624. return $recv($1)._not();
  19625. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  19626. }));
  19627. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  19628. },
  19629. args: ["aContext"],
  19630. source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
  19631. referencedClasses: [],
  19632. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  19633. }),
  19634. $globals.Halt);
  19635. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  19636. $globals.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:`";
  19637. $core.addMethod(
  19638. $core.method({
  19639. selector: "context:",
  19640. protocol: "accessing",
  19641. fn: function (aMethodContext){
  19642. var self=this,$self=this;
  19643. return $core.withContext(function($ctx1) {
  19644. self.context = aMethodContext;
  19645. return self;
  19646. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  19647. },
  19648. args: ["aMethodContext"],
  19649. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<inlineJS: 'self.context = aMethodContext'>",
  19650. referencedClasses: [],
  19651. messageSends: []
  19652. }),
  19653. $globals.JavaScriptException);
  19654. $core.addMethod(
  19655. $core.method({
  19656. selector: "exception",
  19657. protocol: "accessing",
  19658. fn: function (){
  19659. var self=this,$self=this;
  19660. return $self["@exception"];
  19661. },
  19662. args: [],
  19663. source: "exception\x0a\x09^ exception",
  19664. referencedClasses: [],
  19665. messageSends: []
  19666. }),
  19667. $globals.JavaScriptException);
  19668. $core.addMethod(
  19669. $core.method({
  19670. selector: "exception:",
  19671. protocol: "accessing",
  19672. fn: function (anException){
  19673. var self=this,$self=this;
  19674. $self["@exception"]=anException;
  19675. return self;
  19676. },
  19677. args: ["anException"],
  19678. source: "exception: anException\x0a\x09exception := anException",
  19679. referencedClasses: [],
  19680. messageSends: []
  19681. }),
  19682. $globals.JavaScriptException);
  19683. $core.addMethod(
  19684. $core.method({
  19685. selector: "messageText",
  19686. protocol: "accessing",
  19687. fn: function (){
  19688. var self=this,$self=this;
  19689. return $core.withContext(function($ctx1) {
  19690. return "JavaScript exception: " + $self["@exception"].toString();
  19691. return self;
  19692. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  19693. },
  19694. args: [],
  19695. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  19696. referencedClasses: [],
  19697. messageSends: []
  19698. }),
  19699. $globals.JavaScriptException);
  19700. $core.addMethod(
  19701. $core.method({
  19702. selector: "on:",
  19703. protocol: "instance creation",
  19704. fn: function (anException){
  19705. var self=this,$self=this;
  19706. return $core.withContext(function($ctx1) {
  19707. var $1;
  19708. $1=$self._new();
  19709. $recv($1)._exception_(anException);
  19710. return $recv($1)._yourself();
  19711. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  19712. },
  19713. args: ["anException"],
  19714. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  19715. referencedClasses: [],
  19716. messageSends: ["exception:", "new", "yourself"]
  19717. }),
  19718. $globals.JavaScriptException.a$cls);
  19719. $core.addMethod(
  19720. $core.method({
  19721. selector: "on:context:",
  19722. protocol: "instance creation",
  19723. fn: function (anException,aMethodContext){
  19724. var self=this,$self=this;
  19725. return $core.withContext(function($ctx1) {
  19726. var $1;
  19727. $1=$self._new();
  19728. $recv($1)._exception_(anException);
  19729. $recv($1)._context_(aMethodContext);
  19730. return $recv($1)._yourself();
  19731. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  19732. },
  19733. args: ["anException", "aMethodContext"],
  19734. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  19735. referencedClasses: [],
  19736. messageSends: ["exception:", "new", "context:", "yourself"]
  19737. }),
  19738. $globals.JavaScriptException.a$cls);
  19739. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  19740. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  19741. $core.addMethod(
  19742. $core.method({
  19743. selector: "message",
  19744. protocol: "accessing",
  19745. fn: function (){
  19746. var self=this,$self=this;
  19747. return $self["@message"];
  19748. },
  19749. args: [],
  19750. source: "message\x0a\x09^ message",
  19751. referencedClasses: [],
  19752. messageSends: []
  19753. }),
  19754. $globals.MessageNotUnderstood);
  19755. $core.addMethod(
  19756. $core.method({
  19757. selector: "message:",
  19758. protocol: "accessing",
  19759. fn: function (aMessage){
  19760. var self=this,$self=this;
  19761. $self["@message"]=aMessage;
  19762. return self;
  19763. },
  19764. args: ["aMessage"],
  19765. source: "message: aMessage\x0a\x09message := aMessage",
  19766. referencedClasses: [],
  19767. messageSends: []
  19768. }),
  19769. $globals.MessageNotUnderstood);
  19770. $core.addMethod(
  19771. $core.method({
  19772. selector: "messageText",
  19773. protocol: "accessing",
  19774. fn: function (){
  19775. var self=this,$self=this;
  19776. return $core.withContext(function($ctx1) {
  19777. var $1;
  19778. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  19779. $ctx1.sendIdx[","]=1;
  19780. return $1;
  19781. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  19782. },
  19783. args: [],
  19784. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  19785. referencedClasses: [],
  19786. messageSends: [",", "asString", "receiver", "selector", "message"]
  19787. }),
  19788. $globals.MessageNotUnderstood);
  19789. $core.addMethod(
  19790. $core.method({
  19791. selector: "receiver",
  19792. protocol: "accessing",
  19793. fn: function (){
  19794. var self=this,$self=this;
  19795. return $self["@receiver"];
  19796. },
  19797. args: [],
  19798. source: "receiver\x0a\x09^ receiver",
  19799. referencedClasses: [],
  19800. messageSends: []
  19801. }),
  19802. $globals.MessageNotUnderstood);
  19803. $core.addMethod(
  19804. $core.method({
  19805. selector: "receiver:",
  19806. protocol: "accessing",
  19807. fn: function (anObject){
  19808. var self=this,$self=this;
  19809. $self["@receiver"]=anObject;
  19810. return self;
  19811. },
  19812. args: ["anObject"],
  19813. source: "receiver: anObject\x0a\x09receiver := anObject",
  19814. referencedClasses: [],
  19815. messageSends: []
  19816. }),
  19817. $globals.MessageNotUnderstood);
  19818. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  19819. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  19820. $core.addMethod(
  19821. $core.method({
  19822. selector: "object",
  19823. protocol: "accessing",
  19824. fn: function (){
  19825. var self=this,$self=this;
  19826. return $self["@object"];
  19827. },
  19828. args: [],
  19829. source: "object\x0a\x09^ object",
  19830. referencedClasses: [],
  19831. messageSends: []
  19832. }),
  19833. $globals.NonBooleanReceiver);
  19834. $core.addMethod(
  19835. $core.method({
  19836. selector: "object:",
  19837. protocol: "accessing",
  19838. fn: function (anObject){
  19839. var self=this,$self=this;
  19840. $self["@object"]=anObject;
  19841. return self;
  19842. },
  19843. args: ["anObject"],
  19844. source: "object: anObject\x0a\x09object := anObject",
  19845. referencedClasses: [],
  19846. messageSends: []
  19847. }),
  19848. $globals.NonBooleanReceiver);
  19849. });
  19850. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19851. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  19852. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  19853. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19854. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  19855. $core.addPackage("Kernel-Promises");
  19856. $core.packages["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  19857. $core.packages["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19858. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  19859. $core.addMethod(
  19860. $core.method({
  19861. selector: "all:",
  19862. protocol: "composites",
  19863. fn: function (aCollection){
  19864. var self=this,$self=this;
  19865. return $core.withContext(function($ctx1) {
  19866. return Promise.all($recv(aCollection)._asArray());
  19867. return self;
  19868. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  19869. },
  19870. args: ["aCollection"],
  19871. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  19872. referencedClasses: [],
  19873. messageSends: []
  19874. }),
  19875. $globals.Promise.a$cls);
  19876. $core.addMethod(
  19877. $core.method({
  19878. selector: "any:",
  19879. protocol: "composites",
  19880. fn: function (aCollection){
  19881. var self=this,$self=this;
  19882. return $core.withContext(function($ctx1) {
  19883. return Promise.race($recv(aCollection)._asArray());
  19884. return self;
  19885. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  19886. },
  19887. args: ["aCollection"],
  19888. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  19889. referencedClasses: [],
  19890. messageSends: []
  19891. }),
  19892. $globals.Promise.a$cls);
  19893. $core.addMethod(
  19894. $core.method({
  19895. selector: "forBlock:",
  19896. protocol: "instance creation",
  19897. fn: function (aBlock){
  19898. var self=this,$self=this;
  19899. return $core.withContext(function($ctx1) {
  19900. return $recv($self._new())._then_(aBlock);
  19901. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  19902. },
  19903. args: ["aBlock"],
  19904. source: "forBlock: aBlock\x0a\x22Returns a Promise that is resolved with the value of aBlock,\x0aand rejected if error happens while evaluating aBlock.\x22\x0a\x09^ self new then: aBlock",
  19905. referencedClasses: [],
  19906. messageSends: ["then:", "new"]
  19907. }),
  19908. $globals.Promise.a$cls);
  19909. $core.addMethod(
  19910. $core.method({
  19911. selector: "new",
  19912. protocol: "instance creation",
  19913. fn: function (){
  19914. var self=this,$self=this;
  19915. return $core.withContext(function($ctx1) {
  19916. return Promise.resolve();
  19917. return self;
  19918. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  19919. },
  19920. args: [],
  19921. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  19922. referencedClasses: [],
  19923. messageSends: []
  19924. }),
  19925. $globals.Promise.a$cls);
  19926. $core.addMethod(
  19927. $core.method({
  19928. selector: "new:",
  19929. protocol: "instance creation",
  19930. fn: function (aBlock){
  19931. var self=this,$self=this;
  19932. return $core.withContext(function($ctx1) {
  19933. return new Promise(function (resolve, reject) {
  19934. var model = {value: resolve, signal: reject}; // TODO make faster
  19935. aBlock._value_(model);
  19936. });
  19937. return self;
  19938. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  19939. },
  19940. args: ["aBlock"],
  19941. source: "new: aBlock\x0a\x22Returns a Promise that is eventually resolved or rejected.\x0aPass a block that is called with one argument, model.\x0aYou should call model value: ... to resolve the promise\x0aand model signal: ... to reject the promise.\x0aIf error happens during run of the block,\x0apromise is rejected with that error as well.\x22\x0a<inlineJS: 'return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject}; // TODO make faster\x0a aBlock._value_(model);\x0a})'>",
  19942. referencedClasses: [],
  19943. messageSends: []
  19944. }),
  19945. $globals.Promise.a$cls);
  19946. $core.addMethod(
  19947. $core.method({
  19948. selector: "signal:",
  19949. protocol: "instance creation",
  19950. fn: function (anObject){
  19951. var self=this,$self=this;
  19952. return $core.withContext(function($ctx1) {
  19953. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  19954. return self;
  19955. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  19956. },
  19957. args: ["anObject"],
  19958. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  19959. referencedClasses: [],
  19960. messageSends: []
  19961. }),
  19962. $globals.Promise.a$cls);
  19963. $core.addMethod(
  19964. $core.method({
  19965. selector: "value:",
  19966. protocol: "instance creation",
  19967. fn: function (anObject){
  19968. var self=this,$self=this;
  19969. return $core.withContext(function($ctx1) {
  19970. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  19971. return self;
  19972. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  19973. },
  19974. args: ["anObject"],
  19975. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  19976. referencedClasses: [],
  19977. messageSends: []
  19978. }),
  19979. $globals.Promise.a$cls);
  19980. $core.addTrait("TThenable", "Kernel-Promises");
  19981. $core.addMethod(
  19982. $core.method({
  19983. selector: "catch:",
  19984. protocol: "promises",
  19985. fn: function (aBlock){
  19986. var self=this,$self=this;
  19987. return $core.withContext(function($ctx1) {
  19988. return self.then(null, function (err) {return $core.seamless(function () {
  19989. return aBlock._value_(err);
  19990. })});
  19991. return self;
  19992. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  19993. },
  19994. args: ["aBlock"],
  19995. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  19996. referencedClasses: [],
  19997. messageSends: []
  19998. }),
  19999. $globals.TThenable);
  20000. $core.addMethod(
  20001. $core.method({
  20002. selector: "on:do:",
  20003. protocol: "promises",
  20004. fn: function (aClass,aBlock){
  20005. var self=this,$self=this;
  20006. return $core.withContext(function($ctx1) {
  20007. return self.then(null, function (err) {return $core.seamless(function () {
  20008. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  20009. else throw err;
  20010. })});
  20011. return self;
  20012. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  20013. },
  20014. args: ["aClass", "aBlock"],
  20015. source: "on: aClass do: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})'>",
  20016. referencedClasses: [],
  20017. messageSends: []
  20018. }),
  20019. $globals.TThenable);
  20020. $core.addMethod(
  20021. $core.method({
  20022. selector: "on:do:catch:",
  20023. protocol: "promises",
  20024. fn: function (aClass,aBlock,anotherBlock){
  20025. var self=this,$self=this;
  20026. return $core.withContext(function($ctx1) {
  20027. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  20028. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  20029. },
  20030. args: ["aClass", "aBlock", "anotherBlock"],
  20031. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  20032. referencedClasses: [],
  20033. messageSends: ["catch:", "on:do:"]
  20034. }),
  20035. $globals.TThenable);
  20036. $core.addMethod(
  20037. $core.method({
  20038. selector: "then:",
  20039. protocol: "promises",
  20040. fn: function (aBlockOrArray){
  20041. var self=this,$self=this;
  20042. return $core.withContext(function($ctx1) {
  20043. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  20044. return array.reduce(function (soFar, aBlock) {
  20045. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  20046. function (result) {return $core.seamless(function () {
  20047. if (Array.isArray(result)) {
  20048. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  20049. } else {
  20050. return aBlock._value_(result);
  20051. }
  20052. })} :
  20053. function (result) {return $core.seamless(function () {
  20054. return aBlock._value_(result);
  20055. })}
  20056. );
  20057. }, self);
  20058. return self;
  20059. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  20060. },
  20061. args: ["aBlockOrArray"],
  20062. source: "then: aBlockOrArray\x0a\x22Accepts a block or array of blocks.\x0aEach of blocks in the array or the singleton one is\x0aused in .then call to a promise, to accept a result\x0aand transform it to the result for the next one.\x0aIn case a block has more than one argument\x0aand result is an array, first n-1 elements of the array\x0aare put into additional arguments beyond the first.\x0aThe first argument always contains the result as-is.\x22\x0a<inlineJS: '\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length > 1 ?\x0a function (result) {return $core.seamless(function () {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a })} :\x0a function (result) {return $core.seamless(function () {\x0a return aBlock._value_(result);\x0a })}\x0a );\x0a}, self)'>",
  20063. referencedClasses: [],
  20064. messageSends: []
  20065. }),
  20066. $globals.TThenable);
  20067. $core.addMethod(
  20068. $core.method({
  20069. selector: "then:catch:",
  20070. protocol: "promises",
  20071. fn: function (aBlockOrArray,anotherBlock){
  20072. var self=this,$self=this;
  20073. return $core.withContext(function($ctx1) {
  20074. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  20075. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  20076. },
  20077. args: ["aBlockOrArray", "anotherBlock"],
  20078. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  20079. referencedClasses: [],
  20080. messageSends: ["catch:", "then:"]
  20081. }),
  20082. $globals.TThenable);
  20083. $core.addMethod(
  20084. $core.method({
  20085. selector: "then:on:do:",
  20086. protocol: "promises",
  20087. fn: function (aBlockOrArray,aClass,aBlock){
  20088. var self=this,$self=this;
  20089. return $core.withContext(function($ctx1) {
  20090. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  20091. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  20092. },
  20093. args: ["aBlockOrArray", "aClass", "aBlock"],
  20094. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  20095. referencedClasses: [],
  20096. messageSends: ["on:do:", "then:"]
  20097. }),
  20098. $globals.TThenable);
  20099. $core.addMethod(
  20100. $core.method({
  20101. selector: "then:on:do:catch:",
  20102. protocol: "promises",
  20103. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  20104. var self=this,$self=this;
  20105. return $core.withContext(function($ctx1) {
  20106. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  20107. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  20108. },
  20109. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  20110. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  20111. referencedClasses: [],
  20112. messageSends: ["catch:", "on:do:", "then:"]
  20113. }),
  20114. $globals.TThenable);
  20115. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  20116. });
  20117. define('amber_core/Kernel-Infrastructure',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects", "amber_core/Kernel-Promises"], function($boot){"use strict";
  20118. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  20119. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20120. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20121. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  20122. $core.addPackage("Kernel-Infrastructure");
  20123. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  20124. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20125. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  20126. $globals.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`.";
  20127. $core.addMethod(
  20128. $core.method({
  20129. selector: "=",
  20130. protocol: "comparing",
  20131. fn: function (anObject){
  20132. var self=this,$self=this;
  20133. return $core.withContext(function($ctx1) {
  20134. var $2,$1;
  20135. $2=$recv(anObject)._class();
  20136. $ctx1.sendIdx["class"]=1;
  20137. $1=$recv($2).__eq_eq($self._class());
  20138. if(!$core.assert($1)){
  20139. return false;
  20140. }
  20141. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  20142. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  20143. },
  20144. args: ["anObject"],
  20145. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  20146. referencedClasses: ["JSObjectProxy"],
  20147. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  20148. }),
  20149. $globals.JSObjectProxy);
  20150. $core.addMethod(
  20151. $core.method({
  20152. selector: "asJavaScriptObject",
  20153. protocol: "converting",
  20154. fn: function (){
  20155. var self=this,$self=this;
  20156. return $self["@jsObject"];
  20157. },
  20158. args: [],
  20159. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  20160. referencedClasses: [],
  20161. messageSends: []
  20162. }),
  20163. $globals.JSObjectProxy);
  20164. $core.addMethod(
  20165. $core.method({
  20166. selector: "at:",
  20167. protocol: "accessing",
  20168. fn: function (aString){
  20169. var self=this,$self=this;
  20170. return $core.withContext(function($ctx1) {
  20171. return $self['@jsObject'][aString];
  20172. return self;
  20173. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  20174. },
  20175. args: ["aString"],
  20176. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  20177. referencedClasses: [],
  20178. messageSends: []
  20179. }),
  20180. $globals.JSObjectProxy);
  20181. $core.addMethod(
  20182. $core.method({
  20183. selector: "at:ifAbsent:",
  20184. protocol: "accessing",
  20185. fn: function (aString,aBlock){
  20186. var self=this,$self=this;
  20187. return $core.withContext(function($ctx1) {
  20188. var obj = $self['@jsObject'];
  20189. return aString in obj ? obj[aString] : aBlock._value();
  20190. ;
  20191. return self;
  20192. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  20193. },
  20194. args: ["aString", "aBlock"],
  20195. 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<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09'>",
  20196. referencedClasses: [],
  20197. messageSends: []
  20198. }),
  20199. $globals.JSObjectProxy);
  20200. $core.addMethod(
  20201. $core.method({
  20202. selector: "at:ifPresent:",
  20203. protocol: "accessing",
  20204. fn: function (aString,aBlock){
  20205. var self=this,$self=this;
  20206. return $core.withContext(function($ctx1) {
  20207. var obj = $self['@jsObject'];
  20208. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  20209. ;
  20210. return self;
  20211. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  20212. },
  20213. args: ["aString", "aBlock"],
  20214. 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<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09'>",
  20215. referencedClasses: [],
  20216. messageSends: []
  20217. }),
  20218. $globals.JSObjectProxy);
  20219. $core.addMethod(
  20220. $core.method({
  20221. selector: "at:ifPresent:ifAbsent:",
  20222. protocol: "accessing",
  20223. fn: function (aString,aBlock,anotherBlock){
  20224. var self=this,$self=this;
  20225. return $core.withContext(function($ctx1) {
  20226. var obj = $self['@jsObject'];
  20227. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  20228. ;
  20229. return self;
  20230. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20231. },
  20232. args: ["aString", "aBlock", "anotherBlock"],
  20233. 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<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09'>",
  20234. referencedClasses: [],
  20235. messageSends: []
  20236. }),
  20237. $globals.JSObjectProxy);
  20238. $core.addMethod(
  20239. $core.method({
  20240. selector: "at:put:",
  20241. protocol: "accessing",
  20242. fn: function (aString,anObject){
  20243. var self=this,$self=this;
  20244. return $core.withContext(function($ctx1) {
  20245. return $self['@jsObject'][aString] = anObject;
  20246. return self;
  20247. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  20248. },
  20249. args: ["aString", "anObject"],
  20250. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  20251. referencedClasses: [],
  20252. messageSends: []
  20253. }),
  20254. $globals.JSObjectProxy);
  20255. $core.addMethod(
  20256. $core.method({
  20257. selector: "catch:",
  20258. protocol: "promises",
  20259. fn: function (aBlock){
  20260. var self=this,$self=this;
  20261. return $core.withContext(function($ctx1) {
  20262. var $1,$2;
  20263. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  20264. if($core.assert($1)){
  20265. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  20266. } else {
  20267. $2=(
  20268. $ctx1.supercall = true,
  20269. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  20270. $ctx1.supercall = false;
  20271. return $2;
  20272. }
  20273. return self;
  20274. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  20275. },
  20276. args: ["aBlock"],
  20277. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  20278. referencedClasses: ["NativeFunction", "TThenable"],
  20279. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  20280. }),
  20281. $globals.JSObjectProxy);
  20282. $core.addMethod(
  20283. $core.method({
  20284. selector: "doesNotUnderstand:",
  20285. protocol: "proxy",
  20286. fn: function (aMessage){
  20287. var self=this,$self=this;
  20288. return $core.withContext(function($ctx1) {
  20289. var $1,$receiver;
  20290. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  20291. if(($receiver = $1) == null || $receiver.a$nil){
  20292. return (
  20293. $ctx1.supercall = true,
  20294. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  20295. $ctx1.supercall = false;
  20296. } else {
  20297. var jsSelector;
  20298. jsSelector=$receiver;
  20299. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  20300. }
  20301. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  20302. },
  20303. args: ["aMessage"],
  20304. source: "doesNotUnderstand: aMessage\x0a\x09^ (JSObjectProxy lookupProperty: aMessage selector asJavaScriptPropertyName ofProxy: self)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09JSObjectProxy \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments\x0a\x09\x09\x09\x09ofProxy: self ]",
  20305. referencedClasses: ["JSObjectProxy"],
  20306. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  20307. }),
  20308. $globals.JSObjectProxy);
  20309. $core.addMethod(
  20310. $core.method({
  20311. selector: "in:",
  20312. protocol: "accessing",
  20313. fn: function (aValuable){
  20314. var self=this,$self=this;
  20315. return $core.withContext(function($ctx1) {
  20316. return $recv(aValuable)._value_($self["@jsObject"]);
  20317. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  20318. },
  20319. args: ["aValuable"],
  20320. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  20321. referencedClasses: [],
  20322. messageSends: ["value:"]
  20323. }),
  20324. $globals.JSObjectProxy);
  20325. $core.addMethod(
  20326. $core.method({
  20327. selector: "jsObject",
  20328. protocol: "accessing",
  20329. fn: function (){
  20330. var self=this,$self=this;
  20331. return $self["@jsObject"];
  20332. },
  20333. args: [],
  20334. source: "jsObject\x0a\x09^ jsObject",
  20335. referencedClasses: [],
  20336. messageSends: []
  20337. }),
  20338. $globals.JSObjectProxy);
  20339. $core.addMethod(
  20340. $core.method({
  20341. selector: "keysAndValuesDo:",
  20342. protocol: "enumerating",
  20343. fn: function (aBlock){
  20344. var self=this,$self=this;
  20345. return $core.withContext(function($ctx1) {
  20346. var o = $self['@jsObject'];
  20347. for(var i in o) {
  20348. aBlock._value_value_(i, o[i]);
  20349. }
  20350. ;
  20351. return self;
  20352. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  20353. },
  20354. args: ["aBlock"],
  20355. source: "keysAndValuesDo: aBlock\x0a\x09<inlineJS: '\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'>",
  20356. referencedClasses: [],
  20357. messageSends: []
  20358. }),
  20359. $globals.JSObjectProxy);
  20360. $core.addMethod(
  20361. $core.method({
  20362. selector: "on:do:",
  20363. protocol: "promises",
  20364. fn: function (aClass,aBlock){
  20365. var self=this,$self=this;
  20366. return $core.withContext(function($ctx1) {
  20367. var $1,$2;
  20368. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  20369. if($core.assert($1)){
  20370. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  20371. } else {
  20372. $2=(
  20373. $ctx1.supercall = true,
  20374. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  20375. $ctx1.supercall = false;
  20376. return $2;
  20377. }
  20378. return self;
  20379. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  20380. },
  20381. args: ["aClass", "aBlock"],
  20382. source: "on: aClass do: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #on:do:) sendTo: jsObject arguments: {aClass. aBlock} ]\x0a\x09ifFalse: [ ^ super on: aClass do: aBlock ]",
  20383. referencedClasses: ["NativeFunction", "TThenable"],
  20384. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  20385. }),
  20386. $globals.JSObjectProxy);
  20387. $core.addMethod(
  20388. $core.method({
  20389. selector: "printOn:",
  20390. protocol: "printing",
  20391. fn: function (aStream){
  20392. var self=this,$self=this;
  20393. return $core.withContext(function($ctx1) {
  20394. $recv(aStream)._nextPutAll_($self._printString());
  20395. return self;
  20396. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  20397. },
  20398. args: ["aStream"],
  20399. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  20400. referencedClasses: [],
  20401. messageSends: ["nextPutAll:", "printString"]
  20402. }),
  20403. $globals.JSObjectProxy);
  20404. $core.addMethod(
  20405. $core.method({
  20406. selector: "printString",
  20407. protocol: "printing",
  20408. fn: function (){
  20409. var self=this,$self=this;
  20410. return $core.withContext(function($ctx1) {
  20411. var js = $self['@jsObject'];
  20412. return js.toString
  20413. ? js.toString()
  20414. : Object.prototype.toString.call(js)
  20415. ;
  20416. return self;
  20417. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  20418. },
  20419. args: [],
  20420. source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = $self[''@jsObject''];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>",
  20421. referencedClasses: [],
  20422. messageSends: []
  20423. }),
  20424. $globals.JSObjectProxy);
  20425. $core.addMethod(
  20426. $core.method({
  20427. selector: "putOn:",
  20428. protocol: "streaming",
  20429. fn: function (aStream){
  20430. var self=this,$self=this;
  20431. return $core.withContext(function($ctx1) {
  20432. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  20433. return self;
  20434. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  20435. },
  20436. args: ["aStream"],
  20437. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  20438. referencedClasses: [],
  20439. messageSends: ["nextPutJSObject:"]
  20440. }),
  20441. $globals.JSObjectProxy);
  20442. $core.addMethod(
  20443. $core.method({
  20444. selector: "then:",
  20445. protocol: "promises",
  20446. fn: function (aBlockOrArray){
  20447. var self=this,$self=this;
  20448. return $core.withContext(function($ctx1) {
  20449. var $1,$2;
  20450. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  20451. if($core.assert($1)){
  20452. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  20453. } else {
  20454. $2=(
  20455. $ctx1.supercall = true,
  20456. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  20457. $ctx1.supercall = false;
  20458. return $2;
  20459. }
  20460. return self;
  20461. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  20462. },
  20463. args: ["aBlockOrArray"],
  20464. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  20465. referencedClasses: ["NativeFunction", "TThenable"],
  20466. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  20467. }),
  20468. $globals.JSObjectProxy);
  20469. $core.addMethod(
  20470. $core.method({
  20471. selector: "addObjectVariablesTo:ofProxy:",
  20472. protocol: "proxy",
  20473. fn: function (aDictionary,aProxy){
  20474. var self=this,$self=this;
  20475. return $core.withContext(function($ctx1) {
  20476. var jsObject = aProxy['@jsObject'];
  20477. for(var i in jsObject) {
  20478. aDictionary._at_put_(i, jsObject[i]);
  20479. }
  20480. ;
  20481. return self;
  20482. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  20483. },
  20484. args: ["aDictionary", "aProxy"],
  20485. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09var jsObject = aProxy[''@jsObject''];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09'>",
  20486. referencedClasses: [],
  20487. messageSends: []
  20488. }),
  20489. $globals.JSObjectProxy.a$cls);
  20490. $core.addMethod(
  20491. $core.method({
  20492. selector: "compareJSObjectOfProxy:withProxy:",
  20493. protocol: "proxy",
  20494. fn: function (aProxy,anotherProxy){
  20495. var self=this,$self=this;
  20496. return $core.withContext(function($ctx1) {
  20497. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  20498. return aProxy["@jsObject"] === anotherJSObject;
  20499. return self;
  20500. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  20501. },
  20502. args: ["aProxy", "anotherProxy"],
  20503. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>",
  20504. referencedClasses: [],
  20505. messageSends: []
  20506. }),
  20507. $globals.JSObjectProxy.a$cls);
  20508. $core.addMethod(
  20509. $core.method({
  20510. selector: "forwardMessage:withArguments:ofProxy:",
  20511. protocol: "proxy",
  20512. fn: function (aString,anArray,aProxy){
  20513. var self=this,$self=this;
  20514. return $core.withContext(function($ctx1) {
  20515. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  20516. ;
  20517. return self;
  20518. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  20519. },
  20520. args: ["aString", "anArray", "aProxy"],
  20521. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  20522. referencedClasses: [],
  20523. messageSends: []
  20524. }),
  20525. $globals.JSObjectProxy.a$cls);
  20526. $core.addMethod(
  20527. $core.method({
  20528. selector: "jsObject:ofProxy:",
  20529. protocol: "proxy",
  20530. fn: function (aJSObject,aProxy){
  20531. var self=this,$self=this;
  20532. return $core.withContext(function($ctx1) {
  20533. aProxy['@jsObject'] = aJSObject;
  20534. return self;
  20535. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  20536. },
  20537. args: ["aJSObject", "aProxy"],
  20538. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  20539. referencedClasses: [],
  20540. messageSends: []
  20541. }),
  20542. $globals.JSObjectProxy.a$cls);
  20543. $core.addMethod(
  20544. $core.method({
  20545. selector: "lookupProperty:ofProxy:",
  20546. protocol: "proxy",
  20547. fn: function (aString,aProxy){
  20548. var self=this,$self=this;
  20549. return $core.withContext(function($ctx1) {
  20550. return aString in aProxy._jsObject() ? aString : nil;
  20551. return self;
  20552. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  20553. },
  20554. args: ["aString", "aProxy"],
  20555. source: "lookupProperty: aString ofProxy: aProxy\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<inlineJS: 'return aString in aProxy._jsObject() ? aString : nil'>",
  20556. referencedClasses: [],
  20557. messageSends: []
  20558. }),
  20559. $globals.JSObjectProxy.a$cls);
  20560. $core.addMethod(
  20561. $core.method({
  20562. selector: "on:",
  20563. protocol: "instance creation",
  20564. fn: function (aJSObject){
  20565. var self=this,$self=this;
  20566. var instance;
  20567. return $core.withContext(function($ctx1) {
  20568. instance=$self._new();
  20569. $self._jsObject_ofProxy_(aJSObject,instance);
  20570. return instance;
  20571. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  20572. },
  20573. args: ["aJSObject"],
  20574. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  20575. referencedClasses: [],
  20576. messageSends: ["new", "jsObject:ofProxy:"]
  20577. }),
  20578. $globals.JSObjectProxy.a$cls);
  20579. $core.addClass("Organizer", $globals.Object, [], "Kernel-Infrastructure");
  20580. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  20581. $core.addMethod(
  20582. $core.method({
  20583. selector: "addElement:",
  20584. protocol: "accessing",
  20585. fn: function (anObject){
  20586. var self=this,$self=this;
  20587. return $core.withContext(function($ctx1) {
  20588. $core.addElement(self.elements, anObject);
  20589. return self;
  20590. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  20591. },
  20592. args: ["anObject"],
  20593. source: "addElement: anObject\x0a\x09<inlineJS: '$core.addElement(self.elements, anObject)'>",
  20594. referencedClasses: [],
  20595. messageSends: []
  20596. }),
  20597. $globals.Organizer);
  20598. $core.addMethod(
  20599. $core.method({
  20600. selector: "elements",
  20601. protocol: "accessing",
  20602. fn: function (){
  20603. var self=this,$self=this;
  20604. return $core.withContext(function($ctx1) {
  20605. return $recv($self._basicAt_("elements"))._copy();
  20606. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  20607. },
  20608. args: [],
  20609. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  20610. referencedClasses: [],
  20611. messageSends: ["copy", "basicAt:"]
  20612. }),
  20613. $globals.Organizer);
  20614. $core.addMethod(
  20615. $core.method({
  20616. selector: "removeElement:",
  20617. protocol: "accessing",
  20618. fn: function (anObject){
  20619. var self=this,$self=this;
  20620. return $core.withContext(function($ctx1) {
  20621. $core.removeElement(self.elements, anObject);
  20622. return self;
  20623. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  20624. },
  20625. args: ["anObject"],
  20626. source: "removeElement: anObject\x0a\x09<inlineJS: '$core.removeElement(self.elements, anObject)'>",
  20627. referencedClasses: [],
  20628. messageSends: []
  20629. }),
  20630. $globals.Organizer);
  20631. $core.addClass("ClassOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  20632. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  20633. $core.addMethod(
  20634. $core.method({
  20635. selector: "addElement:",
  20636. protocol: "accessing",
  20637. fn: function (aString){
  20638. var self=this,$self=this;
  20639. return $core.withContext(function($ctx1) {
  20640. var $1,$3,$2;
  20641. (
  20642. $ctx1.supercall = true,
  20643. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  20644. $ctx1.supercall = false;
  20645. $1=$recv($globals.SystemAnnouncer)._current();
  20646. $3=$recv($globals.ProtocolAdded)._new();
  20647. $recv($3)._protocol_(aString);
  20648. $recv($3)._theClass_($self._theClass());
  20649. $2=$recv($3)._yourself();
  20650. $recv($1)._announce_($2);
  20651. return self;
  20652. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  20653. },
  20654. args: ["aString"],
  20655. 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)",
  20656. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  20657. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  20658. }),
  20659. $globals.ClassOrganizer);
  20660. $core.addMethod(
  20661. $core.method({
  20662. selector: "removeElement:",
  20663. protocol: "accessing",
  20664. fn: function (aString){
  20665. var self=this,$self=this;
  20666. return $core.withContext(function($ctx1) {
  20667. var $1,$3,$2;
  20668. (
  20669. $ctx1.supercall = true,
  20670. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  20671. $ctx1.supercall = false;
  20672. $1=$recv($globals.SystemAnnouncer)._current();
  20673. $3=$recv($globals.ProtocolRemoved)._new();
  20674. $recv($3)._protocol_(aString);
  20675. $recv($3)._theClass_($self._theClass());
  20676. $2=$recv($3)._yourself();
  20677. $recv($1)._announce_($2);
  20678. return self;
  20679. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  20680. },
  20681. args: ["aString"],
  20682. 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)",
  20683. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  20684. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  20685. }),
  20686. $globals.ClassOrganizer);
  20687. $core.addMethod(
  20688. $core.method({
  20689. selector: "theClass",
  20690. protocol: "accessing",
  20691. fn: function (){
  20692. var self=this,$self=this;
  20693. return $core.withContext(function($ctx1) {
  20694. return self.theClass;
  20695. return self;
  20696. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  20697. },
  20698. args: [],
  20699. source: "theClass\x0a\x09<inlineJS: 'return self.theClass'>",
  20700. referencedClasses: [],
  20701. messageSends: []
  20702. }),
  20703. $globals.ClassOrganizer);
  20704. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  20705. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  20706. $core.addClass("Package", $globals.Object, ["transport", "imports", "dirty"], "Kernel-Infrastructure");
  20707. $globals.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'";
  20708. $core.addMethod(
  20709. $core.method({
  20710. selector: "basicImports",
  20711. protocol: "private",
  20712. fn: function (){
  20713. var self=this,$self=this;
  20714. return $core.withContext(function($ctx1) {
  20715. return self.imports || [];
  20716. return self;
  20717. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  20718. },
  20719. args: [],
  20720. source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.imports || []'>",
  20721. referencedClasses: [],
  20722. messageSends: []
  20723. }),
  20724. $globals.Package);
  20725. $core.addMethod(
  20726. $core.method({
  20727. selector: "basicName:",
  20728. protocol: "private",
  20729. fn: function (aString){
  20730. var self=this,$self=this;
  20731. return $core.withContext(function($ctx1) {
  20732. self.pkgName = aString;
  20733. return self;
  20734. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  20735. },
  20736. args: ["aString"],
  20737. source: "basicName: aString\x0a\x09<inlineJS: 'self.pkgName = aString'>",
  20738. referencedClasses: [],
  20739. messageSends: []
  20740. }),
  20741. $globals.Package);
  20742. $core.addMethod(
  20743. $core.method({
  20744. selector: "basicTransport",
  20745. protocol: "private",
  20746. fn: function (){
  20747. var self=this,$self=this;
  20748. return $core.withContext(function($ctx1) {
  20749. return self.transport;
  20750. return self;
  20751. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  20752. },
  20753. args: [],
  20754. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.transport'>",
  20755. referencedClasses: [],
  20756. messageSends: []
  20757. }),
  20758. $globals.Package);
  20759. $core.addMethod(
  20760. $core.method({
  20761. selector: "beClean",
  20762. protocol: "accessing",
  20763. fn: function (){
  20764. var self=this,$self=this;
  20765. return $core.withContext(function($ctx1) {
  20766. var $1,$3,$2;
  20767. $self["@dirty"]=false;
  20768. $1=$recv($globals.SystemAnnouncer)._current();
  20769. $3=$recv($globals.PackageClean)._new();
  20770. $recv($3)._package_(self);
  20771. $2=$recv($3)._yourself();
  20772. $recv($1)._announce_($2);
  20773. return self;
  20774. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  20775. },
  20776. args: [],
  20777. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  20778. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  20779. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  20780. }),
  20781. $globals.Package);
  20782. $core.addMethod(
  20783. $core.method({
  20784. selector: "beDirty",
  20785. protocol: "accessing",
  20786. fn: function (){
  20787. var self=this,$self=this;
  20788. return $core.withContext(function($ctx1) {
  20789. var $1,$3,$2;
  20790. $self["@dirty"]=true;
  20791. $1=$recv($globals.SystemAnnouncer)._current();
  20792. $3=$recv($globals.PackageDirty)._new();
  20793. $recv($3)._package_(self);
  20794. $2=$recv($3)._yourself();
  20795. $recv($1)._announce_($2);
  20796. return self;
  20797. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  20798. },
  20799. args: [],
  20800. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  20801. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  20802. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  20803. }),
  20804. $globals.Package);
  20805. $core.addMethod(
  20806. $core.method({
  20807. selector: "classTemplate",
  20808. protocol: "accessing",
  20809. fn: function (){
  20810. var self=this,$self=this;
  20811. return $core.withContext(function($ctx1) {
  20812. return $recv($globals.String)._streamContents_((function(stream){
  20813. return $core.withContext(function($ctx2) {
  20814. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  20815. $ctx2.sendIdx["write:"]=1;
  20816. $recv(stream)._lf();
  20817. $ctx2.sendIdx["lf"]=1;
  20818. $recv(stream)._tab();
  20819. $ctx2.sendIdx["tab"]=1;
  20820. $recv(stream)._write_("instanceVariableNames: ''");
  20821. $ctx2.sendIdx["write:"]=2;
  20822. $recv(stream)._lf();
  20823. $recv(stream)._tab();
  20824. $recv(stream)._write_("package: ");
  20825. return $recv(stream)._print_($self._name());
  20826. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  20827. }));
  20828. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  20829. },
  20830. args: [],
  20831. source: "classTemplate\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Object subclass: #NameOfSubclass'; lf;\x0a\x09\x09tab; write: 'instanceVariableNames: '''''; lf;\x0a\x09\x09tab; write: 'package: '; print: self name ]",
  20832. referencedClasses: ["String"],
  20833. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  20834. }),
  20835. $globals.Package);
  20836. $core.addMethod(
  20837. $core.method({
  20838. selector: "classes",
  20839. protocol: "classes",
  20840. fn: function (){
  20841. var self=this,$self=this;
  20842. return $core.withContext(function($ctx1) {
  20843. return $recv($self._organization())._elements();
  20844. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  20845. },
  20846. args: [],
  20847. source: "classes\x0a\x09^ self organization elements",
  20848. referencedClasses: [],
  20849. messageSends: ["elements", "organization"]
  20850. }),
  20851. $globals.Package);
  20852. $core.addMethod(
  20853. $core.method({
  20854. selector: "definition",
  20855. protocol: "accessing",
  20856. fn: function (){
  20857. var self=this,$self=this;
  20858. return $core.withContext(function($ctx1) {
  20859. var $1;
  20860. return $recv($globals.String)._streamContents_((function(stream){
  20861. return $core.withContext(function($ctx2) {
  20862. $1=$recv($self._class())._name();
  20863. $ctx2.sendIdx["name"]=1;
  20864. $recv(stream)._write_($1);
  20865. $ctx2.sendIdx["write:"]=1;
  20866. $recv(stream)._lf();
  20867. $ctx2.sendIdx["lf"]=1;
  20868. $recv(stream)._tab();
  20869. $ctx2.sendIdx["tab"]=1;
  20870. $recv(stream)._write_("named: ");
  20871. $ctx2.sendIdx["write:"]=2;
  20872. $recv(stream)._print_($self._name());
  20873. $recv(stream)._lf();
  20874. $ctx2.sendIdx["lf"]=2;
  20875. $recv(stream)._tab();
  20876. $ctx2.sendIdx["tab"]=2;
  20877. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  20878. $ctx2.sendIdx["write:"]=3;
  20879. $recv(stream)._lf();
  20880. $recv(stream)._tab();
  20881. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  20882. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  20883. }));
  20884. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  20885. },
  20886. args: [],
  20887. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: self class name; lf;\x0a\x09\x09tab; write: 'named: '; print: self name; lf;\x0a\x09\x09tab; write: { 'imports: '. self importsDefinition }; lf;\x0a\x09\x09tab; write: { 'transport: ('. self transport definition. ')' } ]",
  20888. referencedClasses: ["String"],
  20889. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  20890. }),
  20891. $globals.Package);
  20892. $core.addMethod(
  20893. $core.method({
  20894. selector: "imports",
  20895. protocol: "accessing",
  20896. fn: function (){
  20897. var self=this,$self=this;
  20898. return $core.withContext(function($ctx1) {
  20899. var $1,$receiver;
  20900. $1=$self["@imports"];
  20901. if(($receiver = $1) == null || $receiver.a$nil){
  20902. var parsed;
  20903. parsed=$self._importsFromJson_($self._basicImports());
  20904. parsed;
  20905. $self._imports_(parsed);
  20906. return $self["@imports"];
  20907. } else {
  20908. return $1;
  20909. }
  20910. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  20911. },
  20912. args: [],
  20913. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09| parsed |\x0a\x09\x09parsed := self importsFromJson: self basicImports.\x0a\x09\x09self imports: parsed.\x0a\x09\x09imports ]",
  20914. referencedClasses: [],
  20915. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  20916. }),
  20917. $globals.Package);
  20918. $core.addMethod(
  20919. $core.method({
  20920. selector: "imports:",
  20921. protocol: "accessing",
  20922. fn: function (anArray){
  20923. var self=this,$self=this;
  20924. return $core.withContext(function($ctx1) {
  20925. $self._validateImports_(anArray);
  20926. $self["@imports"]=$recv(anArray)._asSet();
  20927. return self;
  20928. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  20929. },
  20930. args: ["anArray"],
  20931. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  20932. referencedClasses: [],
  20933. messageSends: ["validateImports:", "asSet"]
  20934. }),
  20935. $globals.Package);
  20936. $core.addMethod(
  20937. $core.method({
  20938. selector: "importsAsJson",
  20939. protocol: "converting",
  20940. fn: function (){
  20941. var self=this,$self=this;
  20942. return $core.withContext(function($ctx1) {
  20943. var $1;
  20944. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  20945. return $core.withContext(function($ctx2) {
  20946. $1=$recv(each)._isString();
  20947. if($core.assert($1)){
  20948. return each;
  20949. } else {
  20950. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  20951. $ctx2.sendIdx[","]=1;
  20952. }
  20953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20954. }));
  20955. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  20956. },
  20957. args: [],
  20958. source: "importsAsJson\x0a\x0a\x09^ self sortedImportsAsArray collect: [ :each |\x0a\x09\x09each isString\x0a\x09\x09\x09ifTrue: [ each ]\x0a\x09\x09\x09ifFalse: [ each key, '=', each value ]]",
  20959. referencedClasses: [],
  20960. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  20961. }),
  20962. $globals.Package);
  20963. $core.addMethod(
  20964. $core.method({
  20965. selector: "importsDefinition",
  20966. protocol: "accessing",
  20967. fn: function (){
  20968. var self=this,$self=this;
  20969. return $core.withContext(function($ctx1) {
  20970. return $recv($globals.String)._streamContents_((function(stream){
  20971. return $core.withContext(function($ctx2) {
  20972. $recv(stream)._write_("{");
  20973. $ctx2.sendIdx["write:"]=1;
  20974. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  20975. return $core.withContext(function($ctx3) {
  20976. return $recv(stream)._print_(each);
  20977. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  20978. }),(function(){
  20979. return $core.withContext(function($ctx3) {
  20980. return $recv(stream)._write_(". ");
  20981. $ctx3.sendIdx["write:"]=2;
  20982. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  20983. }));
  20984. return $recv(stream)._write_("}");
  20985. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  20986. }));
  20987. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  20988. },
  20989. args: [],
  20990. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream write: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream print: each ]\x0a\x09\x09\x09separatedBy: [ stream write: '. ' ].\x0a\x09\x09stream write: '}' ]",
  20991. referencedClasses: ["String"],
  20992. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  20993. }),
  20994. $globals.Package);
  20995. $core.addMethod(
  20996. $core.method({
  20997. selector: "importsFromJson:",
  20998. protocol: "converting",
  20999. fn: function (anArray){
  21000. var self=this,$self=this;
  21001. return $core.withContext(function($ctx1) {
  21002. var $1;
  21003. return $recv(anArray)._collect_((function(each){
  21004. var split;
  21005. return $core.withContext(function($ctx2) {
  21006. split=$recv(each)._tokenize_("=");
  21007. split;
  21008. $1=$recv($recv(split)._size()).__eq((1));
  21009. if($core.assert($1)){
  21010. return $recv(split)._first();
  21011. $ctx2.sendIdx["first"]=1;
  21012. } else {
  21013. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  21014. }
  21015. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  21016. }));
  21017. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  21018. },
  21019. args: ["anArray"],
  21020. source: "importsFromJson: anArray\x0a\x09\x22Parses array of string, eg. #('asdf' 'qwer=tyuo')\x0a\x09into array of Strings and Associations,\x0a\x09eg. {'asdf'. 'qwer'->'tyuo'}\x22\x0a\x0a\x09^ anArray collect: [ :each |\x0a\x09\x09| split |\x0a\x09\x09split := each tokenize: '='.\x0a\x09\x09split size = 1\x0a\x09\x09\x09ifTrue: [ split first ]\x0a\x09\x09\x09ifFalse: [ split first -> split second ]]",
  21021. referencedClasses: [],
  21022. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  21023. }),
  21024. $globals.Package);
  21025. $core.addMethod(
  21026. $core.method({
  21027. selector: "isDirty",
  21028. protocol: "testing",
  21029. fn: function (){
  21030. var self=this,$self=this;
  21031. return $core.withContext(function($ctx1) {
  21032. var $1,$receiver;
  21033. $1=$self["@dirty"];
  21034. if(($receiver = $1) == null || $receiver.a$nil){
  21035. return false;
  21036. } else {
  21037. return $1;
  21038. }
  21039. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  21040. },
  21041. args: [],
  21042. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  21043. referencedClasses: [],
  21044. messageSends: ["ifNil:"]
  21045. }),
  21046. $globals.Package);
  21047. $core.addMethod(
  21048. $core.method({
  21049. selector: "isPackage",
  21050. protocol: "testing",
  21051. fn: function (){
  21052. var self=this,$self=this;
  21053. return true;
  21054. },
  21055. args: [],
  21056. source: "isPackage\x0a\x09^ true",
  21057. referencedClasses: [],
  21058. messageSends: []
  21059. }),
  21060. $globals.Package);
  21061. $core.addMethod(
  21062. $core.method({
  21063. selector: "loadDependencies",
  21064. protocol: "dependencies",
  21065. fn: function (){
  21066. var self=this,$self=this;
  21067. var classes,packages;
  21068. return $core.withContext(function($ctx1) {
  21069. var $1;
  21070. classes=$self._loadDependencyClasses();
  21071. $1=$recv($recv(classes)._collect_((function(each){
  21072. return $core.withContext(function($ctx2) {
  21073. return $recv(each)._package();
  21074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21075. })))._asSet();
  21076. $recv($1)._remove_ifAbsent_(self,(function(){
  21077. }));
  21078. return $recv($1)._yourself();
  21079. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  21080. },
  21081. args: [],
  21082. source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be loaded\x0a\x09before loading this package.\x22\x0a\x09\x0a\x09| classes packages |\x0a\x09classes := self loadDependencyClasses.\x0a\x09^ (classes collect: [ :each | each package ]) asSet\x0a\x09\x09remove: self ifAbsent: [];\x0a\x09\x09yourself",
  21083. referencedClasses: [],
  21084. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  21085. }),
  21086. $globals.Package);
  21087. $core.addMethod(
  21088. $core.method({
  21089. selector: "loadDependencyClasses",
  21090. protocol: "dependencies",
  21091. fn: function (){
  21092. var self=this,$self=this;
  21093. var starCategoryName;
  21094. return $core.withContext(function($ctx1) {
  21095. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  21096. starCategoryName="*".__comma($self._name());
  21097. $ctx1.sendIdx[","]=1;
  21098. $3=$self._classes();
  21099. $ctx1.sendIdx["classes"]=1;
  21100. $2=$recv($3)._collect_((function(each){
  21101. return $core.withContext(function($ctx2) {
  21102. return $recv(each)._superclass();
  21103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21104. }));
  21105. $ctx1.sendIdx["collect:"]=1;
  21106. $1=$recv($2)._asSet();
  21107. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  21108. return $core.withContext(function($ctx2) {
  21109. $5=$recv(each)._protocols();
  21110. $ctx2.sendIdx["protocols"]=1;
  21111. $7=$recv(each)._theMetaClass();
  21112. if(($receiver = $7) == null || $receiver.a$nil){
  21113. $6=[];
  21114. } else {
  21115. var meta;
  21116. meta=$receiver;
  21117. $6=$recv(meta)._protocols();
  21118. }
  21119. $4=$recv($5).__comma($6);
  21120. return $recv($4)._includes_(starCategoryName);
  21121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  21122. })));
  21123. $ctx1.sendIdx["addAll:"]=1;
  21124. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  21125. return $core.withContext(function($ctx2) {
  21126. return $recv($self._traitCompositions())._valuesDo_((function(each){
  21127. return $core.withContext(function($ctx3) {
  21128. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  21129. return $core.withContext(function($ctx4) {
  21130. return $recv(eachTT)._trait();
  21131. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  21132. })));
  21133. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  21134. }));
  21135. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  21136. })));
  21137. $recv($1)._remove_ifAbsent_(nil,(function(){
  21138. }));
  21139. return $recv($1)._yourself();
  21140. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  21141. },
  21142. args: [],
  21143. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x0a\x09as well as all traits used\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09addAll: (Smalltalk classes select: [ :each |\x0a\x09\x09\x09each protocols, (each theMetaClass ifNil: [ #() ] ifNotNil: [ :meta | meta protocols])\x0a\x09\x09\x09\x09includes: starCategoryName ]);\x0a\x09\x09addAll: (Array streamContents: [ :as | self traitCompositions valuesDo: [ :each | as write: (each collect: [ :eachTT | eachTT trait ])]]);\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09yourself",
  21144. referencedClasses: ["Smalltalk", "Array"],
  21145. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  21146. }),
  21147. $globals.Package);
  21148. $core.addMethod(
  21149. $core.method({
  21150. selector: "name",
  21151. protocol: "accessing",
  21152. fn: function (){
  21153. var self=this,$self=this;
  21154. return $core.withContext(function($ctx1) {
  21155. return self.pkgName;
  21156. return self;
  21157. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  21158. },
  21159. args: [],
  21160. source: "name\x0a\x09<inlineJS: 'return self.pkgName'>",
  21161. referencedClasses: [],
  21162. messageSends: []
  21163. }),
  21164. $globals.Package);
  21165. $core.addMethod(
  21166. $core.method({
  21167. selector: "name:",
  21168. protocol: "accessing",
  21169. fn: function (aString){
  21170. var self=this,$self=this;
  21171. return $core.withContext(function($ctx1) {
  21172. $self._basicName_(aString);
  21173. $self._beDirty();
  21174. return self;
  21175. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  21176. },
  21177. args: ["aString"],
  21178. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  21179. referencedClasses: [],
  21180. messageSends: ["basicName:", "beDirty"]
  21181. }),
  21182. $globals.Package);
  21183. $core.addMethod(
  21184. $core.method({
  21185. selector: "organization",
  21186. protocol: "accessing",
  21187. fn: function (){
  21188. var self=this,$self=this;
  21189. return $core.withContext(function($ctx1) {
  21190. return $self._basicAt_("organization");
  21191. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  21192. },
  21193. args: [],
  21194. source: "organization\x0a\x09^ self basicAt: 'organization'",
  21195. referencedClasses: [],
  21196. messageSends: ["basicAt:"]
  21197. }),
  21198. $globals.Package);
  21199. $core.addMethod(
  21200. $core.method({
  21201. selector: "printOn:",
  21202. protocol: "printing",
  21203. fn: function (aStream){
  21204. var self=this,$self=this;
  21205. return $core.withContext(function($ctx1) {
  21206. (
  21207. $ctx1.supercall = true,
  21208. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  21209. $ctx1.supercall = false;
  21210. $recv(aStream)._nextPutAll_(" (");
  21211. $ctx1.sendIdx["nextPutAll:"]=1;
  21212. $recv(aStream)._nextPutAll_($self._name());
  21213. $ctx1.sendIdx["nextPutAll:"]=2;
  21214. $recv(aStream)._nextPutAll_(")");
  21215. return self;
  21216. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  21217. },
  21218. args: ["aStream"],
  21219. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  21220. referencedClasses: [],
  21221. messageSends: ["printOn:", "nextPutAll:", "name"]
  21222. }),
  21223. $globals.Package);
  21224. $core.addMethod(
  21225. $core.method({
  21226. selector: "setupClasses",
  21227. protocol: "classes",
  21228. fn: function (){
  21229. var self=this,$self=this;
  21230. return $core.withContext(function($ctx1) {
  21231. $recv($self._classes())._do_((function(each){
  21232. return $core.withContext(function($ctx2) {
  21233. return $recv(each)._initialize();
  21234. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21235. }));
  21236. return self;
  21237. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  21238. },
  21239. args: [],
  21240. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  21241. referencedClasses: [],
  21242. messageSends: ["do:", "classes", "initialize"]
  21243. }),
  21244. $globals.Package);
  21245. $core.addMethod(
  21246. $core.method({
  21247. selector: "sortedClasses",
  21248. protocol: "classes",
  21249. fn: function (){
  21250. var self=this,$self=this;
  21251. return $core.withContext(function($ctx1) {
  21252. return $recv($self._class())._sortedClasses_($self._classes());
  21253. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  21254. },
  21255. args: [],
  21256. 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",
  21257. referencedClasses: [],
  21258. messageSends: ["sortedClasses:", "class", "classes"]
  21259. }),
  21260. $globals.Package);
  21261. $core.addMethod(
  21262. $core.method({
  21263. selector: "sortedImportsAsArray",
  21264. protocol: "private",
  21265. fn: function (){
  21266. var self=this,$self=this;
  21267. return $core.withContext(function($ctx1) {
  21268. var $3,$2,$4,$1,$6,$5,$7;
  21269. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  21270. return $core.withContext(function($ctx2) {
  21271. $3=$recv(a)._isString();
  21272. $ctx2.sendIdx["isString"]=1;
  21273. $2=$recv($3)._not();
  21274. $4=$recv(b)._isString();
  21275. $ctx2.sendIdx["isString"]=2;
  21276. $1=$recv($2).__and($4);
  21277. return $recv($1)._or_((function(){
  21278. return $core.withContext(function($ctx3) {
  21279. $6=$recv(a)._isString();
  21280. $ctx3.sendIdx["isString"]=3;
  21281. $5=$recv($6).__eq($recv(b)._isString());
  21282. return $recv($5)._and_((function(){
  21283. return $core.withContext(function($ctx4) {
  21284. $7=$recv(a)._value();
  21285. $ctx4.sendIdx["value"]=1;
  21286. return $recv($7).__lt_eq($recv(b)._value());
  21287. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  21288. }));
  21289. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  21290. }));
  21291. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  21292. }));
  21293. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  21294. },
  21295. args: [],
  21296. source: "sortedImportsAsArray\x0a\x09\x22Answer imports sorted first by type (associations first),\x0a\x09then by value\x22\x0a\x0a\x09^ self imports asArray\x0a\x09\x09sorted: [ :a :b |\x0a\x09\x09\x09a isString not & b isString or: [\x0a\x09\x09\x09\x09a isString = b isString and: [\x0a\x09\x09\x09\x09\x09a value <= b value ]]]",
  21297. referencedClasses: [],
  21298. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  21299. }),
  21300. $globals.Package);
  21301. $core.addMethod(
  21302. $core.method({
  21303. selector: "traitCompositions",
  21304. protocol: "dependencies",
  21305. fn: function (){
  21306. var self=this,$self=this;
  21307. var traitCompositions;
  21308. return $core.withContext(function($ctx1) {
  21309. var $1,$2,$3,$receiver;
  21310. traitCompositions=$recv($globals.Dictionary)._new();
  21311. $recv($self._classes())._do_((function(each){
  21312. return $core.withContext(function($ctx2) {
  21313. $1=traitCompositions;
  21314. $2=$recv(each)._traitComposition();
  21315. $ctx2.sendIdx["traitComposition"]=1;
  21316. $recv($1)._at_put_(each,$2);
  21317. $ctx2.sendIdx["at:put:"]=1;
  21318. $3=$recv(each)._theMetaClass();
  21319. if(($receiver = $3) == null || $receiver.a$nil){
  21320. return $3;
  21321. } else {
  21322. var meta;
  21323. meta=$receiver;
  21324. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  21325. }
  21326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21327. }));
  21328. return $recv(traitCompositions)._reject_((function(each){
  21329. return $core.withContext(function($ctx2) {
  21330. return $recv(each)._isEmpty();
  21331. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  21332. }));
  21333. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  21334. },
  21335. args: [],
  21336. source: "traitCompositions\x0a\x09| traitCompositions |\x0a\x09traitCompositions := Dictionary new.\x0a\x09self classes do: [ :each |\x0a\x09\x09traitCompositions at: each put: each traitComposition.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | traitCompositions at: meta put: meta traitComposition ] ].\x0a\x09^ traitCompositions reject: [ :each | each isEmpty ]",
  21337. referencedClasses: ["Dictionary"],
  21338. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  21339. }),
  21340. $globals.Package);
  21341. $core.addMethod(
  21342. $core.method({
  21343. selector: "transport",
  21344. protocol: "accessing",
  21345. fn: function (){
  21346. var self=this,$self=this;
  21347. return $core.withContext(function($ctx1) {
  21348. var $1,$2,$receiver;
  21349. $1=$self["@transport"];
  21350. if(($receiver = $1) == null || $receiver.a$nil){
  21351. $2=$recv($globals.PackageTransport)._fromJson_($self._basicTransport());
  21352. $recv($2)._package_(self);
  21353. $self["@transport"]=$recv($2)._yourself();
  21354. return $self["@transport"];
  21355. } else {
  21356. return $1;
  21357. }
  21358. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  21359. },
  21360. args: [],
  21361. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  21362. referencedClasses: ["PackageTransport"],
  21363. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  21364. }),
  21365. $globals.Package);
  21366. $core.addMethod(
  21367. $core.method({
  21368. selector: "transport:",
  21369. protocol: "accessing",
  21370. fn: function (aPackageTransport){
  21371. var self=this,$self=this;
  21372. return $core.withContext(function($ctx1) {
  21373. $self["@transport"]=aPackageTransport;
  21374. $recv(aPackageTransport)._package_(self);
  21375. return self;
  21376. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  21377. },
  21378. args: ["aPackageTransport"],
  21379. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  21380. referencedClasses: [],
  21381. messageSends: ["package:"]
  21382. }),
  21383. $globals.Package);
  21384. $core.addMethod(
  21385. $core.method({
  21386. selector: "validateImports:",
  21387. protocol: "validation",
  21388. fn: function (aCollection){
  21389. var self=this,$self=this;
  21390. return $core.withContext(function($ctx1) {
  21391. var $1,$2,$5,$4,$3,$6;
  21392. $recv(aCollection)._do_((function(import_){
  21393. return $core.withContext(function($ctx2) {
  21394. $1=$recv(import_)._isString();
  21395. $ctx2.sendIdx["isString"]=1;
  21396. if(!$core.assert($1)){
  21397. $2=$recv(import_)._respondsTo_("key");
  21398. if(!$core.assert($2)){
  21399. $self._error_("Imports must be Strings or Associations");
  21400. $ctx2.sendIdx["error:"]=1;
  21401. }
  21402. $5=$recv(import_)._key();
  21403. $ctx2.sendIdx["key"]=1;
  21404. $4=$recv($5)._isString();
  21405. $ctx2.sendIdx["isString"]=2;
  21406. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  21407. if(!$core.assert($3)){
  21408. $self._error_("Key and value must be Strings");
  21409. $ctx2.sendIdx["error:"]=2;
  21410. }
  21411. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  21412. if(!$core.assert($6)){
  21413. return $self._error_("Keys must be identifiers");
  21414. }
  21415. }
  21416. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  21417. }));
  21418. return self;
  21419. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  21420. },
  21421. args: ["aCollection"],
  21422. source: "validateImports: aCollection\x0a\x0a\x09aCollection do: [ :import |\x0a\x09\x09import isString ifFalse: [\x0a\x09\x09\x09(import respondsTo: #key) ifFalse: [\x0a\x09\x09\x09\x09self error: 'Imports must be Strings or Associations' ].\x0a\x09\x09\x09import key isString & import value isString ifFalse: [\x0a\x09\x09\x09\x09self error: 'Key and value must be Strings' ].\x0a\x09\x09\x09(import key match: '^[a-zA-Z][a-zA-Z0-9]*$') ifFalse: [\x0a\x09\x09\x09\x09self error: 'Keys must be identifiers' ]]]",
  21423. referencedClasses: [],
  21424. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  21425. }),
  21426. $globals.Package);
  21427. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  21428. $core.addMethod(
  21429. $core.method({
  21430. selector: "named:",
  21431. protocol: "accessing",
  21432. fn: function (aPackageName){
  21433. var self=this,$self=this;
  21434. return $core.withContext(function($ctx1) {
  21435. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  21436. return $core.withContext(function($ctx2) {
  21437. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  21438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21439. }));
  21440. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  21441. },
  21442. args: ["aPackageName"],
  21443. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  21444. referencedClasses: ["Smalltalk"],
  21445. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  21446. }),
  21447. $globals.Package.a$cls);
  21448. $core.addMethod(
  21449. $core.method({
  21450. selector: "named:ifAbsent:",
  21451. protocol: "accessing",
  21452. fn: function (aPackageName,aBlock){
  21453. var self=this,$self=this;
  21454. return $core.withContext(function($ctx1) {
  21455. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  21456. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  21457. },
  21458. args: ["aPackageName", "aBlock"],
  21459. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  21460. referencedClasses: ["Smalltalk"],
  21461. messageSends: ["packageAt:ifAbsent:"]
  21462. }),
  21463. $globals.Package.a$cls);
  21464. $core.addMethod(
  21465. $core.method({
  21466. selector: "named:imports:transport:",
  21467. protocol: "accessing",
  21468. fn: function (aPackageName,anArray,aTransport){
  21469. var self=this,$self=this;
  21470. var package_;
  21471. return $core.withContext(function($ctx1) {
  21472. package_=$self._named_(aPackageName);
  21473. $recv(package_)._imports_(anArray);
  21474. $recv(package_)._transport_(aTransport);
  21475. return package_;
  21476. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.a$cls)});
  21477. },
  21478. args: ["aPackageName", "anArray", "aTransport"],
  21479. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package imports: anArray.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  21480. referencedClasses: [],
  21481. messageSends: ["named:", "imports:", "transport:"]
  21482. }),
  21483. $globals.Package.a$cls);
  21484. $core.addMethod(
  21485. $core.method({
  21486. selector: "named:transport:",
  21487. protocol: "accessing",
  21488. fn: function (aPackageName,aTransport){
  21489. var self=this,$self=this;
  21490. var package_;
  21491. return $core.withContext(function($ctx1) {
  21492. package_=$self._named_(aPackageName);
  21493. $recv(package_)._transport_(aTransport);
  21494. return package_;
  21495. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.a$cls)});
  21496. },
  21497. args: ["aPackageName", "aTransport"],
  21498. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  21499. referencedClasses: [],
  21500. messageSends: ["named:", "transport:"]
  21501. }),
  21502. $globals.Package.a$cls);
  21503. $core.addMethod(
  21504. $core.method({
  21505. selector: "sortedClasses:",
  21506. protocol: "sorting",
  21507. fn: function (classes){
  21508. var self=this,$self=this;
  21509. var children,others,nodes,expandedClasses;
  21510. return $core.withContext(function($ctx1) {
  21511. var $1,$3,$2;
  21512. children=[];
  21513. others=[];
  21514. $recv(classes)._do_((function(each){
  21515. return $core.withContext(function($ctx2) {
  21516. $1=$recv(classes)._includes_($recv(each)._superclass());
  21517. if($core.assert($1)){
  21518. return $recv(others)._add_(each);
  21519. } else {
  21520. return $recv(children)._add_(each);
  21521. $ctx2.sendIdx["add:"]=1;
  21522. }
  21523. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21524. }));
  21525. $ctx1.sendIdx["do:"]=1;
  21526. nodes=$recv(children)._collect_((function(each){
  21527. return $core.withContext(function($ctx2) {
  21528. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  21529. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  21530. }));
  21531. nodes=$recv(nodes)._sorted_((function(a,b){
  21532. return $core.withContext(function($ctx2) {
  21533. $3=$recv(a)._theClass();
  21534. $ctx2.sendIdx["theClass"]=1;
  21535. $2=$recv($3)._name();
  21536. $ctx2.sendIdx["name"]=1;
  21537. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  21538. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  21539. }));
  21540. expandedClasses=$recv($globals.Array)._new();
  21541. $recv(nodes)._do_((function(aNode){
  21542. return $core.withContext(function($ctx2) {
  21543. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  21544. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  21545. }));
  21546. return expandedClasses;
  21547. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  21548. },
  21549. args: ["classes"],
  21550. 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",
  21551. referencedClasses: ["ClassSorterNode", "Array"],
  21552. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  21553. }),
  21554. $globals.Package.a$cls);
  21555. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  21556. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  21557. $core.addMethod(
  21558. $core.method({
  21559. selector: "announcer",
  21560. protocol: "accessing",
  21561. fn: function (){
  21562. var self=this,$self=this;
  21563. return $core.withContext(function($ctx1) {
  21564. return $recv($globals.SystemAnnouncer)._current();
  21565. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  21566. },
  21567. args: [],
  21568. source: "announcer\x0a\x09^ SystemAnnouncer current",
  21569. referencedClasses: ["SystemAnnouncer"],
  21570. messageSends: ["current"]
  21571. }),
  21572. $globals.PackageStateObserver);
  21573. $core.addMethod(
  21574. $core.method({
  21575. selector: "observeSystem",
  21576. protocol: "actions",
  21577. fn: function (){
  21578. var self=this,$self=this;
  21579. return $core.withContext(function($ctx1) {
  21580. var $1;
  21581. $1=$self._announcer();
  21582. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  21583. $ctx1.sendIdx["on:send:to:"]=1;
  21584. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  21585. $ctx1.sendIdx["on:send:to:"]=2;
  21586. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  21587. $ctx1.sendIdx["on:send:to:"]=3;
  21588. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  21589. return self;
  21590. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  21591. },
  21592. args: [],
  21593. source: "observeSystem\x0a\x09self announcer\x0a\x09\x09on: PackageAdded\x0a\x09\x09send: #onPackageAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassAnnouncement\x0a\x09\x09send: #onClassModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodAnnouncement\x0a\x09\x09send: #onMethodModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ProtocolAnnouncement\x0a\x09\x09send: #onProtocolModification:\x0a\x09\x09to: self",
  21594. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  21595. messageSends: ["on:send:to:", "announcer"]
  21596. }),
  21597. $globals.PackageStateObserver);
  21598. $core.addMethod(
  21599. $core.method({
  21600. selector: "onClassModification:",
  21601. protocol: "reactions",
  21602. fn: function (anAnnouncement){
  21603. var self=this,$self=this;
  21604. return $core.withContext(function($ctx1) {
  21605. var $1,$receiver;
  21606. $1=$recv(anAnnouncement)._theClass();
  21607. if(($receiver = $1) == null || $receiver.a$nil){
  21608. $1;
  21609. } else {
  21610. var theClass;
  21611. theClass=$receiver;
  21612. $recv($recv(theClass)._package())._beDirty();
  21613. }
  21614. return self;
  21615. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21616. },
  21617. args: ["anAnnouncement"],
  21618. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  21619. referencedClasses: [],
  21620. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  21621. }),
  21622. $globals.PackageStateObserver);
  21623. $core.addMethod(
  21624. $core.method({
  21625. selector: "onMethodModification:",
  21626. protocol: "reactions",
  21627. fn: function (anAnnouncement){
  21628. var self=this,$self=this;
  21629. return $core.withContext(function($ctx1) {
  21630. var $1,$receiver;
  21631. $1=$recv($recv(anAnnouncement)._method())._package();
  21632. if(($receiver = $1) == null || $receiver.a$nil){
  21633. $1;
  21634. } else {
  21635. var package_;
  21636. package_=$receiver;
  21637. $recv(package_)._beDirty();
  21638. }
  21639. return self;
  21640. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21641. },
  21642. args: ["anAnnouncement"],
  21643. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  21644. referencedClasses: [],
  21645. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  21646. }),
  21647. $globals.PackageStateObserver);
  21648. $core.addMethod(
  21649. $core.method({
  21650. selector: "onPackageAdded:",
  21651. protocol: "reactions",
  21652. fn: function (anAnnouncement){
  21653. var self=this,$self=this;
  21654. return $core.withContext(function($ctx1) {
  21655. $recv($recv(anAnnouncement)._package())._beDirty();
  21656. return self;
  21657. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21658. },
  21659. args: ["anAnnouncement"],
  21660. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  21661. referencedClasses: [],
  21662. messageSends: ["beDirty", "package"]
  21663. }),
  21664. $globals.PackageStateObserver);
  21665. $core.addMethod(
  21666. $core.method({
  21667. selector: "onProtocolModification:",
  21668. protocol: "reactions",
  21669. fn: function (anAnnouncement){
  21670. var self=this,$self=this;
  21671. return $core.withContext(function($ctx1) {
  21672. var $1,$receiver;
  21673. $1=$recv(anAnnouncement)._package();
  21674. if(($receiver = $1) == null || $receiver.a$nil){
  21675. $1;
  21676. } else {
  21677. var package_;
  21678. package_=$receiver;
  21679. $recv(package_)._beDirty();
  21680. }
  21681. return self;
  21682. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21683. },
  21684. args: ["anAnnouncement"],
  21685. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  21686. referencedClasses: [],
  21687. messageSends: ["ifNotNil:", "package", "beDirty"]
  21688. }),
  21689. $globals.PackageStateObserver);
  21690. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  21691. $core.addMethod(
  21692. $core.method({
  21693. selector: "current",
  21694. protocol: "accessing",
  21695. fn: function (){
  21696. var self=this,$self=this;
  21697. return $core.withContext(function($ctx1) {
  21698. var $1,$receiver;
  21699. $1=$self["@current"];
  21700. if(($receiver = $1) == null || $receiver.a$nil){
  21701. $self["@current"]=$self._new();
  21702. return $self["@current"];
  21703. } else {
  21704. return $1;
  21705. }
  21706. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  21707. },
  21708. args: [],
  21709. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  21710. referencedClasses: [],
  21711. messageSends: ["ifNil:", "new"]
  21712. }),
  21713. $globals.PackageStateObserver.a$cls);
  21714. $core.addMethod(
  21715. $core.method({
  21716. selector: "initialize",
  21717. protocol: "initialization",
  21718. fn: function (){
  21719. var self=this,$self=this;
  21720. return $core.withContext(function($ctx1) {
  21721. $recv($self._current())._observeSystem();
  21722. return self;
  21723. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  21724. },
  21725. args: [],
  21726. source: "initialize\x0a\x09self current observeSystem",
  21727. referencedClasses: [],
  21728. messageSends: ["observeSystem", "current"]
  21729. }),
  21730. $globals.PackageStateObserver.a$cls);
  21731. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  21732. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  21733. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  21734. $globals.Setting.comment="I represent a setting **stored** at `Smalltalk settings`. \x0aIn the current implementation, `Smalltalk settings` is an object persisted in the localStorage.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: aDefaultValue`.\x0a\x0aTo read the value of a setting you can also use the convenience:\x0a\x0a`theValueSet := 'any.characteristic' settingValue` \x0a\x0aor with a default using:\x0a\x0a `theEnsuredValueSet := 'any.characteristic' settingValueIfAbsent: true`";
  21735. $core.addMethod(
  21736. $core.method({
  21737. selector: "defaultValue",
  21738. protocol: "accessing",
  21739. fn: function (){
  21740. var self=this,$self=this;
  21741. return $self["@defaultValue"];
  21742. },
  21743. args: [],
  21744. source: "defaultValue\x0a\x09^ defaultValue",
  21745. referencedClasses: [],
  21746. messageSends: []
  21747. }),
  21748. $globals.Setting);
  21749. $core.addMethod(
  21750. $core.method({
  21751. selector: "defaultValue:",
  21752. protocol: "accessing",
  21753. fn: function (aStringifiableObject){
  21754. var self=this,$self=this;
  21755. $self["@defaultValue"]=aStringifiableObject;
  21756. return self;
  21757. },
  21758. args: ["aStringifiableObject"],
  21759. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  21760. referencedClasses: [],
  21761. messageSends: []
  21762. }),
  21763. $globals.Setting);
  21764. $core.addMethod(
  21765. $core.method({
  21766. selector: "key",
  21767. protocol: "accessing",
  21768. fn: function (){
  21769. var self=this,$self=this;
  21770. return $self["@key"];
  21771. },
  21772. args: [],
  21773. source: "key\x0a\x09^ key",
  21774. referencedClasses: [],
  21775. messageSends: []
  21776. }),
  21777. $globals.Setting);
  21778. $core.addMethod(
  21779. $core.method({
  21780. selector: "key:",
  21781. protocol: "accessing",
  21782. fn: function (aString){
  21783. var self=this,$self=this;
  21784. $self["@key"]=aString;
  21785. return self;
  21786. },
  21787. args: ["aString"],
  21788. source: "key: aString\x0a\x09key := aString",
  21789. referencedClasses: [],
  21790. messageSends: []
  21791. }),
  21792. $globals.Setting);
  21793. $core.addMethod(
  21794. $core.method({
  21795. selector: "value",
  21796. protocol: "accessing",
  21797. fn: function (){
  21798. var self=this,$self=this;
  21799. return $core.withContext(function($ctx1) {
  21800. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  21801. return $core.withContext(function($ctx2) {
  21802. return $self._defaultValue();
  21803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21804. }));
  21805. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  21806. },
  21807. args: [],
  21808. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  21809. referencedClasses: ["Smalltalk"],
  21810. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  21811. }),
  21812. $globals.Setting);
  21813. $core.addMethod(
  21814. $core.method({
  21815. selector: "value:",
  21816. protocol: "accessing",
  21817. fn: function (aStringifiableObject){
  21818. var self=this,$self=this;
  21819. return $core.withContext(function($ctx1) {
  21820. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  21821. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  21822. },
  21823. args: ["aStringifiableObject"],
  21824. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  21825. referencedClasses: ["Smalltalk"],
  21826. messageSends: ["at:put:", "settings", "key"]
  21827. }),
  21828. $globals.Setting);
  21829. $core.addMethod(
  21830. $core.method({
  21831. selector: "at:ifAbsent:",
  21832. protocol: "instance creation",
  21833. fn: function (aString,aDefaultValue){
  21834. var self=this,$self=this;
  21835. return $core.withContext(function($ctx1) {
  21836. var $1;
  21837. $1=(
  21838. $ctx1.supercall = true,
  21839. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  21840. $ctx1.supercall = false;
  21841. $recv($1)._key_(aString);
  21842. $recv($1)._defaultValue_(aDefaultValue);
  21843. return $recv($1)._yourself();
  21844. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  21845. },
  21846. args: ["aString", "aDefaultValue"],
  21847. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  21848. referencedClasses: [],
  21849. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  21850. }),
  21851. $globals.Setting.a$cls);
  21852. $core.addMethod(
  21853. $core.method({
  21854. selector: "new",
  21855. protocol: "instance creation",
  21856. fn: function (){
  21857. var self=this,$self=this;
  21858. return $core.withContext(function($ctx1) {
  21859. $self._shouldNotImplement();
  21860. return self;
  21861. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  21862. },
  21863. args: [],
  21864. source: "new\x0a\x09self shouldNotImplement",
  21865. referencedClasses: [],
  21866. messageSends: ["shouldNotImplement"]
  21867. }),
  21868. $globals.Setting.a$cls);
  21869. $core.addClass("SmalltalkImage", $globals.Object, [], "Kernel-Infrastructure");
  21870. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\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- `#globals #at:` answers a specific global (usually, a 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 `support/parser.js` parser file in order to work.";
  21871. $core.addMethod(
  21872. $core.method({
  21873. selector: "addGlobalJsVariable:",
  21874. protocol: "globals",
  21875. fn: function (aString){
  21876. var self=this,$self=this;
  21877. return $core.withContext(function($ctx1) {
  21878. $recv($self._globalJsVariables())._add_(aString);
  21879. return self;
  21880. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  21881. },
  21882. args: ["aString"],
  21883. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  21884. referencedClasses: [],
  21885. messageSends: ["add:", "globalJsVariables"]
  21886. }),
  21887. $globals.SmalltalkImage);
  21888. $core.addMethod(
  21889. $core.method({
  21890. selector: "amdRequire",
  21891. protocol: "accessing amd",
  21892. fn: function (){
  21893. var self=this,$self=this;
  21894. return $core.withContext(function($ctx1) {
  21895. return $recv($self._core())._at_("amdRequire");
  21896. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  21897. },
  21898. args: [],
  21899. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  21900. referencedClasses: [],
  21901. messageSends: ["at:", "core"]
  21902. }),
  21903. $globals.SmalltalkImage);
  21904. $core.addMethod(
  21905. $core.method({
  21906. selector: "asSmalltalkException:",
  21907. protocol: "error handling",
  21908. fn: function (anObject){
  21909. var self=this,$self=this;
  21910. return $core.withContext(function($ctx1) {
  21911. var $1;
  21912. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  21913. return $core.withContext(function($ctx2) {
  21914. return $recv(anObject)._isKindOf_($globals.Error);
  21915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21916. }));
  21917. if($core.assert($1)){
  21918. return anObject;
  21919. } else {
  21920. return $recv($globals.JavaScriptException)._on_(anObject);
  21921. }
  21922. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  21923. },
  21924. args: ["anObject"],
  21925. 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 ]",
  21926. referencedClasses: ["Error", "JavaScriptException"],
  21927. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  21928. }),
  21929. $globals.SmalltalkImage);
  21930. $core.addMethod(
  21931. $core.method({
  21932. selector: "basicCreatePackage:",
  21933. protocol: "private",
  21934. fn: function (packageName){
  21935. var self=this,$self=this;
  21936. return $core.withContext(function($ctx1) {
  21937. return $core.addPackage(packageName);
  21938. return self;
  21939. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  21940. },
  21941. args: ["packageName"],
  21942. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<inlineJS: 'return $core.addPackage(packageName)'>",
  21943. referencedClasses: [],
  21944. messageSends: []
  21945. }),
  21946. $globals.SmalltalkImage);
  21947. $core.addMethod(
  21948. $core.method({
  21949. selector: "basicParse:",
  21950. protocol: "private",
  21951. fn: function (aString){
  21952. var self=this,$self=this;
  21953. return $core.withContext(function($ctx1) {
  21954. return $recv($globals.SmalltalkParser)._parse_(aString);
  21955. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  21956. },
  21957. args: ["aString"],
  21958. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  21959. referencedClasses: ["SmalltalkParser"],
  21960. messageSends: ["parse:"]
  21961. }),
  21962. $globals.SmalltalkImage);
  21963. $core.addMethod(
  21964. $core.method({
  21965. selector: "basicRegisterPackage:",
  21966. protocol: "private",
  21967. fn: function (aPackage){
  21968. var self=this,$self=this;
  21969. return $core.withContext(function($ctx1) {
  21970. $core.packages[aPackage.pkgName]=aPackage;
  21971. return self;
  21972. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  21973. },
  21974. args: ["aPackage"],
  21975. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<inlineJS: '$core.packages[aPackage.pkgName]=aPackage'>",
  21976. referencedClasses: [],
  21977. messageSends: []
  21978. }),
  21979. $globals.SmalltalkImage);
  21980. $core.addMethod(
  21981. $core.method({
  21982. selector: "cancelOptOut:",
  21983. protocol: "accessing",
  21984. fn: function (anObject){
  21985. var self=this,$self=this;
  21986. return $core.withContext(function($ctx1) {
  21987. delete anObject.klass; delete anObject.a$cls;;
  21988. return self;
  21989. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  21990. },
  21991. args: ["anObject"],
  21992. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.klass; delete anObject.a$cls;'>",
  21993. referencedClasses: [],
  21994. messageSends: []
  21995. }),
  21996. $globals.SmalltalkImage);
  21997. $core.addMethod(
  21998. $core.method({
  21999. selector: "classes",
  22000. protocol: "classes",
  22001. fn: function (){
  22002. var self=this,$self=this;
  22003. return $core.withContext(function($ctx1) {
  22004. return $core.classes();
  22005. return self;
  22006. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  22007. },
  22008. args: [],
  22009. source: "classes\x0a\x09<inlineJS: 'return $core.classes()'>",
  22010. referencedClasses: [],
  22011. messageSends: []
  22012. }),
  22013. $globals.SmalltalkImage);
  22014. $core.addMethod(
  22015. $core.method({
  22016. selector: "core",
  22017. protocol: "accessing",
  22018. fn: function (){
  22019. var self=this,$self=this;
  22020. return $core.withContext(function($ctx1) {
  22021. return $core;
  22022. return self;
  22023. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  22024. },
  22025. args: [],
  22026. source: "core\x0a\x09<inlineJS: 'return $core'>",
  22027. referencedClasses: [],
  22028. messageSends: []
  22029. }),
  22030. $globals.SmalltalkImage);
  22031. $core.addMethod(
  22032. $core.method({
  22033. selector: "createPackage:",
  22034. protocol: "packages",
  22035. fn: function (packageName){
  22036. var self=this,$self=this;
  22037. var package_,announcement;
  22038. return $core.withContext(function($ctx1) {
  22039. var $1;
  22040. package_=$self._basicCreatePackage_(packageName);
  22041. $1=$recv($globals.PackageAdded)._new();
  22042. $recv($1)._package_(package_);
  22043. announcement=$recv($1)._yourself();
  22044. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  22045. return package_;
  22046. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  22047. },
  22048. args: ["packageName"],
  22049. source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
  22050. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  22051. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  22052. }),
  22053. $globals.SmalltalkImage);
  22054. $core.addMethod(
  22055. $core.method({
  22056. selector: "defaultAmdNamespace",
  22057. protocol: "accessing amd",
  22058. fn: function (){
  22059. var self=this,$self=this;
  22060. return $core.withContext(function($ctx1) {
  22061. return "transport.defaultAmdNamespace"._settingValue();
  22062. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  22063. },
  22064. args: [],
  22065. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  22066. referencedClasses: [],
  22067. messageSends: ["settingValue"]
  22068. }),
  22069. $globals.SmalltalkImage);
  22070. $core.addMethod(
  22071. $core.method({
  22072. selector: "defaultAmdNamespace:",
  22073. protocol: "accessing amd",
  22074. fn: function (aString){
  22075. var self=this,$self=this;
  22076. return $core.withContext(function($ctx1) {
  22077. "transport.defaultAmdNamespace"._settingValue_(aString);
  22078. return self;
  22079. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  22080. },
  22081. args: ["aString"],
  22082. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  22083. referencedClasses: [],
  22084. messageSends: ["settingValue:"]
  22085. }),
  22086. $globals.SmalltalkImage);
  22087. $core.addMethod(
  22088. $core.method({
  22089. selector: "deleteClass:",
  22090. protocol: "private",
  22091. fn: function (aClass){
  22092. var self=this,$self=this;
  22093. return $core.withContext(function($ctx1) {
  22094. $core.removeClass(aClass);
  22095. return self;
  22096. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  22097. },
  22098. args: ["aClass"],
  22099. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  22100. referencedClasses: [],
  22101. messageSends: []
  22102. }),
  22103. $globals.SmalltalkImage);
  22104. $core.addMethod(
  22105. $core.method({
  22106. selector: "deleteGlobalJsVariable:",
  22107. protocol: "globals",
  22108. fn: function (aString){
  22109. var self=this,$self=this;
  22110. return $core.withContext(function($ctx1) {
  22111. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  22112. }));
  22113. return self;
  22114. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  22115. },
  22116. args: ["aString"],
  22117. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  22118. referencedClasses: [],
  22119. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  22120. }),
  22121. $globals.SmalltalkImage);
  22122. $core.addMethod(
  22123. $core.method({
  22124. selector: "deletePackage:",
  22125. protocol: "private",
  22126. fn: function (packageName){
  22127. var self=this,$self=this;
  22128. return $core.withContext(function($ctx1) {
  22129. delete $core.packages[packageName];
  22130. return self;
  22131. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  22132. },
  22133. args: ["packageName"],
  22134. 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<inlineJS: 'delete $core.packages[packageName]'>",
  22135. referencedClasses: [],
  22136. messageSends: []
  22137. }),
  22138. $globals.SmalltalkImage);
  22139. $core.addMethod(
  22140. $core.method({
  22141. selector: "existsJsGlobal:",
  22142. protocol: "testing",
  22143. fn: function (aString){
  22144. var self=this,$self=this;
  22145. return $core.withContext(function($ctx1) {
  22146. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22147. return true;
  22148. }),(function(){
  22149. return false;
  22150. }));
  22151. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  22152. },
  22153. args: ["aString"],
  22154. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  22155. referencedClasses: ["Platform"],
  22156. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  22157. }),
  22158. $globals.SmalltalkImage);
  22159. $core.addMethod(
  22160. $core.method({
  22161. selector: "globalJsVariables",
  22162. protocol: "globals",
  22163. fn: function (){
  22164. var self=this,$self=this;
  22165. return $core.withContext(function($ctx1) {
  22166. return $core.globalJsVariables;
  22167. return self;
  22168. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  22169. },
  22170. args: [],
  22171. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<inlineJS: 'return $core.globalJsVariables'>",
  22172. referencedClasses: [],
  22173. messageSends: []
  22174. }),
  22175. $globals.SmalltalkImage);
  22176. $core.addMethod(
  22177. $core.method({
  22178. selector: "globals",
  22179. protocol: "accessing",
  22180. fn: function (){
  22181. var self=this,$self=this;
  22182. return $core.withContext(function($ctx1) {
  22183. return $globals;
  22184. return self;
  22185. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  22186. },
  22187. args: [],
  22188. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  22189. referencedClasses: [],
  22190. messageSends: []
  22191. }),
  22192. $globals.SmalltalkImage);
  22193. $core.addMethod(
  22194. $core.method({
  22195. selector: "includesKey:",
  22196. protocol: "accessing",
  22197. fn: function (aKey){
  22198. var self=this,$self=this;
  22199. return $core.withContext(function($ctx1) {
  22200. return $core.hasOwnProperty(aKey);
  22201. return self;
  22202. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  22203. },
  22204. args: ["aKey"],
  22205. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  22206. referencedClasses: [],
  22207. messageSends: []
  22208. }),
  22209. $globals.SmalltalkImage);
  22210. $core.addMethod(
  22211. $core.method({
  22212. selector: "isSmalltalkObject:",
  22213. protocol: "testing",
  22214. fn: function (anObject){
  22215. var self=this,$self=this;
  22216. return $core.withContext(function($ctx1) {
  22217. return anObject.a$cls != null;
  22218. return self;
  22219. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  22220. },
  22221. args: ["anObject"],
  22222. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'a$cls' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null'>",
  22223. referencedClasses: [],
  22224. messageSends: []
  22225. }),
  22226. $globals.SmalltalkImage);
  22227. $core.addMethod(
  22228. $core.method({
  22229. selector: "optOut:",
  22230. protocol: "accessing",
  22231. fn: function (anObject){
  22232. var self=this,$self=this;
  22233. return $core.withContext(function($ctx1) {
  22234. anObject.klass = null; anObject.a$cls = null;
  22235. return self;
  22236. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  22237. },
  22238. args: ["anObject"],
  22239. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.klass = null; anObject.a$cls = null'>",
  22240. referencedClasses: [],
  22241. messageSends: []
  22242. }),
  22243. $globals.SmalltalkImage);
  22244. $core.addMethod(
  22245. $core.method({
  22246. selector: "packageAt:",
  22247. protocol: "packages",
  22248. fn: function (packageName){
  22249. var self=this,$self=this;
  22250. return $core.withContext(function($ctx1) {
  22251. return $core.packages[packageName];
  22252. return self;
  22253. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  22254. },
  22255. args: ["packageName"],
  22256. source: "packageAt: packageName\x0a\x09<inlineJS: 'return $core.packages[packageName]'>",
  22257. referencedClasses: [],
  22258. messageSends: []
  22259. }),
  22260. $globals.SmalltalkImage);
  22261. $core.addMethod(
  22262. $core.method({
  22263. selector: "packageAt:ifAbsent:",
  22264. protocol: "packages",
  22265. fn: function (packageName,aBlock){
  22266. var self=this,$self=this;
  22267. return $core.withContext(function($ctx1) {
  22268. var $1;
  22269. $1=$self._packageAt_(packageName);
  22270. return $recv($1)._ifNil_(aBlock);
  22271. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  22272. },
  22273. args: ["packageName", "aBlock"],
  22274. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  22275. referencedClasses: [],
  22276. messageSends: ["ifNil:", "packageAt:"]
  22277. }),
  22278. $globals.SmalltalkImage);
  22279. $core.addMethod(
  22280. $core.method({
  22281. selector: "packages",
  22282. protocol: "packages",
  22283. fn: function (){
  22284. var self=this,$self=this;
  22285. return $core.withContext(function($ctx1) {
  22286. return Object.keys($core.packages).map(function(k) {
  22287. return $core.packages[k];
  22288. })
  22289. ;
  22290. return self;
  22291. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  22292. },
  22293. args: [],
  22294. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<inlineJS: '\x0a\x09\x09return Object.keys($core.packages).map(function(k) {\x0a\x09\x09\x09return $core.packages[k];\x0a\x09\x09})\x0a\x09'>",
  22295. referencedClasses: [],
  22296. messageSends: []
  22297. }),
  22298. $globals.SmalltalkImage);
  22299. $core.addMethod(
  22300. $core.method({
  22301. selector: "parse:",
  22302. protocol: "accessing",
  22303. fn: function (aString){
  22304. var self=this,$self=this;
  22305. var result;
  22306. return $core.withContext(function($ctx1) {
  22307. var $1;
  22308. $recv((function(){
  22309. return $core.withContext(function($ctx2) {
  22310. result=$self._basicParse_(aString);
  22311. return result;
  22312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22313. }))._tryCatch_((function(ex){
  22314. return $core.withContext(function($ctx2) {
  22315. return $recv($self._parseError_parsing_(ex,aString))._signal();
  22316. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  22317. }));
  22318. $1=result;
  22319. $recv($1)._source_(aString);
  22320. return $recv($1)._yourself();
  22321. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  22322. },
  22323. args: ["aString"],
  22324. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09[ result := self basicParse: aString ] \x0a\x09\x09tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  22325. referencedClasses: [],
  22326. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  22327. }),
  22328. $globals.SmalltalkImage);
  22329. $core.addMethod(
  22330. $core.method({
  22331. selector: "parseError:parsing:",
  22332. protocol: "error handling",
  22333. fn: function (anException,aString){
  22334. var self=this,$self=this;
  22335. var pos;
  22336. return $core.withContext(function($ctx1) {
  22337. var $1,$2,$6,$5,$4,$3;
  22338. $1=$recv(anException)._basicAt_("location");
  22339. $ctx1.sendIdx["basicAt:"]=1;
  22340. pos=$recv($1)._start();
  22341. $2=$recv($globals.ParseError)._new();
  22342. $6=$recv("Parse error on line ".__comma($recv(pos)._line())).__comma(" column ");
  22343. $ctx1.sendIdx[","]=4;
  22344. $5=$recv($6).__comma($recv(pos)._column());
  22345. $ctx1.sendIdx[","]=3;
  22346. $4=$recv($5).__comma(" : Unexpected character ");
  22347. $ctx1.sendIdx[","]=2;
  22348. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  22349. $ctx1.sendIdx[","]=1;
  22350. return $recv($2)._messageText_($3);
  22351. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString,pos:pos},$globals.SmalltalkImage)});
  22352. },
  22353. args: ["anException", "aString"],
  22354. source: "parseError: anException parsing: aString\x0a\x09| pos |\x0a\x09pos := (anException basicAt: 'location') start.\x0a\x09^ ParseError new messageText: 'Parse error on line ', pos line ,' column ' , pos column ,' : Unexpected character ', (anException basicAt: 'found')",
  22355. referencedClasses: ["ParseError"],
  22356. messageSends: ["start", "basicAt:", "messageText:", "new", ",", "line", "column"]
  22357. }),
  22358. $globals.SmalltalkImage);
  22359. $core.addMethod(
  22360. $core.method({
  22361. selector: "pseudoVariableNames",
  22362. protocol: "accessing",
  22363. fn: function (){
  22364. var self=this,$self=this;
  22365. return ["self", "super", "nil", "true", "false", "thisContext"];
  22366. },
  22367. args: [],
  22368. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  22369. referencedClasses: [],
  22370. messageSends: []
  22371. }),
  22372. $globals.SmalltalkImage);
  22373. $core.addMethod(
  22374. $core.method({
  22375. selector: "readJSObject:",
  22376. protocol: "accessing",
  22377. fn: function (anObject){
  22378. var self=this,$self=this;
  22379. return $core.withContext(function($ctx1) {
  22380. return $core.readJSObject(anObject);
  22381. return self;
  22382. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  22383. },
  22384. args: ["anObject"],
  22385. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  22386. referencedClasses: [],
  22387. messageSends: []
  22388. }),
  22389. $globals.SmalltalkImage);
  22390. $core.addMethod(
  22391. $core.method({
  22392. selector: "removeClass:",
  22393. protocol: "classes",
  22394. fn: function (aClass){
  22395. var self=this,$self=this;
  22396. return $core.withContext(function($ctx1) {
  22397. var $1,$2,$5,$4,$6,$3,$7,$9,$8;
  22398. $1=$recv(aClass)._isMetaclass();
  22399. if($core.assert($1)){
  22400. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  22401. $ctx1.sendIdx[","]=1;
  22402. $self._error_($2);
  22403. $ctx1.sendIdx["error:"]=1;
  22404. }
  22405. $recv(aClass)._allSubclassesDo_((function(subclass){
  22406. return $core.withContext(function($ctx2) {
  22407. $5=$recv(aClass)._name();
  22408. $ctx2.sendIdx["name"]=1;
  22409. $4=$recv($5).__comma(" has a subclass: ");
  22410. $ctx2.sendIdx[","]=3;
  22411. $6=$recv(subclass)._name();
  22412. $ctx2.sendIdx["name"]=2;
  22413. $3=$recv($4).__comma($6);
  22414. $ctx2.sendIdx[","]=2;
  22415. return $self._error_($3);
  22416. $ctx2.sendIdx["error:"]=2;
  22417. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  22418. }));
  22419. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  22420. return $core.withContext(function($ctx2) {
  22421. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  22422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  22423. }));
  22424. $self._deleteClass_(aClass);
  22425. $recv(aClass)._setTraitComposition_([]);
  22426. $ctx1.sendIdx["setTraitComposition:"]=1;
  22427. $recv($recv(aClass)._class())._setTraitComposition_([]);
  22428. $7=$recv($globals.SystemAnnouncer)._current();
  22429. $9=$recv($globals.ClassRemoved)._new();
  22430. $recv($9)._theClass_(aClass);
  22431. $8=$recv($9)._yourself();
  22432. $recv($7)._announce_($8);
  22433. return self;
  22434. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  22435. },
  22436. args: ["aClass"],
  22437. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09aClass allSubclassesDo: [ :subclass | self error: aClass name, ' has a subclass: ', subclass name ].\x0a\x09aClass traitUsers ifNotEmpty: [ self error: aClass name, ' has trait users.' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09aClass setTraitComposition: #().\x0a\x09aClass class setTraitComposition: #().\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  22438. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  22439. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "class", "announce:", "current", "theClass:", "new", "yourself"]
  22440. }),
  22441. $globals.SmalltalkImage);
  22442. $core.addMethod(
  22443. $core.method({
  22444. selector: "removePackage:",
  22445. protocol: "packages",
  22446. fn: function (packageName){
  22447. var self=this,$self=this;
  22448. var pkg;
  22449. return $core.withContext(function($ctx1) {
  22450. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  22451. return $core.withContext(function($ctx2) {
  22452. return $self._error_("Missing package: ".__comma(packageName));
  22453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22454. }));
  22455. $recv($recv(pkg)._classes())._do_((function(each){
  22456. return $core.withContext(function($ctx2) {
  22457. return $self._removeClass_(each);
  22458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22459. }));
  22460. $self._deletePackage_(packageName);
  22461. return self;
  22462. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  22463. },
  22464. args: ["packageName"],
  22465. 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",
  22466. referencedClasses: [],
  22467. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  22468. }),
  22469. $globals.SmalltalkImage);
  22470. $core.addMethod(
  22471. $core.method({
  22472. selector: "renamePackage:to:",
  22473. protocol: "packages",
  22474. fn: function (packageName,newName){
  22475. var self=this,$self=this;
  22476. var pkg;
  22477. return $core.withContext(function($ctx1) {
  22478. var $1,$2,$receiver;
  22479. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  22480. return $core.withContext(function($ctx2) {
  22481. $1="Missing package: ".__comma(packageName);
  22482. $ctx2.sendIdx[","]=1;
  22483. return $self._error_($1);
  22484. $ctx2.sendIdx["error:"]=1;
  22485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22486. }));
  22487. $2=$self._packageAt_(newName);
  22488. if(($receiver = $2) == null || $receiver.a$nil){
  22489. $2;
  22490. } else {
  22491. $self._error_("Already exists a package called: ".__comma(newName));
  22492. }
  22493. $recv(pkg)._name_(newName);
  22494. $self._basicRegisterPackage_(pkg);
  22495. $self._deletePackage_(packageName);
  22496. return self;
  22497. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  22498. },
  22499. args: ["packageName", "newName"],
  22500. 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\x09pkg name: newName.\x0a\x09self basicRegisterPackage: pkg.\x0a\x09self deletePackage: packageName.",
  22501. referencedClasses: [],
  22502. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  22503. }),
  22504. $globals.SmalltalkImage);
  22505. $core.addMethod(
  22506. $core.method({
  22507. selector: "reservedWords",
  22508. protocol: "accessing",
  22509. fn: function (){
  22510. var self=this,$self=this;
  22511. return $core.withContext(function($ctx1) {
  22512. return $core.reservedWords;
  22513. return self;
  22514. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  22515. },
  22516. args: [],
  22517. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<inlineJS: 'return $core.reservedWords'>",
  22518. referencedClasses: [],
  22519. messageSends: []
  22520. }),
  22521. $globals.SmalltalkImage);
  22522. $core.addMethod(
  22523. $core.method({
  22524. selector: "settings",
  22525. protocol: "accessing",
  22526. fn: function (){
  22527. var self=this,$self=this;
  22528. return $globals.SmalltalkSettings;
  22529. },
  22530. args: [],
  22531. source: "settings\x0a\x09^ SmalltalkSettings",
  22532. referencedClasses: ["SmalltalkSettings"],
  22533. messageSends: []
  22534. }),
  22535. $globals.SmalltalkImage);
  22536. $core.addMethod(
  22537. $core.method({
  22538. selector: "version",
  22539. protocol: "accessing",
  22540. fn: function (){
  22541. var self=this,$self=this;
  22542. return "0.19.0";
  22543. },
  22544. args: [],
  22545. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.19.0'",
  22546. referencedClasses: [],
  22547. messageSends: []
  22548. }),
  22549. $globals.SmalltalkImage);
  22550. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  22551. $core.addMethod(
  22552. $core.method({
  22553. selector: "current",
  22554. protocol: "instance creation",
  22555. fn: function (){
  22556. var self=this,$self=this;
  22557. return $core.withContext(function($ctx1) {
  22558. var $1,$receiver;
  22559. $1=$self["@current"];
  22560. if(($receiver = $1) == null || $receiver.a$nil){
  22561. $self["@current"]=(
  22562. $ctx1.supercall = true,
  22563. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  22564. $ctx1.supercall = false;
  22565. return $self["@current"];
  22566. } else {
  22567. $self._deprecatedAPI();
  22568. return $self["@current"];
  22569. }
  22570. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  22571. },
  22572. args: [],
  22573. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  22574. referencedClasses: [],
  22575. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  22576. }),
  22577. $globals.SmalltalkImage.a$cls);
  22578. $core.addMethod(
  22579. $core.method({
  22580. selector: "initialize",
  22581. protocol: "initialization",
  22582. fn: function (){
  22583. var self=this,$self=this;
  22584. var st;
  22585. return $core.withContext(function($ctx1) {
  22586. st=$self._current();
  22587. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  22588. return self;
  22589. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  22590. },
  22591. args: [],
  22592. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  22593. referencedClasses: [],
  22594. messageSends: ["current", "at:put:", "globals"]
  22595. }),
  22596. $globals.SmalltalkImage.a$cls);
  22597. $core.addMethod(
  22598. $core.method({
  22599. selector: "new",
  22600. protocol: "instance creation",
  22601. fn: function (){
  22602. var self=this,$self=this;
  22603. return $core.withContext(function($ctx1) {
  22604. $self._shouldNotImplement();
  22605. return self;
  22606. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  22607. },
  22608. args: [],
  22609. source: "new\x0a\x09self shouldNotImplement",
  22610. referencedClasses: [],
  22611. messageSends: ["shouldNotImplement"]
  22612. }),
  22613. $globals.SmalltalkImage.a$cls);
  22614. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  22615. $core.addMethod(
  22616. $core.method({
  22617. selector: "nextPutJSObject:",
  22618. protocol: "*Kernel-Infrastructure",
  22619. fn: function (aJSObject){
  22620. var self=this,$self=this;
  22621. return $core.withContext(function($ctx1) {
  22622. $self._nextPut_(aJSObject);
  22623. return self;
  22624. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  22625. },
  22626. args: ["aJSObject"],
  22627. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  22628. referencedClasses: [],
  22629. messageSends: ["nextPut:"]
  22630. }),
  22631. $globals.ProtoStream);
  22632. $core.addMethod(
  22633. $core.method({
  22634. selector: "asJavaScriptPropertyName",
  22635. protocol: "*Kernel-Infrastructure",
  22636. fn: function (){
  22637. var self=this,$self=this;
  22638. return $core.withContext(function($ctx1) {
  22639. return $core.st2prop(self);
  22640. return self;
  22641. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  22642. },
  22643. args: [],
  22644. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  22645. referencedClasses: [],
  22646. messageSends: []
  22647. }),
  22648. $globals.String);
  22649. $core.addMethod(
  22650. $core.method({
  22651. selector: "asSetting",
  22652. protocol: "*Kernel-Infrastructure",
  22653. fn: function (){
  22654. var self=this,$self=this;
  22655. return $core.withContext(function($ctx1) {
  22656. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  22657. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  22658. },
  22659. args: [],
  22660. source: "asSetting\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Nil will be the default value.\x22\x0a\x09^ Setting at: self ifAbsent: nil",
  22661. referencedClasses: ["Setting"],
  22662. messageSends: ["at:ifAbsent:"]
  22663. }),
  22664. $globals.String);
  22665. $core.addMethod(
  22666. $core.method({
  22667. selector: "asSettingIfAbsent:",
  22668. protocol: "*Kernel-Infrastructure",
  22669. fn: function (aDefaultValue){
  22670. var self=this,$self=this;
  22671. return $core.withContext(function($ctx1) {
  22672. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  22673. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  22674. },
  22675. args: ["aDefaultValue"],
  22676. source: "asSettingIfAbsent: aDefaultValue\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Make this setting to have aDefaultValue.\x22\x0a\x09^ Setting at: self ifAbsent: aDefaultValue",
  22677. referencedClasses: ["Setting"],
  22678. messageSends: ["at:ifAbsent:"]
  22679. }),
  22680. $globals.String);
  22681. $core.addMethod(
  22682. $core.method({
  22683. selector: "settingValue",
  22684. protocol: "*Kernel-Infrastructure",
  22685. fn: function (){
  22686. var self=this,$self=this;
  22687. return $core.withContext(function($ctx1) {
  22688. return $recv($self._asSetting())._value();
  22689. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  22690. },
  22691. args: [],
  22692. source: "settingValue\x0a\x09^ self asSetting value",
  22693. referencedClasses: [],
  22694. messageSends: ["value", "asSetting"]
  22695. }),
  22696. $globals.String);
  22697. $core.addMethod(
  22698. $core.method({
  22699. selector: "settingValue:",
  22700. protocol: "*Kernel-Infrastructure",
  22701. fn: function (aValue){
  22702. var self=this,$self=this;
  22703. return $core.withContext(function($ctx1) {
  22704. return $recv($self._asSetting())._value_(aValue);
  22705. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  22706. },
  22707. args: ["aValue"],
  22708. source: "settingValue: aValue\x0a\x09\x22Sets the value of the setting that will be locally stored using this string as key.\x0a\x09Note that aValue can be any object that can be stringifyed\x22\x0a\x09^ self asSetting value: aValue",
  22709. referencedClasses: [],
  22710. messageSends: ["value:", "asSetting"]
  22711. }),
  22712. $globals.String);
  22713. $core.addMethod(
  22714. $core.method({
  22715. selector: "settingValueIfAbsent:",
  22716. protocol: "*Kernel-Infrastructure",
  22717. fn: function (aDefaultValue){
  22718. var self=this,$self=this;
  22719. return $core.withContext(function($ctx1) {
  22720. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  22721. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  22722. },
  22723. args: ["aDefaultValue"],
  22724. source: "settingValueIfAbsent: aDefaultValue\x0a\x09\x22Answer the value of the locally stored setting using this string as key.\x0a\x09Use aDefaultValue in case no setting is found\x22\x0a\x09^ (self asSettingIfAbsent: aDefaultValue) value",
  22725. referencedClasses: [],
  22726. messageSends: ["value", "asSettingIfAbsent:"]
  22727. }),
  22728. $globals.String);
  22729. });
  22730. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  22731. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  22732. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  22733. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  22734. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  22735. $core.addPackage("Kernel-Announcements");
  22736. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  22737. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  22738. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  22739. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  22740. $core.addMethod(
  22741. $core.method({
  22742. selector: "announcementClass",
  22743. protocol: "accessing",
  22744. fn: function (){
  22745. var self=this,$self=this;
  22746. return $self["@announcementClass"];
  22747. },
  22748. args: [],
  22749. source: "announcementClass\x0a\x09^ announcementClass",
  22750. referencedClasses: [],
  22751. messageSends: []
  22752. }),
  22753. $globals.AnnouncementSubscription);
  22754. $core.addMethod(
  22755. $core.method({
  22756. selector: "announcementClass:",
  22757. protocol: "accessing",
  22758. fn: function (aClass){
  22759. var self=this,$self=this;
  22760. $self["@announcementClass"]=aClass;
  22761. return self;
  22762. },
  22763. args: ["aClass"],
  22764. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  22765. referencedClasses: [],
  22766. messageSends: []
  22767. }),
  22768. $globals.AnnouncementSubscription);
  22769. $core.addMethod(
  22770. $core.method({
  22771. selector: "deliver:",
  22772. protocol: "announcing",
  22773. fn: function (anAnnouncement){
  22774. var self=this,$self=this;
  22775. return $core.withContext(function($ctx1) {
  22776. var $1;
  22777. $1=$self._handlesAnnouncement_(anAnnouncement);
  22778. if($core.assert($1)){
  22779. $recv($self._valuable())._value_(anAnnouncement);
  22780. }
  22781. return self;
  22782. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  22783. },
  22784. args: ["anAnnouncement"],
  22785. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  22786. referencedClasses: [],
  22787. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  22788. }),
  22789. $globals.AnnouncementSubscription);
  22790. $core.addMethod(
  22791. $core.method({
  22792. selector: "handlesAnnouncement:",
  22793. protocol: "announcing",
  22794. fn: function (anAnnouncement){
  22795. var self=this,$self=this;
  22796. return $core.withContext(function($ctx1) {
  22797. var $2,$3,$1,$receiver;
  22798. $2=$recv($globals.Smalltalk)._globals();
  22799. $ctx1.sendIdx["globals"]=1;
  22800. $3=$recv($self._announcementClass())._name();
  22801. $ctx1.sendIdx["name"]=1;
  22802. $1=$recv($2)._at_($3);
  22803. $ctx1.sendIdx["at:"]=1;
  22804. if(($receiver = $1) == null || $receiver.a$nil){
  22805. return false;
  22806. } else {
  22807. var class_;
  22808. class_=$receiver;
  22809. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  22810. }
  22811. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  22812. },
  22813. args: ["anAnnouncement"],
  22814. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  22815. referencedClasses: ["Smalltalk"],
  22816. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  22817. }),
  22818. $globals.AnnouncementSubscription);
  22819. $core.addMethod(
  22820. $core.method({
  22821. selector: "receiver",
  22822. protocol: "accessing",
  22823. fn: function (){
  22824. var self=this,$self=this;
  22825. return $core.withContext(function($ctx1) {
  22826. return $recv($self._valuable())._receiver();
  22827. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  22828. },
  22829. args: [],
  22830. source: "receiver\x0a\x09^ self valuable receiver",
  22831. referencedClasses: [],
  22832. messageSends: ["receiver", "valuable"]
  22833. }),
  22834. $globals.AnnouncementSubscription);
  22835. $core.addMethod(
  22836. $core.method({
  22837. selector: "valuable",
  22838. protocol: "accessing",
  22839. fn: function (){
  22840. var self=this,$self=this;
  22841. return $self["@valuable"];
  22842. },
  22843. args: [],
  22844. source: "valuable\x0a\x09^ valuable",
  22845. referencedClasses: [],
  22846. messageSends: []
  22847. }),
  22848. $globals.AnnouncementSubscription);
  22849. $core.addMethod(
  22850. $core.method({
  22851. selector: "valuable:",
  22852. protocol: "accessing",
  22853. fn: function (aValuable){
  22854. var self=this,$self=this;
  22855. $self["@valuable"]=aValuable;
  22856. return self;
  22857. },
  22858. args: ["aValuable"],
  22859. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  22860. referencedClasses: [],
  22861. messageSends: []
  22862. }),
  22863. $globals.AnnouncementSubscription);
  22864. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  22865. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  22866. $core.addMethod(
  22867. $core.method({
  22868. selector: "receiver",
  22869. protocol: "accessing",
  22870. fn: function (){
  22871. var self=this,$self=this;
  22872. return $self["@receiver"];
  22873. },
  22874. args: [],
  22875. source: "receiver\x0a\x09^ receiver",
  22876. referencedClasses: [],
  22877. messageSends: []
  22878. }),
  22879. $globals.AnnouncementValuable);
  22880. $core.addMethod(
  22881. $core.method({
  22882. selector: "receiver:",
  22883. protocol: "accessing",
  22884. fn: function (anObject){
  22885. var self=this,$self=this;
  22886. $self["@receiver"]=anObject;
  22887. return self;
  22888. },
  22889. args: ["anObject"],
  22890. source: "receiver: anObject\x0a\x09receiver := anObject",
  22891. referencedClasses: [],
  22892. messageSends: []
  22893. }),
  22894. $globals.AnnouncementValuable);
  22895. $core.addMethod(
  22896. $core.method({
  22897. selector: "valuable",
  22898. protocol: "accessing",
  22899. fn: function (){
  22900. var self=this,$self=this;
  22901. return $self["@valuable"];
  22902. },
  22903. args: [],
  22904. source: "valuable\x0a\x09^ valuable",
  22905. referencedClasses: [],
  22906. messageSends: []
  22907. }),
  22908. $globals.AnnouncementValuable);
  22909. $core.addMethod(
  22910. $core.method({
  22911. selector: "valuable:",
  22912. protocol: "accessing",
  22913. fn: function (anObject){
  22914. var self=this,$self=this;
  22915. $self["@valuable"]=anObject;
  22916. return self;
  22917. },
  22918. args: ["anObject"],
  22919. source: "valuable: anObject\x0a\x09valuable := anObject",
  22920. referencedClasses: [],
  22921. messageSends: []
  22922. }),
  22923. $globals.AnnouncementValuable);
  22924. $core.addMethod(
  22925. $core.method({
  22926. selector: "value",
  22927. protocol: "evaluating",
  22928. fn: function (){
  22929. var self=this,$self=this;
  22930. return $core.withContext(function($ctx1) {
  22931. return $recv($self._valuable())._value();
  22932. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  22933. },
  22934. args: [],
  22935. source: "value\x0a\x09^ self valuable value",
  22936. referencedClasses: [],
  22937. messageSends: ["value", "valuable"]
  22938. }),
  22939. $globals.AnnouncementValuable);
  22940. $core.addMethod(
  22941. $core.method({
  22942. selector: "value:",
  22943. protocol: "evaluating",
  22944. fn: function (anObject){
  22945. var self=this,$self=this;
  22946. return $core.withContext(function($ctx1) {
  22947. return $recv($self._valuable())._value_(anObject);
  22948. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  22949. },
  22950. args: ["anObject"],
  22951. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  22952. referencedClasses: [],
  22953. messageSends: ["value:", "valuable"]
  22954. }),
  22955. $globals.AnnouncementValuable);
  22956. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  22957. $globals.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' ].";
  22958. $core.addMethod(
  22959. $core.method({
  22960. selector: "announce:",
  22961. protocol: "announcing",
  22962. fn: function (anAnnouncement){
  22963. var self=this,$self=this;
  22964. return $core.withContext(function($ctx1) {
  22965. $recv($self["@subscriptions"])._do_((function(each){
  22966. return $core.withContext(function($ctx2) {
  22967. return $recv(each)._deliver_(anAnnouncement);
  22968. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22969. }));
  22970. return self;
  22971. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  22972. },
  22973. args: ["anAnnouncement"],
  22974. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  22975. referencedClasses: [],
  22976. messageSends: ["do:", "deliver:"]
  22977. }),
  22978. $globals.Announcer);
  22979. $core.addMethod(
  22980. $core.method({
  22981. selector: "initialize",
  22982. protocol: "initialization",
  22983. fn: function (){
  22984. var self=this,$self=this;
  22985. return $core.withContext(function($ctx1) {
  22986. (
  22987. $ctx1.supercall = true,
  22988. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22989. $ctx1.supercall = false;
  22990. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  22991. return self;
  22992. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  22993. },
  22994. args: [],
  22995. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  22996. referencedClasses: ["OrderedCollection"],
  22997. messageSends: ["initialize", "new"]
  22998. }),
  22999. $globals.Announcer);
  23000. $core.addMethod(
  23001. $core.method({
  23002. selector: "on:do:",
  23003. protocol: "subscribing",
  23004. fn: function (aClass,aBlock){
  23005. var self=this,$self=this;
  23006. return $core.withContext(function($ctx1) {
  23007. $self._on_do_for_(aClass,aBlock,nil);
  23008. return self;
  23009. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  23010. },
  23011. args: ["aClass", "aBlock"],
  23012. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  23013. referencedClasses: [],
  23014. messageSends: ["on:do:for:"]
  23015. }),
  23016. $globals.Announcer);
  23017. $core.addMethod(
  23018. $core.method({
  23019. selector: "on:do:for:",
  23020. protocol: "subscribing",
  23021. fn: function (aClass,aBlock,aReceiver){
  23022. var self=this,$self=this;
  23023. return $core.withContext(function($ctx1) {
  23024. var $1,$3,$5,$6,$4,$2;
  23025. $1=$self["@subscriptions"];
  23026. $3=$recv($globals.AnnouncementSubscription)._new();
  23027. $ctx1.sendIdx["new"]=1;
  23028. $5=$recv($globals.AnnouncementValuable)._new();
  23029. $recv($5)._valuable_(aBlock);
  23030. $recv($5)._receiver_(aReceiver);
  23031. $6=$recv($5)._yourself();
  23032. $ctx1.sendIdx["yourself"]=1;
  23033. $4=$6;
  23034. $recv($3)._valuable_($4);
  23035. $ctx1.sendIdx["valuable:"]=1;
  23036. $recv($3)._announcementClass_(aClass);
  23037. $2=$recv($3)._yourself();
  23038. $recv($1)._add_($2);
  23039. return self;
  23040. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  23041. },
  23042. args: ["aClass", "aBlock", "aReceiver"],
  23043. source: "on: aClass do: aBlock for: aReceiver\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (AnnouncementValuable new\x0a\x09\x09\x09valuable: aBlock;\x0a\x09\x09\x09receiver: aReceiver;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  23044. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  23045. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  23046. }),
  23047. $globals.Announcer);
  23048. $core.addMethod(
  23049. $core.method({
  23050. selector: "on:doOnce:",
  23051. protocol: "subscribing",
  23052. fn: function (aClass,aBlock){
  23053. var self=this,$self=this;
  23054. var subscription;
  23055. return $core.withContext(function($ctx1) {
  23056. var $1;
  23057. $1=$recv($globals.AnnouncementSubscription)._new();
  23058. $recv($1)._announcementClass_(aClass);
  23059. subscription=$recv($1)._yourself();
  23060. $recv(subscription)._valuable_((function(ann){
  23061. return $core.withContext(function($ctx2) {
  23062. $recv($self["@subscriptions"])._remove_(subscription);
  23063. return $recv(aBlock)._value_(ann);
  23064. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  23065. }));
  23066. $recv($self["@subscriptions"])._add_(subscription);
  23067. return self;
  23068. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  23069. },
  23070. args: ["aClass", "aBlock"],
  23071. source: "on: aClass doOnce: aBlock\x0a\x09| subscription |\x0a\x09\x0a\x09subscription := AnnouncementSubscription new\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself.\x0a\x09subscription valuable: [ :ann |\x0a\x09\x09subscriptions remove: subscription.\x0a\x09\x09aBlock value: ann ].\x0a\x0a\x09subscriptions add: subscription",
  23072. referencedClasses: ["AnnouncementSubscription"],
  23073. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  23074. }),
  23075. $globals.Announcer);
  23076. $core.addMethod(
  23077. $core.method({
  23078. selector: "on:send:to:",
  23079. protocol: "subscribing",
  23080. fn: function (aClass,aSelector,anObject){
  23081. var self=this,$self=this;
  23082. return $core.withContext(function($ctx1) {
  23083. var $1,$3,$5,$6,$4,$2;
  23084. $1=$self["@subscriptions"];
  23085. $3=$recv($globals.AnnouncementSubscription)._new();
  23086. $ctx1.sendIdx["new"]=1;
  23087. $5=$recv($globals.MessageSend)._new();
  23088. $recv($5)._receiver_(anObject);
  23089. $recv($5)._selector_(aSelector);
  23090. $6=$recv($5)._yourself();
  23091. $ctx1.sendIdx["yourself"]=1;
  23092. $4=$6;
  23093. $recv($3)._valuable_($4);
  23094. $recv($3)._announcementClass_(aClass);
  23095. $2=$recv($3)._yourself();
  23096. $recv($1)._add_($2);
  23097. return self;
  23098. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  23099. },
  23100. args: ["aClass", "aSelector", "anObject"],
  23101. 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)",
  23102. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  23103. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  23104. }),
  23105. $globals.Announcer);
  23106. $core.addMethod(
  23107. $core.method({
  23108. selector: "unsubscribe:",
  23109. protocol: "subscribing",
  23110. fn: function (anObject){
  23111. var self=this,$self=this;
  23112. return $core.withContext(function($ctx1) {
  23113. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  23114. return $core.withContext(function($ctx2) {
  23115. return $recv($recv(each)._receiver()).__eq(anObject);
  23116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23117. }));
  23118. return self;
  23119. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  23120. },
  23121. args: ["anObject"],
  23122. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  23123. referencedClasses: [],
  23124. messageSends: ["reject:", "=", "receiver"]
  23125. }),
  23126. $globals.Announcer);
  23127. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  23128. $globals.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`";
  23129. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  23130. $core.addMethod(
  23131. $core.method({
  23132. selector: "current",
  23133. protocol: "accessing",
  23134. fn: function (){
  23135. var self=this,$self=this;
  23136. return $core.withContext(function($ctx1) {
  23137. var $1,$receiver;
  23138. $1=$self["@current"];
  23139. if(($receiver = $1) == null || $receiver.a$nil){
  23140. $self["@current"]=(
  23141. $ctx1.supercall = true,
  23142. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23143. $ctx1.supercall = false;
  23144. return $self["@current"];
  23145. } else {
  23146. return $1;
  23147. }
  23148. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  23149. },
  23150. args: [],
  23151. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  23152. referencedClasses: [],
  23153. messageSends: ["ifNil:", "new"]
  23154. }),
  23155. $globals.SystemAnnouncer.a$cls);
  23156. $core.addMethod(
  23157. $core.method({
  23158. selector: "new",
  23159. protocol: "instance creation",
  23160. fn: function (){
  23161. var self=this,$self=this;
  23162. return $core.withContext(function($ctx1) {
  23163. $self._shouldNotImplement();
  23164. return self;
  23165. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  23166. },
  23167. args: [],
  23168. source: "new\x0a\x09self shouldNotImplement",
  23169. referencedClasses: [],
  23170. messageSends: ["shouldNotImplement"]
  23171. }),
  23172. $globals.SystemAnnouncer.a$cls);
  23173. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  23174. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  23175. $core.addMethod(
  23176. $core.method({
  23177. selector: "classTag",
  23178. protocol: "accessing",
  23179. fn: function (){
  23180. var self=this,$self=this;
  23181. return "announcement";
  23182. },
  23183. args: [],
  23184. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'announcement'",
  23185. referencedClasses: [],
  23186. messageSends: []
  23187. }),
  23188. $globals.SystemAnnouncement.a$cls);
  23189. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  23190. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  23191. $core.addMethod(
  23192. $core.method({
  23193. selector: "theClass",
  23194. protocol: "accessing",
  23195. fn: function (){
  23196. var self=this,$self=this;
  23197. return $self["@theClass"];
  23198. },
  23199. args: [],
  23200. source: "theClass\x0a\x09^ theClass",
  23201. referencedClasses: [],
  23202. messageSends: []
  23203. }),
  23204. $globals.ClassAnnouncement);
  23205. $core.addMethod(
  23206. $core.method({
  23207. selector: "theClass:",
  23208. protocol: "accessing",
  23209. fn: function (aClass){
  23210. var self=this,$self=this;
  23211. $self["@theClass"]=aClass;
  23212. return self;
  23213. },
  23214. args: ["aClass"],
  23215. source: "theClass: aClass\x0a\x09theClass := aClass",
  23216. referencedClasses: [],
  23217. messageSends: []
  23218. }),
  23219. $globals.ClassAnnouncement);
  23220. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23221. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  23222. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23223. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  23224. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23225. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  23226. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  23227. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  23228. $core.addMethod(
  23229. $core.method({
  23230. selector: "oldClass",
  23231. protocol: "accessing",
  23232. fn: function (){
  23233. var self=this,$self=this;
  23234. return $self["@oldClass"];
  23235. },
  23236. args: [],
  23237. source: "oldClass\x0a\x09^ oldClass",
  23238. referencedClasses: [],
  23239. messageSends: []
  23240. }),
  23241. $globals.ClassMigrated);
  23242. $core.addMethod(
  23243. $core.method({
  23244. selector: "oldClass:",
  23245. protocol: "accessing",
  23246. fn: function (aClass){
  23247. var self=this,$self=this;
  23248. $self["@oldClass"]=aClass;
  23249. return self;
  23250. },
  23251. args: ["aClass"],
  23252. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  23253. referencedClasses: [],
  23254. messageSends: []
  23255. }),
  23256. $globals.ClassMigrated);
  23257. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  23258. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  23259. $core.addMethod(
  23260. $core.method({
  23261. selector: "oldPackage",
  23262. protocol: "accessing",
  23263. fn: function (){
  23264. var self=this,$self=this;
  23265. return $self["@oldPackage"];
  23266. },
  23267. args: [],
  23268. source: "oldPackage\x0a\x09^ oldPackage",
  23269. referencedClasses: [],
  23270. messageSends: []
  23271. }),
  23272. $globals.ClassMoved);
  23273. $core.addMethod(
  23274. $core.method({
  23275. selector: "oldPackage:",
  23276. protocol: "accessing",
  23277. fn: function (aPackage){
  23278. var self=this,$self=this;
  23279. $self["@oldPackage"]=aPackage;
  23280. return self;
  23281. },
  23282. args: ["aPackage"],
  23283. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  23284. referencedClasses: [],
  23285. messageSends: []
  23286. }),
  23287. $globals.ClassMoved);
  23288. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23289. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  23290. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23291. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  23292. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  23293. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  23294. $core.addMethod(
  23295. $core.method({
  23296. selector: "method",
  23297. protocol: "accessing",
  23298. fn: function (){
  23299. var self=this,$self=this;
  23300. return $self["@method"];
  23301. },
  23302. args: [],
  23303. source: "method\x0a\x09^ method",
  23304. referencedClasses: [],
  23305. messageSends: []
  23306. }),
  23307. $globals.MethodAnnouncement);
  23308. $core.addMethod(
  23309. $core.method({
  23310. selector: "method:",
  23311. protocol: "accessing",
  23312. fn: function (aCompiledMethod){
  23313. var self=this,$self=this;
  23314. $self["@method"]=aCompiledMethod;
  23315. return self;
  23316. },
  23317. args: ["aCompiledMethod"],
  23318. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  23319. referencedClasses: [],
  23320. messageSends: []
  23321. }),
  23322. $globals.MethodAnnouncement);
  23323. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  23324. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  23325. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  23326. $globals.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.";
  23327. $core.addMethod(
  23328. $core.method({
  23329. selector: "oldMethod",
  23330. protocol: "accessing",
  23331. fn: function (){
  23332. var self=this,$self=this;
  23333. return $self["@oldMethod"];
  23334. },
  23335. args: [],
  23336. source: "oldMethod\x0a\x09^ oldMethod",
  23337. referencedClasses: [],
  23338. messageSends: []
  23339. }),
  23340. $globals.MethodModified);
  23341. $core.addMethod(
  23342. $core.method({
  23343. selector: "oldMethod:",
  23344. protocol: "accessing",
  23345. fn: function (aMethod){
  23346. var self=this,$self=this;
  23347. $self["@oldMethod"]=aMethod;
  23348. return self;
  23349. },
  23350. args: ["aMethod"],
  23351. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  23352. referencedClasses: [],
  23353. messageSends: []
  23354. }),
  23355. $globals.MethodModified);
  23356. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  23357. $globals.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
  23358. $core.addMethod(
  23359. $core.method({
  23360. selector: "oldProtocol",
  23361. protocol: "accessing",
  23362. fn: function (){
  23363. var self=this,$self=this;
  23364. return $self["@oldProtocol"];
  23365. },
  23366. args: [],
  23367. source: "oldProtocol\x0a\x09^ oldProtocol",
  23368. referencedClasses: [],
  23369. messageSends: []
  23370. }),
  23371. $globals.MethodMoved);
  23372. $core.addMethod(
  23373. $core.method({
  23374. selector: "oldProtocol:",
  23375. protocol: "accessing",
  23376. fn: function (aString){
  23377. var self=this,$self=this;
  23378. $self["@oldProtocol"]=aString;
  23379. return self;
  23380. },
  23381. args: ["aString"],
  23382. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  23383. referencedClasses: [],
  23384. messageSends: []
  23385. }),
  23386. $globals.MethodMoved);
  23387. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  23388. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  23389. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  23390. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  23391. $core.addMethod(
  23392. $core.method({
  23393. selector: "package",
  23394. protocol: "accessing",
  23395. fn: function (){
  23396. var self=this,$self=this;
  23397. return $self["@package"];
  23398. },
  23399. args: [],
  23400. source: "package\x0a\x09^ package",
  23401. referencedClasses: [],
  23402. messageSends: []
  23403. }),
  23404. $globals.PackageAnnouncement);
  23405. $core.addMethod(
  23406. $core.method({
  23407. selector: "package:",
  23408. protocol: "accessing",
  23409. fn: function (aPackage){
  23410. var self=this,$self=this;
  23411. $self["@package"]=aPackage;
  23412. return self;
  23413. },
  23414. args: ["aPackage"],
  23415. source: "package: aPackage\x0a\x09package := aPackage",
  23416. referencedClasses: [],
  23417. messageSends: []
  23418. }),
  23419. $globals.PackageAnnouncement);
  23420. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23421. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  23422. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23423. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  23424. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23425. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  23426. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23427. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  23428. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  23429. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  23430. $core.addMethod(
  23431. $core.method({
  23432. selector: "package",
  23433. protocol: "accessing",
  23434. fn: function (){
  23435. var self=this,$self=this;
  23436. return $core.withContext(function($ctx1) {
  23437. var $1,$receiver;
  23438. $1=$self._theClass();
  23439. if(($receiver = $1) == null || $receiver.a$nil){
  23440. return $1;
  23441. } else {
  23442. var class_;
  23443. class_=$receiver;
  23444. return $recv(class_)._packageOfProtocol_($self._protocol());
  23445. }
  23446. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  23447. },
  23448. args: [],
  23449. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  23450. referencedClasses: [],
  23451. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  23452. }),
  23453. $globals.ProtocolAnnouncement);
  23454. $core.addMethod(
  23455. $core.method({
  23456. selector: "protocol",
  23457. protocol: "accessing",
  23458. fn: function (){
  23459. var self=this,$self=this;
  23460. return $self["@protocol"];
  23461. },
  23462. args: [],
  23463. source: "protocol\x0a\x09^ protocol",
  23464. referencedClasses: [],
  23465. messageSends: []
  23466. }),
  23467. $globals.ProtocolAnnouncement);
  23468. $core.addMethod(
  23469. $core.method({
  23470. selector: "protocol:",
  23471. protocol: "accessing",
  23472. fn: function (aString){
  23473. var self=this,$self=this;
  23474. $self["@protocol"]=aString;
  23475. return self;
  23476. },
  23477. args: ["aString"],
  23478. source: "protocol: aString\x0a\x09protocol := aString",
  23479. referencedClasses: [],
  23480. messageSends: []
  23481. }),
  23482. $globals.ProtocolAnnouncement);
  23483. $core.addMethod(
  23484. $core.method({
  23485. selector: "theClass",
  23486. protocol: "accessing",
  23487. fn: function (){
  23488. var self=this,$self=this;
  23489. return $self["@theClass"];
  23490. },
  23491. args: [],
  23492. source: "theClass\x0a\x09^ theClass",
  23493. referencedClasses: [],
  23494. messageSends: []
  23495. }),
  23496. $globals.ProtocolAnnouncement);
  23497. $core.addMethod(
  23498. $core.method({
  23499. selector: "theClass:",
  23500. protocol: "accessing",
  23501. fn: function (aClass){
  23502. var self=this,$self=this;
  23503. $self["@theClass"]=aClass;
  23504. return self;
  23505. },
  23506. args: ["aClass"],
  23507. source: "theClass: aClass\x0a\x09theClass := aClass",
  23508. referencedClasses: [],
  23509. messageSends: []
  23510. }),
  23511. $globals.ProtocolAnnouncement);
  23512. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  23513. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  23514. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  23515. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  23516. });
  23517. define('amber_core/Platform-Services',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23518. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  23519. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  23520. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  23521. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  23522. $core.addPackage("Platform-Services");
  23523. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  23524. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23525. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  23526. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  23527. $core.addMethod(
  23528. $core.method({
  23529. selector: "handleError:",
  23530. protocol: "error handling",
  23531. fn: function (anError){
  23532. var self=this,$self=this;
  23533. return $core.withContext(function($ctx1) {
  23534. var $1,$receiver;
  23535. $1=$recv(anError)._context();
  23536. $ctx1.sendIdx["context"]=1;
  23537. if(($receiver = $1) == null || $receiver.a$nil){
  23538. $1;
  23539. } else {
  23540. $self._logErrorContext_($recv(anError)._context());
  23541. }
  23542. $self._logError_(anError);
  23543. return self;
  23544. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  23545. },
  23546. args: ["anError"],
  23547. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  23548. referencedClasses: [],
  23549. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  23550. }),
  23551. $globals.ConsoleErrorHandler);
  23552. $core.addMethod(
  23553. $core.method({
  23554. selector: "log:",
  23555. protocol: "private",
  23556. fn: function (aString){
  23557. var self=this,$self=this;
  23558. return $core.withContext(function($ctx1) {
  23559. $recv(console)._log_(aString);
  23560. return self;
  23561. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  23562. },
  23563. args: ["aString"],
  23564. source: "log: aString\x0a\x09console log: aString",
  23565. referencedClasses: [],
  23566. messageSends: ["log:"]
  23567. }),
  23568. $globals.ConsoleErrorHandler);
  23569. $core.addMethod(
  23570. $core.method({
  23571. selector: "logContext:",
  23572. protocol: "private",
  23573. fn: function (aContext){
  23574. var self=this,$self=this;
  23575. return $core.withContext(function($ctx1) {
  23576. var $1,$receiver;
  23577. $1=$recv(aContext)._home();
  23578. $ctx1.sendIdx["home"]=1;
  23579. if(($receiver = $1) == null || $receiver.a$nil){
  23580. $1;
  23581. } else {
  23582. $self._logContext_($recv(aContext)._home());
  23583. }
  23584. $self._log_($recv(aContext)._asString());
  23585. return self;
  23586. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  23587. },
  23588. args: ["aContext"],
  23589. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  23590. referencedClasses: [],
  23591. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  23592. }),
  23593. $globals.ConsoleErrorHandler);
  23594. $core.addMethod(
  23595. $core.method({
  23596. selector: "logError:",
  23597. protocol: "private",
  23598. fn: function (anError){
  23599. var self=this,$self=this;
  23600. return $core.withContext(function($ctx1) {
  23601. $self._log_($recv(anError)._messageText());
  23602. return self;
  23603. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  23604. },
  23605. args: ["anError"],
  23606. source: "logError: anError\x0a\x09self log: anError messageText",
  23607. referencedClasses: [],
  23608. messageSends: ["log:", "messageText"]
  23609. }),
  23610. $globals.ConsoleErrorHandler);
  23611. $core.addMethod(
  23612. $core.method({
  23613. selector: "logErrorContext:",
  23614. protocol: "private",
  23615. fn: function (aContext){
  23616. var self=this,$self=this;
  23617. return $core.withContext(function($ctx1) {
  23618. var $1,$receiver;
  23619. if(($receiver = aContext) == null || $receiver.a$nil){
  23620. aContext;
  23621. } else {
  23622. $1=$recv(aContext)._home();
  23623. $ctx1.sendIdx["home"]=1;
  23624. if(($receiver = $1) == null || $receiver.a$nil){
  23625. $1;
  23626. } else {
  23627. $self._logContext_($recv(aContext)._home());
  23628. }
  23629. }
  23630. return self;
  23631. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  23632. },
  23633. args: ["aContext"],
  23634. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  23635. referencedClasses: [],
  23636. messageSends: ["ifNotNil:", "home", "logContext:"]
  23637. }),
  23638. $globals.ConsoleErrorHandler);
  23639. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  23640. $core.addMethod(
  23641. $core.method({
  23642. selector: "initialize",
  23643. protocol: "initialization",
  23644. fn: function (){
  23645. var self=this,$self=this;
  23646. return $core.withContext(function($ctx1) {
  23647. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  23648. return self;
  23649. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  23650. },
  23651. args: [],
  23652. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  23653. referencedClasses: ["ErrorHandler"],
  23654. messageSends: ["registerIfNone:", "new"]
  23655. }),
  23656. $globals.ConsoleErrorHandler.a$cls);
  23657. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  23658. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  23659. $core.addMethod(
  23660. $core.method({
  23661. selector: "clear",
  23662. protocol: "printing",
  23663. fn: function (){
  23664. var self=this,$self=this;
  23665. return self;
  23666. },
  23667. args: [],
  23668. source: "clear\x0a\x09\x22no op\x22",
  23669. referencedClasses: [],
  23670. messageSends: []
  23671. }),
  23672. $globals.ConsoleTranscript);
  23673. $core.addMethod(
  23674. $core.method({
  23675. selector: "cr",
  23676. protocol: "printing",
  23677. fn: function (){
  23678. var self=this,$self=this;
  23679. return self;
  23680. },
  23681. args: [],
  23682. source: "cr\x0a\x09\x22no op\x22",
  23683. referencedClasses: [],
  23684. messageSends: []
  23685. }),
  23686. $globals.ConsoleTranscript);
  23687. $core.addMethod(
  23688. $core.method({
  23689. selector: "open",
  23690. protocol: "actions",
  23691. fn: function (){
  23692. var self=this,$self=this;
  23693. return self;
  23694. },
  23695. args: [],
  23696. source: "open",
  23697. referencedClasses: [],
  23698. messageSends: []
  23699. }),
  23700. $globals.ConsoleTranscript);
  23701. $core.addMethod(
  23702. $core.method({
  23703. selector: "show:",
  23704. protocol: "printing",
  23705. fn: function (anObject){
  23706. var self=this,$self=this;
  23707. return $core.withContext(function($ctx1) {
  23708. console.log(String($recv(anObject)._asString()));
  23709. return self;
  23710. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  23711. },
  23712. args: ["anObject"],
  23713. 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<inlineJS: 'console.log(String($recv(anObject)._asString()))'>",
  23714. referencedClasses: [],
  23715. messageSends: []
  23716. }),
  23717. $globals.ConsoleTranscript);
  23718. $core.addMethod(
  23719. $core.method({
  23720. selector: "initialize",
  23721. protocol: "initialization",
  23722. fn: function (){
  23723. var self=this,$self=this;
  23724. return $core.withContext(function($ctx1) {
  23725. $recv($globals.Transcript)._registerIfNone_($self._new());
  23726. return self;
  23727. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  23728. },
  23729. args: [],
  23730. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  23731. referencedClasses: ["Transcript"],
  23732. messageSends: ["registerIfNone:", "new"]
  23733. }),
  23734. $globals.ConsoleTranscript.a$cls);
  23735. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  23736. $globals.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.";
  23737. $core.addMethod(
  23738. $core.method({
  23739. selector: "addInstVarNamed:to:",
  23740. protocol: "compiling",
  23741. fn: function (aString,aClass){
  23742. var self=this,$self=this;
  23743. return $core.withContext(function($ctx1) {
  23744. var $1,$2,$3,$5,$4;
  23745. $1=$self._classBuilder();
  23746. $2=$recv(aClass)._superclass();
  23747. $3=$recv(aClass)._name();
  23748. $ctx1.sendIdx["name"]=1;
  23749. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  23750. $recv($5)._add_(aString);
  23751. $4=$recv($5)._yourself();
  23752. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  23753. return self;
  23754. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  23755. },
  23756. args: ["aString", "aClass"],
  23757. 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",
  23758. referencedClasses: [],
  23759. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  23760. }),
  23761. $globals.Environment);
  23762. $core.addMethod(
  23763. $core.method({
  23764. selector: "allSelectors",
  23765. protocol: "accessing",
  23766. fn: function (){
  23767. var self=this,$self=this;
  23768. return $core.withContext(function($ctx1) {
  23769. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  23770. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  23771. },
  23772. args: [],
  23773. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  23774. referencedClasses: ["Smalltalk"],
  23775. messageSends: ["allSelectors", "core"]
  23776. }),
  23777. $globals.Environment);
  23778. $core.addMethod(
  23779. $core.method({
  23780. selector: "availableClassNames",
  23781. protocol: "accessing",
  23782. fn: function (){
  23783. var self=this,$self=this;
  23784. return $core.withContext(function($ctx1) {
  23785. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  23786. return $core.withContext(function($ctx2) {
  23787. return $recv(each)._name();
  23788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23789. }));
  23790. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  23791. },
  23792. args: [],
  23793. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  23794. referencedClasses: ["Smalltalk"],
  23795. messageSends: ["collect:", "classes", "name"]
  23796. }),
  23797. $globals.Environment);
  23798. $core.addMethod(
  23799. $core.method({
  23800. selector: "availablePackageNames",
  23801. protocol: "accessing",
  23802. fn: function (){
  23803. var self=this,$self=this;
  23804. return $core.withContext(function($ctx1) {
  23805. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  23806. return $core.withContext(function($ctx2) {
  23807. return $recv(each)._name();
  23808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23809. }));
  23810. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  23811. },
  23812. args: [],
  23813. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  23814. referencedClasses: ["Smalltalk"],
  23815. messageSends: ["collect:", "packages", "name"]
  23816. }),
  23817. $globals.Environment);
  23818. $core.addMethod(
  23819. $core.method({
  23820. selector: "availableProtocolsFor:",
  23821. protocol: "accessing",
  23822. fn: function (aClass){
  23823. var self=this,$self=this;
  23824. var protocols;
  23825. return $core.withContext(function($ctx1) {
  23826. var $1,$receiver;
  23827. protocols=$recv(aClass)._protocols();
  23828. $1=$recv(aClass)._superclass();
  23829. $ctx1.sendIdx["superclass"]=1;
  23830. if(($receiver = $1) == null || $receiver.a$nil){
  23831. $1;
  23832. } else {
  23833. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  23834. }
  23835. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  23836. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  23837. },
  23838. args: ["aClass"],
  23839. 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 sort",
  23840. referencedClasses: [],
  23841. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  23842. }),
  23843. $globals.Environment);
  23844. $core.addMethod(
  23845. $core.method({
  23846. selector: "classBuilder",
  23847. protocol: "accessing",
  23848. fn: function (){
  23849. var self=this,$self=this;
  23850. return $core.withContext(function($ctx1) {
  23851. return $recv($globals.ClassBuilder)._new();
  23852. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  23853. },
  23854. args: [],
  23855. source: "classBuilder\x0a\x09^ ClassBuilder new",
  23856. referencedClasses: ["ClassBuilder"],
  23857. messageSends: ["new"]
  23858. }),
  23859. $globals.Environment);
  23860. $core.addMethod(
  23861. $core.method({
  23862. selector: "classNamed:",
  23863. protocol: "accessing",
  23864. fn: function (aString){
  23865. var self=this,$self=this;
  23866. return $core.withContext(function($ctx1) {
  23867. var $1,$receiver;
  23868. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  23869. if(($receiver = $1) == null || $receiver.a$nil){
  23870. return $self._error_("Invalid class name");
  23871. } else {
  23872. return $1;
  23873. }
  23874. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  23875. },
  23876. args: ["aString"],
  23877. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  23878. referencedClasses: ["Smalltalk"],
  23879. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  23880. }),
  23881. $globals.Environment);
  23882. $core.addMethod(
  23883. $core.method({
  23884. selector: "classes",
  23885. protocol: "accessing",
  23886. fn: function (){
  23887. var self=this,$self=this;
  23888. return $core.withContext(function($ctx1) {
  23889. return $recv($globals.Smalltalk)._classes();
  23890. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  23891. },
  23892. args: [],
  23893. source: "classes\x0a\x09^ Smalltalk classes",
  23894. referencedClasses: ["Smalltalk"],
  23895. messageSends: ["classes"]
  23896. }),
  23897. $globals.Environment);
  23898. $core.addMethod(
  23899. $core.method({
  23900. selector: "commitPackage:onSuccess:onError:",
  23901. protocol: "actions",
  23902. fn: function (aPackage,aBlock,anotherBlock){
  23903. var self=this,$self=this;
  23904. return $core.withContext(function($ctx1) {
  23905. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  23906. return self;
  23907. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  23908. },
  23909. args: ["aPackage", "aBlock", "anotherBlock"],
  23910. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  23911. referencedClasses: [],
  23912. messageSends: ["commitOnSuccess:onError:", "transport"]
  23913. }),
  23914. $globals.Environment);
  23915. $core.addMethod(
  23916. $core.method({
  23917. selector: "compileClassComment:for:",
  23918. protocol: "compiling",
  23919. fn: function (aString,aClass){
  23920. var self=this,$self=this;
  23921. return $core.withContext(function($ctx1) {
  23922. $recv(aClass)._comment_(aString);
  23923. return self;
  23924. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  23925. },
  23926. args: ["aString", "aClass"],
  23927. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  23928. referencedClasses: [],
  23929. messageSends: ["comment:"]
  23930. }),
  23931. $globals.Environment);
  23932. $core.addMethod(
  23933. $core.method({
  23934. selector: "compileClassDefinition:",
  23935. protocol: "compiling",
  23936. fn: function (aString){
  23937. var self=this,$self=this;
  23938. return $core.withContext(function($ctx1) {
  23939. $recv((function(){
  23940. return $core.withContext(function($ctx2) {
  23941. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  23942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23943. }))._on_do_($globals.Error,(function(error){
  23944. return $core.withContext(function($ctx2) {
  23945. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  23946. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  23947. }));
  23948. return self;
  23949. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  23950. },
  23951. args: ["aString"],
  23952. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  23953. referencedClasses: ["DoIt", "Error", "Terminal"],
  23954. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  23955. }),
  23956. $globals.Environment);
  23957. $core.addMethod(
  23958. $core.method({
  23959. selector: "compileMethod:for:protocol:",
  23960. protocol: "compiling",
  23961. fn: function (sourceCode,class_,protocol){
  23962. var self=this,$self=this;
  23963. return $core.withContext(function($ctx1) {
  23964. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  23965. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  23966. },
  23967. args: ["sourceCode", "class", "protocol"],
  23968. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  23969. referencedClasses: [],
  23970. messageSends: ["compile:protocol:"]
  23971. }),
  23972. $globals.Environment);
  23973. $core.addMethod(
  23974. $core.method({
  23975. selector: "copyClass:to:",
  23976. protocol: "actions",
  23977. fn: function (aClass,aClassName){
  23978. var self=this,$self=this;
  23979. return $core.withContext(function($ctx1) {
  23980. var $1,$2,$receiver;
  23981. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  23982. if(($receiver = $1) == null || $receiver.a$nil){
  23983. $1;
  23984. } else {
  23985. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  23986. $ctx1.sendIdx[","]=1;
  23987. $self._error_($2);
  23988. }
  23989. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  23990. return self;
  23991. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  23992. },
  23993. args: ["aClass", "aClassName"],
  23994. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
  23995. referencedClasses: ["Smalltalk", "ClassBuilder"],
  23996. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  23997. }),
  23998. $globals.Environment);
  23999. $core.addMethod(
  24000. $core.method({
  24001. selector: "doItReceiver",
  24002. protocol: "accessing",
  24003. fn: function (){
  24004. var self=this,$self=this;
  24005. return $core.withContext(function($ctx1) {
  24006. return $recv($globals.DoIt)._new();
  24007. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  24008. },
  24009. args: [],
  24010. source: "doItReceiver\x0a\x09^ DoIt new",
  24011. referencedClasses: ["DoIt"],
  24012. messageSends: ["new"]
  24013. }),
  24014. $globals.Environment);
  24015. $core.addMethod(
  24016. $core.method({
  24017. selector: "evaluate:for:",
  24018. protocol: "evaluating",
  24019. fn: function (aString,anObject){
  24020. var self=this,$self=this;
  24021. return $core.withContext(function($ctx1) {
  24022. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  24023. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  24024. },
  24025. args: ["aString", "anObject"],
  24026. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  24027. referencedClasses: ["Evaluator"],
  24028. messageSends: ["evaluate:for:"]
  24029. }),
  24030. $globals.Environment);
  24031. $core.addMethod(
  24032. $core.method({
  24033. selector: "evaluate:on:do:",
  24034. protocol: "error handling",
  24035. fn: function (aBlock,anErrorClass,exceptionBlock){
  24036. var self=this,$self=this;
  24037. return $core.withContext(function($ctx1) {
  24038. var $1;
  24039. $recv(aBlock)._tryCatch_((function(exception){
  24040. return $core.withContext(function($ctx2) {
  24041. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  24042. if($core.assert($1)){
  24043. return $recv(exceptionBlock)._value_(exception);
  24044. } else {
  24045. return $recv(exception)._resignal();
  24046. }
  24047. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  24048. }));
  24049. return self;
  24050. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  24051. },
  24052. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  24053. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  24054. referencedClasses: [],
  24055. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  24056. }),
  24057. $globals.Environment);
  24058. $core.addMethod(
  24059. $core.method({
  24060. selector: "inspect:",
  24061. protocol: "actions",
  24062. fn: function (anObject){
  24063. var self=this,$self=this;
  24064. return $core.withContext(function($ctx1) {
  24065. $recv($globals.Inspector)._inspect_(anObject);
  24066. return self;
  24067. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  24068. },
  24069. args: ["anObject"],
  24070. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  24071. referencedClasses: ["Inspector"],
  24072. messageSends: ["inspect:"]
  24073. }),
  24074. $globals.Environment);
  24075. $core.addMethod(
  24076. $core.method({
  24077. selector: "moveClass:toPackage:",
  24078. protocol: "actions",
  24079. fn: function (aClass,aPackageName){
  24080. var self=this,$self=this;
  24081. var package_;
  24082. return $core.withContext(function($ctx1) {
  24083. var $1,$2,$receiver;
  24084. package_=$recv($globals.Package)._named_(aPackageName);
  24085. $1=package_;
  24086. if(($receiver = $1) == null || $receiver.a$nil){
  24087. $self._error_("Invalid package name");
  24088. } else {
  24089. $1;
  24090. }
  24091. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  24092. if($core.assert($2)){
  24093. return self;
  24094. }
  24095. $recv(aClass)._package_(package_);
  24096. $recv(aClass)._recompile();
  24097. return self;
  24098. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  24099. },
  24100. args: ["aClass", "aPackageName"],
  24101. 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.\x0a\x09aClass recompile",
  24102. referencedClasses: ["Package"],
  24103. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  24104. }),
  24105. $globals.Environment);
  24106. $core.addMethod(
  24107. $core.method({
  24108. selector: "moveMethod:toClass:",
  24109. protocol: "actions",
  24110. fn: function (aMethod,aClassName){
  24111. var self=this,$self=this;
  24112. var destinationClass;
  24113. return $core.withContext(function($ctx1) {
  24114. var $2,$3,$1,$5,$4;
  24115. destinationClass=$self._classNamed_(aClassName);
  24116. $2=destinationClass;
  24117. $3=$recv(aMethod)._methodClass();
  24118. $ctx1.sendIdx["methodClass"]=1;
  24119. $1=$recv($2).__eq_eq($3);
  24120. if($core.assert($1)){
  24121. return self;
  24122. }
  24123. $5=$recv(aMethod)._methodClass();
  24124. $ctx1.sendIdx["methodClass"]=2;
  24125. $4=$recv($5)._isMetaclass();
  24126. if($core.assert($4)){
  24127. destinationClass=$recv(destinationClass)._theMetaClass();
  24128. destinationClass;
  24129. }
  24130. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  24131. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  24132. return self;
  24133. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  24134. },
  24135. args: ["aMethod", "aClassName"],
  24136. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass theMetaClass ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  24137. referencedClasses: [],
  24138. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  24139. }),
  24140. $globals.Environment);
  24141. $core.addMethod(
  24142. $core.method({
  24143. selector: "moveMethod:toProtocol:",
  24144. protocol: "actions",
  24145. fn: function (aMethod,aProtocol){
  24146. var self=this,$self=this;
  24147. return $core.withContext(function($ctx1) {
  24148. $recv(aMethod)._protocol_(aProtocol);
  24149. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  24150. return self;
  24151. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  24152. },
  24153. args: ["aMethod", "aProtocol"],
  24154. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  24155. referencedClasses: [],
  24156. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  24157. }),
  24158. $globals.Environment);
  24159. $core.addMethod(
  24160. $core.method({
  24161. selector: "packages",
  24162. protocol: "accessing",
  24163. fn: function (){
  24164. var self=this,$self=this;
  24165. return $core.withContext(function($ctx1) {
  24166. return $recv($globals.Smalltalk)._packages();
  24167. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  24168. },
  24169. args: [],
  24170. source: "packages\x0a\x09^ Smalltalk packages",
  24171. referencedClasses: ["Smalltalk"],
  24172. messageSends: ["packages"]
  24173. }),
  24174. $globals.Environment);
  24175. $core.addMethod(
  24176. $core.method({
  24177. selector: "registerErrorHandler:",
  24178. protocol: "services",
  24179. fn: function (anErrorHandler){
  24180. var self=this,$self=this;
  24181. return $core.withContext(function($ctx1) {
  24182. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  24183. return self;
  24184. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  24185. },
  24186. args: ["anErrorHandler"],
  24187. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  24188. referencedClasses: ["ErrorHandler"],
  24189. messageSends: ["register:"]
  24190. }),
  24191. $globals.Environment);
  24192. $core.addMethod(
  24193. $core.method({
  24194. selector: "registerFinder:",
  24195. protocol: "services",
  24196. fn: function (aFinder){
  24197. var self=this,$self=this;
  24198. return $core.withContext(function($ctx1) {
  24199. $recv($globals.Finder)._register_(aFinder);
  24200. return self;
  24201. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  24202. },
  24203. args: ["aFinder"],
  24204. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  24205. referencedClasses: ["Finder"],
  24206. messageSends: ["register:"]
  24207. }),
  24208. $globals.Environment);
  24209. $core.addMethod(
  24210. $core.method({
  24211. selector: "registerInspector:",
  24212. protocol: "services",
  24213. fn: function (anInspector){
  24214. var self=this,$self=this;
  24215. return $core.withContext(function($ctx1) {
  24216. $recv($globals.Inspector)._register_(anInspector);
  24217. return self;
  24218. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  24219. },
  24220. args: ["anInspector"],
  24221. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  24222. referencedClasses: ["Inspector"],
  24223. messageSends: ["register:"]
  24224. }),
  24225. $globals.Environment);
  24226. $core.addMethod(
  24227. $core.method({
  24228. selector: "registerProgressHandler:",
  24229. protocol: "services",
  24230. fn: function (aProgressHandler){
  24231. var self=this,$self=this;
  24232. return $core.withContext(function($ctx1) {
  24233. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  24234. return self;
  24235. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  24236. },
  24237. args: ["aProgressHandler"],
  24238. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  24239. referencedClasses: ["ProgressHandler"],
  24240. messageSends: ["register:"]
  24241. }),
  24242. $globals.Environment);
  24243. $core.addMethod(
  24244. $core.method({
  24245. selector: "registerTranscript:",
  24246. protocol: "services",
  24247. fn: function (aTranscript){
  24248. var self=this,$self=this;
  24249. return $core.withContext(function($ctx1) {
  24250. $recv($globals.Transcript)._register_(aTranscript);
  24251. return self;
  24252. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  24253. },
  24254. args: ["aTranscript"],
  24255. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  24256. referencedClasses: ["Transcript"],
  24257. messageSends: ["register:"]
  24258. }),
  24259. $globals.Environment);
  24260. $core.addMethod(
  24261. $core.method({
  24262. selector: "removeClass:",
  24263. protocol: "actions",
  24264. fn: function (aClass){
  24265. var self=this,$self=this;
  24266. return $core.withContext(function($ctx1) {
  24267. $recv($globals.Smalltalk)._removeClass_(aClass);
  24268. return self;
  24269. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  24270. },
  24271. args: ["aClass"],
  24272. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  24273. referencedClasses: ["Smalltalk"],
  24274. messageSends: ["removeClass:"]
  24275. }),
  24276. $globals.Environment);
  24277. $core.addMethod(
  24278. $core.method({
  24279. selector: "removeMethod:",
  24280. protocol: "actions",
  24281. fn: function (aMethod){
  24282. var self=this,$self=this;
  24283. return $core.withContext(function($ctx1) {
  24284. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  24285. return self;
  24286. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  24287. },
  24288. args: ["aMethod"],
  24289. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  24290. referencedClasses: [],
  24291. messageSends: ["removeCompiledMethod:", "methodClass"]
  24292. }),
  24293. $globals.Environment);
  24294. $core.addMethod(
  24295. $core.method({
  24296. selector: "removeProtocol:from:",
  24297. protocol: "actions",
  24298. fn: function (aString,aClass){
  24299. var self=this,$self=this;
  24300. return $core.withContext(function($ctx1) {
  24301. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  24302. return $core.withContext(function($ctx2) {
  24303. return $recv(aClass)._removeCompiledMethod_(each);
  24304. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24305. }));
  24306. return self;
  24307. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  24308. },
  24309. args: ["aString", "aClass"],
  24310. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  24311. referencedClasses: [],
  24312. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  24313. }),
  24314. $globals.Environment);
  24315. $core.addMethod(
  24316. $core.method({
  24317. selector: "renameClass:to:",
  24318. protocol: "actions",
  24319. fn: function (aClass,aClassName){
  24320. var self=this,$self=this;
  24321. return $core.withContext(function($ctx1) {
  24322. var $1,$2,$receiver;
  24323. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  24324. if(($receiver = $1) == null || $receiver.a$nil){
  24325. $1;
  24326. } else {
  24327. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  24328. $ctx1.sendIdx[","]=1;
  24329. $self._error_($2);
  24330. }
  24331. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  24332. return self;
  24333. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  24334. },
  24335. args: ["aClass", "aClassName"],
  24336. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
  24337. referencedClasses: ["Smalltalk", "ClassBuilder"],
  24338. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  24339. }),
  24340. $globals.Environment);
  24341. $core.addMethod(
  24342. $core.method({
  24343. selector: "renamePackage:to:",
  24344. protocol: "actions",
  24345. fn: function (aPackageName,aNewPackageName){
  24346. var self=this,$self=this;
  24347. return $core.withContext(function($ctx1) {
  24348. var $1,$2,$receiver;
  24349. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aNewPackageName);
  24350. if(($receiver = $1) == null || $receiver.a$nil){
  24351. $1;
  24352. } else {
  24353. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  24354. $ctx1.sendIdx[","]=1;
  24355. $self._error_($2);
  24356. }
  24357. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  24358. return self;
  24359. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  24360. },
  24361. args: ["aPackageName", "aNewPackageName"],
  24362. source: "renamePackage: aPackageName to: aNewPackageName\x0a (Smalltalk globals at: aNewPackageName)\x0a ifNotNil: [ self error: 'A package named ', aNewPackageName, ' already exists' ].\x0a\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  24363. referencedClasses: ["Smalltalk"],
  24364. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  24365. }),
  24366. $globals.Environment);
  24367. $core.addMethod(
  24368. $core.method({
  24369. selector: "renameProtocol:to:in:",
  24370. protocol: "actions",
  24371. fn: function (aString,anotherString,aClass){
  24372. var self=this,$self=this;
  24373. return $core.withContext(function($ctx1) {
  24374. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  24375. return $core.withContext(function($ctx2) {
  24376. return $recv(each)._protocol_(anotherString);
  24377. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24378. }));
  24379. return self;
  24380. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  24381. },
  24382. args: ["aString", "anotherString", "aClass"],
  24383. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  24384. referencedClasses: [],
  24385. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  24386. }),
  24387. $globals.Environment);
  24388. $core.addMethod(
  24389. $core.method({
  24390. selector: "setClassCommentOf:to:",
  24391. protocol: "actions",
  24392. fn: function (aClass,aString){
  24393. var self=this,$self=this;
  24394. return $core.withContext(function($ctx1) {
  24395. $recv(aClass)._comment_(aString);
  24396. return self;
  24397. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  24398. },
  24399. args: ["aClass", "aString"],
  24400. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  24401. referencedClasses: [],
  24402. messageSends: ["comment:"]
  24403. }),
  24404. $globals.Environment);
  24405. $core.addMethod(
  24406. $core.method({
  24407. selector: "systemAnnouncer",
  24408. protocol: "accessing",
  24409. fn: function (){
  24410. var self=this,$self=this;
  24411. return $core.withContext(function($ctx1) {
  24412. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  24413. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  24414. },
  24415. args: [],
  24416. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  24417. referencedClasses: ["Smalltalk"],
  24418. messageSends: ["current", "at:", "globals"]
  24419. }),
  24420. $globals.Environment);
  24421. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  24422. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  24423. $core.addMethod(
  24424. $core.method({
  24425. selector: "do:on:displaying:",
  24426. protocol: "progress handling",
  24427. fn: function (aBlock,aCollection,aString){
  24428. var self=this,$self=this;
  24429. return $core.withContext(function($ctx1) {
  24430. $recv(aCollection)._do_(aBlock);
  24431. return self;
  24432. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  24433. },
  24434. args: ["aBlock", "aCollection", "aString"],
  24435. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  24436. referencedClasses: [],
  24437. messageSends: ["do:"]
  24438. }),
  24439. $globals.NullProgressHandler);
  24440. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  24441. $core.addMethod(
  24442. $core.method({
  24443. selector: "initialize",
  24444. protocol: "initialization",
  24445. fn: function (){
  24446. var self=this,$self=this;
  24447. return $core.withContext(function($ctx1) {
  24448. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  24449. return self;
  24450. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  24451. },
  24452. args: [],
  24453. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  24454. referencedClasses: ["ProgressHandler"],
  24455. messageSends: ["registerIfNone:", "new"]
  24456. }),
  24457. $globals.NullProgressHandler.a$cls);
  24458. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  24459. $globals.Service.comment="I implement the basic behavior for class registration to a service.\x0a\x0aSee the `Transcript` class for a concrete service.\x0a\x0a## API\x0a\x0aUse class-side methods `#register:` and `#registerIfNone:` to register classes to a specific service.";
  24460. $globals.Service.a$cls.iVarNames = ["current"];
  24461. $core.addMethod(
  24462. $core.method({
  24463. selector: "current",
  24464. protocol: "accessing",
  24465. fn: function (){
  24466. var self=this,$self=this;
  24467. return $self["@current"];
  24468. },
  24469. args: [],
  24470. source: "current\x0a\x09^ current",
  24471. referencedClasses: [],
  24472. messageSends: []
  24473. }),
  24474. $globals.Service.a$cls);
  24475. $core.addMethod(
  24476. $core.method({
  24477. selector: "new",
  24478. protocol: "instance creation",
  24479. fn: function (){
  24480. var self=this,$self=this;
  24481. return $core.withContext(function($ctx1) {
  24482. $self._shouldNotImplement();
  24483. return self;
  24484. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  24485. },
  24486. args: [],
  24487. source: "new\x0a\x09self shouldNotImplement",
  24488. referencedClasses: [],
  24489. messageSends: ["shouldNotImplement"]
  24490. }),
  24491. $globals.Service.a$cls);
  24492. $core.addMethod(
  24493. $core.method({
  24494. selector: "register:",
  24495. protocol: "registration",
  24496. fn: function (anObject){
  24497. var self=this,$self=this;
  24498. $self["@current"]=anObject;
  24499. return self;
  24500. },
  24501. args: ["anObject"],
  24502. source: "register: anObject\x0a\x09current := anObject",
  24503. referencedClasses: [],
  24504. messageSends: []
  24505. }),
  24506. $globals.Service.a$cls);
  24507. $core.addMethod(
  24508. $core.method({
  24509. selector: "registerIfNone:",
  24510. protocol: "registration",
  24511. fn: function (anObject){
  24512. var self=this,$self=this;
  24513. return $core.withContext(function($ctx1) {
  24514. var $1,$receiver;
  24515. $1=$self._current();
  24516. if(($receiver = $1) == null || $receiver.a$nil){
  24517. $self._register_(anObject);
  24518. } else {
  24519. $1;
  24520. }
  24521. return self;
  24522. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  24523. },
  24524. args: ["anObject"],
  24525. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  24526. referencedClasses: [],
  24527. messageSends: ["ifNil:", "current", "register:"]
  24528. }),
  24529. $globals.Service.a$cls);
  24530. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  24531. $globals.ErrorHandler.comment="I am the service used to handle Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aRegistered service instances must implement `#handleError:` to perform an action on the thrown exception.";
  24532. $core.addMethod(
  24533. $core.method({
  24534. selector: "handleError:",
  24535. protocol: "error handling",
  24536. fn: function (anError){
  24537. var self=this,$self=this;
  24538. return $core.withContext(function($ctx1) {
  24539. $self._handleUnhandledError_(anError);
  24540. return self;
  24541. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  24542. },
  24543. args: ["anError"],
  24544. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  24545. referencedClasses: [],
  24546. messageSends: ["handleUnhandledError:"]
  24547. }),
  24548. $globals.ErrorHandler.a$cls);
  24549. $core.addMethod(
  24550. $core.method({
  24551. selector: "handleUnhandledError:",
  24552. protocol: "error handling",
  24553. fn: function (anError){
  24554. var self=this,$self=this;
  24555. return $core.withContext(function($ctx1) {
  24556. var $1;
  24557. $1=$recv(anError)._wasHandled();
  24558. if($core.assert($1)){
  24559. return self;
  24560. }
  24561. return $recv($self._current())._handleError_(anError);
  24562. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  24563. },
  24564. args: ["anError"],
  24565. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  24566. referencedClasses: [],
  24567. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  24568. }),
  24569. $globals.ErrorHandler.a$cls);
  24570. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  24571. $globals.Finder.comment="I am the service responsible for finding classes/methods.\x0a__There is no default finder.__\x0a\x0a## API\x0a\x0aUse `#browse` on an object to find it.";
  24572. $core.addMethod(
  24573. $core.method({
  24574. selector: "findClass:",
  24575. protocol: "finding",
  24576. fn: function (aClass){
  24577. var self=this,$self=this;
  24578. return $core.withContext(function($ctx1) {
  24579. return $recv($self._current())._findClass_(aClass);
  24580. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  24581. },
  24582. args: ["aClass"],
  24583. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  24584. referencedClasses: [],
  24585. messageSends: ["findClass:", "current"]
  24586. }),
  24587. $globals.Finder.a$cls);
  24588. $core.addMethod(
  24589. $core.method({
  24590. selector: "findMethod:",
  24591. protocol: "finding",
  24592. fn: function (aCompiledMethod){
  24593. var self=this,$self=this;
  24594. return $core.withContext(function($ctx1) {
  24595. return $recv($self._current())._findMethod_(aCompiledMethod);
  24596. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  24597. },
  24598. args: ["aCompiledMethod"],
  24599. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  24600. referencedClasses: [],
  24601. messageSends: ["findMethod:", "current"]
  24602. }),
  24603. $globals.Finder.a$cls);
  24604. $core.addMethod(
  24605. $core.method({
  24606. selector: "findString:",
  24607. protocol: "finding",
  24608. fn: function (aString){
  24609. var self=this,$self=this;
  24610. return $core.withContext(function($ctx1) {
  24611. return $recv($self._current())._findString_(aString);
  24612. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  24613. },
  24614. args: ["aString"],
  24615. source: "findString: aString\x0a\x09^ self current findString: aString",
  24616. referencedClasses: [],
  24617. messageSends: ["findString:", "current"]
  24618. }),
  24619. $globals.Finder.a$cls);
  24620. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  24621. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  24622. $core.addMethod(
  24623. $core.method({
  24624. selector: "inspect:",
  24625. protocol: "inspecting",
  24626. fn: function (anObject){
  24627. var self=this,$self=this;
  24628. return $core.withContext(function($ctx1) {
  24629. return $recv($self._current())._inspect_(anObject);
  24630. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  24631. },
  24632. args: ["anObject"],
  24633. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  24634. referencedClasses: [],
  24635. messageSends: ["inspect:", "current"]
  24636. }),
  24637. $globals.Inspector.a$cls);
  24638. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  24639. $globals.Platform.comment="I am bridge to JS environment.\x0a\x0a## API\x0a\x0a Platform globals. \x22JS global object\x22\x0a Platform newXHR \x22new XMLHttpRequest() or its shim\x22";
  24640. $core.addMethod(
  24641. $core.method({
  24642. selector: "globals",
  24643. protocol: "accessing",
  24644. fn: function (){
  24645. var self=this,$self=this;
  24646. return $core.withContext(function($ctx1) {
  24647. return $recv($self._current())._globals();
  24648. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  24649. },
  24650. args: [],
  24651. source: "globals\x0a\x09^ self current globals",
  24652. referencedClasses: [],
  24653. messageSends: ["globals", "current"]
  24654. }),
  24655. $globals.Platform.a$cls);
  24656. $core.addMethod(
  24657. $core.method({
  24658. selector: "newXhr",
  24659. protocol: "accessing",
  24660. fn: function (){
  24661. var self=this,$self=this;
  24662. return $core.withContext(function($ctx1) {
  24663. return $recv($self._current())._newXhr();
  24664. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  24665. },
  24666. args: [],
  24667. source: "newXhr\x0a\x09^ self current newXhr",
  24668. referencedClasses: [],
  24669. messageSends: ["newXhr", "current"]
  24670. }),
  24671. $globals.Platform.a$cls);
  24672. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  24673. $globals.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aRegistered instances must implement `#do:on:displaying:`.\x0a\x0aThe default behavior is to simply iterate over the collection, using `NullProgressHandler`.";
  24674. $core.addMethod(
  24675. $core.method({
  24676. selector: "do:on:displaying:",
  24677. protocol: "progress handling",
  24678. fn: function (aBlock,aCollection,aString){
  24679. var self=this,$self=this;
  24680. return $core.withContext(function($ctx1) {
  24681. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  24682. return self;
  24683. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  24684. },
  24685. args: ["aBlock", "aCollection", "aString"],
  24686. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  24687. referencedClasses: [],
  24688. messageSends: ["do:on:displaying:", "current"]
  24689. }),
  24690. $globals.ProgressHandler.a$cls);
  24691. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  24692. $globals.Terminal.comment="I am UI interface service.\x0a\x0a## API\x0a\x0a Terminal alert: 'Hey, there is a problem'.\x0a Terminal confirm: 'Affirmative?'.\x0a Terminal prompt: 'Your name:'.";
  24693. $core.addMethod(
  24694. $core.method({
  24695. selector: "alert:",
  24696. protocol: "dialogs",
  24697. fn: function (aString){
  24698. var self=this,$self=this;
  24699. return $core.withContext(function($ctx1) {
  24700. return $recv($self._current())._alert_(aString);
  24701. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  24702. },
  24703. args: ["aString"],
  24704. source: "alert: aString\x0a\x09^ self current alert: aString",
  24705. referencedClasses: [],
  24706. messageSends: ["alert:", "current"]
  24707. }),
  24708. $globals.Terminal.a$cls);
  24709. $core.addMethod(
  24710. $core.method({
  24711. selector: "confirm:",
  24712. protocol: "dialogs",
  24713. fn: function (aString){
  24714. var self=this,$self=this;
  24715. return $core.withContext(function($ctx1) {
  24716. return $recv($self._current())._confirm_(aString);
  24717. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  24718. },
  24719. args: ["aString"],
  24720. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  24721. referencedClasses: [],
  24722. messageSends: ["confirm:", "current"]
  24723. }),
  24724. $globals.Terminal.a$cls);
  24725. $core.addMethod(
  24726. $core.method({
  24727. selector: "prompt:",
  24728. protocol: "dialogs",
  24729. fn: function (aString){
  24730. var self=this,$self=this;
  24731. return $core.withContext(function($ctx1) {
  24732. return $recv($self._current())._prompt_(aString);
  24733. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  24734. },
  24735. args: ["aString"],
  24736. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  24737. referencedClasses: [],
  24738. messageSends: ["prompt:", "current"]
  24739. }),
  24740. $globals.Terminal.a$cls);
  24741. $core.addMethod(
  24742. $core.method({
  24743. selector: "prompt:default:",
  24744. protocol: "dialogs",
  24745. fn: function (aString,defaultString){
  24746. var self=this,$self=this;
  24747. return $core.withContext(function($ctx1) {
  24748. return $recv($self._current())._prompt_default_(aString,defaultString);
  24749. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  24750. },
  24751. args: ["aString", "defaultString"],
  24752. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  24753. referencedClasses: [],
  24754. messageSends: ["prompt:default:", "current"]
  24755. }),
  24756. $globals.Terminal.a$cls);
  24757. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  24758. $globals.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.";
  24759. $core.addMethod(
  24760. $core.method({
  24761. selector: "clear",
  24762. protocol: "printing",
  24763. fn: function (){
  24764. var self=this,$self=this;
  24765. return $core.withContext(function($ctx1) {
  24766. $recv($self._current())._clear();
  24767. return self;
  24768. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  24769. },
  24770. args: [],
  24771. source: "clear\x0a\x09self current clear",
  24772. referencedClasses: [],
  24773. messageSends: ["clear", "current"]
  24774. }),
  24775. $globals.Transcript.a$cls);
  24776. $core.addMethod(
  24777. $core.method({
  24778. selector: "cr",
  24779. protocol: "printing",
  24780. fn: function (){
  24781. var self=this,$self=this;
  24782. return $core.withContext(function($ctx1) {
  24783. $recv($self._current())._show_($recv($globals.String)._cr());
  24784. return self;
  24785. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  24786. },
  24787. args: [],
  24788. source: "cr\x0a\x09self current show: String cr",
  24789. referencedClasses: ["String"],
  24790. messageSends: ["show:", "current", "cr"]
  24791. }),
  24792. $globals.Transcript.a$cls);
  24793. $core.addMethod(
  24794. $core.method({
  24795. selector: "inspect:",
  24796. protocol: "printing",
  24797. fn: function (anObject){
  24798. var self=this,$self=this;
  24799. return $core.withContext(function($ctx1) {
  24800. $self._show_(anObject);
  24801. return self;
  24802. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  24803. },
  24804. args: ["anObject"],
  24805. source: "inspect: anObject\x0a\x09self show: anObject",
  24806. referencedClasses: [],
  24807. messageSends: ["show:"]
  24808. }),
  24809. $globals.Transcript.a$cls);
  24810. $core.addMethod(
  24811. $core.method({
  24812. selector: "open",
  24813. protocol: "instance creation",
  24814. fn: function (){
  24815. var self=this,$self=this;
  24816. return $core.withContext(function($ctx1) {
  24817. $recv($self._current())._open();
  24818. return self;
  24819. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  24820. },
  24821. args: [],
  24822. source: "open\x0a\x09self current open",
  24823. referencedClasses: [],
  24824. messageSends: ["open", "current"]
  24825. }),
  24826. $globals.Transcript.a$cls);
  24827. $core.addMethod(
  24828. $core.method({
  24829. selector: "show:",
  24830. protocol: "printing",
  24831. fn: function (anObject){
  24832. var self=this,$self=this;
  24833. return $core.withContext(function($ctx1) {
  24834. $recv($self._current())._show_(anObject);
  24835. return self;
  24836. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  24837. },
  24838. args: ["anObject"],
  24839. source: "show: anObject\x0a\x09self current show: anObject",
  24840. referencedClasses: [],
  24841. messageSends: ["show:", "current"]
  24842. }),
  24843. $globals.Transcript.a$cls);
  24844. $core.addMethod(
  24845. $core.method({
  24846. selector: "inspectOn:",
  24847. protocol: "*Platform-Services",
  24848. fn: function (anInspector){
  24849. var self=this,$self=this;
  24850. var variables;
  24851. return $core.withContext(function($ctx1) {
  24852. variables=$recv($globals.Dictionary)._new();
  24853. $recv(variables)._at_put_("#self",self);
  24854. $ctx1.sendIdx["at:put:"]=1;
  24855. $recv(variables)._at_put_("#keys",$self._keys());
  24856. $ctx1.sendIdx["at:put:"]=2;
  24857. $self._keysAndValuesDo_((function(key,value){
  24858. return $core.withContext(function($ctx2) {
  24859. return $recv(variables)._at_put_(key,value);
  24860. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  24861. }));
  24862. $recv(anInspector)._setLabel_($self._printString());
  24863. $recv(anInspector)._setVariables_(variables);
  24864. return self;
  24865. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  24866. },
  24867. args: ["anInspector"],
  24868. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#keys' put: self keys.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09variables at: key put: value ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  24869. referencedClasses: ["Dictionary"],
  24870. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  24871. }),
  24872. $globals.AssociativeCollection);
  24873. $core.addMethod(
  24874. $core.method({
  24875. selector: "inspectOn:",
  24876. protocol: "*Platform-Services",
  24877. fn: function (anInspector){
  24878. var self=this,$self=this;
  24879. var variables;
  24880. return $core.withContext(function($ctx1) {
  24881. variables=$recv($globals.Dictionary)._new();
  24882. $recv(variables)._at_put_("#self",self);
  24883. $ctx1.sendIdx["at:put:"]=1;
  24884. $self._withIndexDo_((function(each,i){
  24885. return $core.withContext(function($ctx2) {
  24886. return $recv(variables)._at_put_(i,each);
  24887. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  24888. }));
  24889. $recv(anInspector)._setLabel_($self._printString());
  24890. $recv(anInspector)._setVariables_(variables);
  24891. return self;
  24892. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  24893. },
  24894. args: ["anInspector"],
  24895. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09variables at: i put: each ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  24896. referencedClasses: ["Dictionary"],
  24897. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  24898. }),
  24899. $globals.Collection);
  24900. $core.addMethod(
  24901. $core.method({
  24902. selector: "inspectOn:",
  24903. protocol: "*Platform-Services",
  24904. fn: function (anInspector){
  24905. var self=this,$self=this;
  24906. var variables;
  24907. return $core.withContext(function($ctx1) {
  24908. variables=$recv($globals.Dictionary)._new();
  24909. $recv(variables)._at_put_("#self",self);
  24910. $ctx1.sendIdx["at:put:"]=1;
  24911. $recv(variables)._at_put_("#year",$self._year());
  24912. $ctx1.sendIdx["at:put:"]=2;
  24913. $recv(variables)._at_put_("#month",$self._month());
  24914. $ctx1.sendIdx["at:put:"]=3;
  24915. $recv(variables)._at_put_("#day",$self._day());
  24916. $ctx1.sendIdx["at:put:"]=4;
  24917. $recv(variables)._at_put_("#hours",$self._hours());
  24918. $ctx1.sendIdx["at:put:"]=5;
  24919. $recv(variables)._at_put_("#minutes",$self._minutes());
  24920. $ctx1.sendIdx["at:put:"]=6;
  24921. $recv(variables)._at_put_("#seconds",$self._seconds());
  24922. $ctx1.sendIdx["at:put:"]=7;
  24923. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  24924. $recv(anInspector)._setLabel_($self._printString());
  24925. $recv(anInspector)._setVariables_(variables);
  24926. return self;
  24927. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  24928. },
  24929. args: ["anInspector"],
  24930. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#year' put: self year.\x0a\x09variables at: '#month' put: self month.\x0a\x09variables at: '#day' put: self day.\x0a\x09variables at: '#hours' put: self hours.\x0a\x09variables at: '#minutes' put: self minutes.\x0a\x09variables at: '#seconds' put: self seconds.\x0a\x09variables at: '#milliseconds' put: self milliseconds.\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  24931. referencedClasses: ["Dictionary"],
  24932. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  24933. }),
  24934. $globals.Date);
  24935. $core.addMethod(
  24936. $core.method({
  24937. selector: "inspectOn:",
  24938. protocol: "*Platform-Services",
  24939. fn: function (anInspector){
  24940. var self=this,$self=this;
  24941. var variables;
  24942. return $core.withContext(function($ctx1) {
  24943. variables=$recv($globals.Dictionary)._new();
  24944. $recv(variables)._at_put_("#self",$self._jsObject());
  24945. $recv(anInspector)._setLabel_($self._printString());
  24946. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  24947. $recv(anInspector)._setVariables_(variables);
  24948. return self;
  24949. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  24950. },
  24951. args: ["anInspector"],
  24952. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09JSObjectProxy addObjectVariablesTo: variables ofProxy: self.\x0a\x09anInspector setVariables: variables",
  24953. referencedClasses: ["Dictionary", "JSObjectProxy"],
  24954. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  24955. }),
  24956. $globals.JSObjectProxy);
  24957. $core.addMethod(
  24958. $core.method({
  24959. selector: "inspectOn:",
  24960. protocol: "*Platform-Services",
  24961. fn: function (anInspector){
  24962. var self=this,$self=this;
  24963. var variables;
  24964. return $core.withContext(function($ctx1) {
  24965. variables=$recv($globals.Dictionary)._new();
  24966. $recv(variables)._at_put_("#self",self);
  24967. $ctx1.sendIdx["at:put:"]=1;
  24968. $recv(variables)._at_put_("#home",$self._home());
  24969. $ctx1.sendIdx["at:put:"]=2;
  24970. $recv(variables)._at_put_("#receiver",$self._receiver());
  24971. $ctx1.sendIdx["at:put:"]=3;
  24972. $recv(variables)._at_put_("#selector",$self._selector());
  24973. $ctx1.sendIdx["at:put:"]=4;
  24974. $recv(variables)._at_put_("#locals",$self._locals());
  24975. $ctx1.sendIdx["at:put:"]=5;
  24976. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  24977. return $core.withContext(function($ctx2) {
  24978. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  24979. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24980. }));
  24981. $recv(anInspector)._setLabel_($self._printString());
  24982. $recv(anInspector)._setVariables_(variables);
  24983. return self;
  24984. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  24985. },
  24986. args: ["anInspector"],
  24987. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#home' put: self home.\x0a\x09variables at: '#receiver' put: self receiver.\x0a\x09variables at: '#selector' put: self selector.\x0a\x09variables at: '#locals' put: self locals.\x0a\x09self class instanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  24988. referencedClasses: ["Dictionary"],
  24989. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  24990. }),
  24991. $globals.MethodContext);
  24992. $core.addMethod(
  24993. $core.method({
  24994. selector: "inspectOn:",
  24995. protocol: "*Platform-Services",
  24996. fn: function (anInspector){
  24997. var self=this,$self=this;
  24998. var variables;
  24999. return $core.withContext(function($ctx1) {
  25000. variables=$recv($globals.Dictionary)._new();
  25001. $recv(variables)._at_put_("#self",self);
  25002. $ctx1.sendIdx["at:put:"]=1;
  25003. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  25004. return $core.withContext(function($ctx2) {
  25005. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  25006. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25007. }));
  25008. $recv(anInspector)._setLabel_($self._printString());
  25009. $recv(anInspector)._setVariables_(variables);
  25010. return self;
  25011. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  25012. },
  25013. args: ["anInspector"],
  25014. 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",
  25015. referencedClasses: ["Dictionary"],
  25016. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  25017. }),
  25018. $globals.Object);
  25019. $core.addMethod(
  25020. $core.method({
  25021. selector: "do:displayingProgress:",
  25022. protocol: "*Platform-Services",
  25023. fn: function (aBlock,aString){
  25024. var self=this,$self=this;
  25025. return $core.withContext(function($ctx1) {
  25026. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  25027. return self;
  25028. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  25029. },
  25030. args: ["aBlock", "aString"],
  25031. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  25032. referencedClasses: ["ProgressHandler"],
  25033. messageSends: ["do:on:displaying:"]
  25034. }),
  25035. $globals.SequenceableCollection);
  25036. $core.addMethod(
  25037. $core.method({
  25038. selector: "inspectOn:",
  25039. protocol: "*Platform-Services",
  25040. fn: function (anInspector){
  25041. var self=this,$self=this;
  25042. var variables,i;
  25043. return $core.withContext(function($ctx1) {
  25044. variables=$recv($globals.Dictionary)._new();
  25045. $recv(variables)._at_put_("#self",self);
  25046. $ctx1.sendIdx["at:put:"]=1;
  25047. i=(1);
  25048. $self._do_((function(each){
  25049. return $core.withContext(function($ctx2) {
  25050. $recv(variables)._at_put_(i,each);
  25051. i=$recv(i).__plus((1));
  25052. return i;
  25053. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25054. }));
  25055. $recv(anInspector)._setLabel_($self._printString());
  25056. $recv(anInspector)._setVariables_(variables);
  25057. return self;
  25058. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  25059. },
  25060. args: ["anInspector"],
  25061. source: "inspectOn: anInspector\x0a\x09| variables i |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09i := 1.\x0a\x09self do: [ :each |\x0a\x09\x09variables at: i put: each.\x0a\x09\x09i := i + 1 ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  25062. referencedClasses: ["Dictionary"],
  25063. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  25064. }),
  25065. $globals.Set);
  25066. $core.addMethod(
  25067. $core.method({
  25068. selector: "inspectOn:",
  25069. protocol: "*Platform-Services",
  25070. fn: function (anInspector){
  25071. var self=this,$self=this;
  25072. var label;
  25073. return $core.withContext(function($ctx1) {
  25074. var $3,$2,$1,$5,$4;
  25075. (
  25076. $ctx1.supercall = true,
  25077. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  25078. $ctx1.supercall = false;
  25079. $3=$self._printString();
  25080. $ctx1.sendIdx["printString"]=1;
  25081. $2=$recv($3)._size();
  25082. $1=$recv($2).__gt((30));
  25083. if($core.assert($1)){
  25084. $5=$self._printString();
  25085. $ctx1.sendIdx["printString"]=2;
  25086. $4=$recv($5)._copyFrom_to_((1),(30));
  25087. label=$recv($4).__comma("...'");
  25088. label;
  25089. } else {
  25090. label=$self._printString();
  25091. label;
  25092. }
  25093. $recv(anInspector)._setLabel_(label);
  25094. return self;
  25095. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  25096. },
  25097. args: ["anInspector"],
  25098. source: "inspectOn: anInspector\x0a\x09| label |\x0a\x09super inspectOn: anInspector.\x0a\x09self printString size > 30\x0a\x09\x09ifTrue: [ label := (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ label := self printString ].\x0a\x09anInspector setLabel: label",
  25099. referencedClasses: [],
  25100. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  25101. }),
  25102. $globals.String);
  25103. });
  25104. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  25105. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  25106. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25107. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25108. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  25109. $core.addPackage("Platform-Node");
  25110. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  25111. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25112. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  25113. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  25114. $core.addMethod(
  25115. $core.method({
  25116. selector: "globals",
  25117. protocol: "accessing",
  25118. fn: function (){
  25119. var self=this,$self=this;
  25120. return global;
  25121. },
  25122. args: [],
  25123. source: "globals\x0a\x09^ global",
  25124. referencedClasses: [],
  25125. messageSends: []
  25126. }),
  25127. $globals.NodePlatform);
  25128. $core.addMethod(
  25129. $core.method({
  25130. selector: "newXhr",
  25131. protocol: "accessing",
  25132. fn: function (){
  25133. var self=this,$self=this;
  25134. return $core.withContext(function($ctx1) {
  25135. var $receiver;
  25136. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  25137. $self._error_("XMLHttpRequest not available.");
  25138. } else {
  25139. return $recv($globals.XMLHttpRequest)._new();
  25140. }
  25141. return self;
  25142. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  25143. },
  25144. args: [],
  25145. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  25146. referencedClasses: ["XMLHttpRequest"],
  25147. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  25148. }),
  25149. $globals.NodePlatform);
  25150. $core.addMethod(
  25151. $core.method({
  25152. selector: "initialize",
  25153. protocol: "testing",
  25154. fn: function (){
  25155. var self=this,$self=this;
  25156. return $core.withContext(function($ctx1) {
  25157. var $1;
  25158. $1=$self._isFeasible();
  25159. if($core.assert($1)){
  25160. $recv($globals.Platform)._registerIfNone_($self._new());
  25161. }
  25162. return self;
  25163. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  25164. },
  25165. args: [],
  25166. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  25167. referencedClasses: ["Platform"],
  25168. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  25169. }),
  25170. $globals.NodePlatform.a$cls);
  25171. $core.addMethod(
  25172. $core.method({
  25173. selector: "isFeasible",
  25174. protocol: "testing",
  25175. fn: function (){
  25176. var self=this,$self=this;
  25177. return $core.withContext(function($ctx1) {
  25178. return typeof global !== "undefined";
  25179. return self;
  25180. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  25181. },
  25182. args: [],
  25183. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  25184. referencedClasses: [],
  25185. messageSends: []
  25186. }),
  25187. $globals.NodePlatform.a$cls);
  25188. });
  25189. define('amber/deploy',[
  25190. './helpers',
  25191. './compatibility', // pre-fetch, dep of ./boot
  25192. './kernel-fundamentals', // pre-fetch, dep of ./boot
  25193. './kernel-language', // pre-fetch, dep of ./boot
  25194. './boot', // pre-fetch, dep of ./helpers
  25195. // --- packages of the core Amber begin here ---
  25196. 'amber_core/Kernel-Helpers',
  25197. 'amber_core/Kernel-Objects',
  25198. 'amber_core/Kernel-Classes',
  25199. 'amber_core/Kernel-Methods',
  25200. 'amber_core/Kernel-Collections',
  25201. 'amber_core/Kernel-Dag',
  25202. 'amber_core/Kernel-Infrastructure',
  25203. 'amber_core/Kernel-Promises',
  25204. 'amber_core/Kernel-Exceptions',
  25205. 'amber_core/Kernel-Announcements',
  25206. 'amber_core/Platform-Services',
  25207. 'amber/Platform'
  25208. // --- packages of the core Amber end here ---
  25209. ], function (amber) {
  25210. return amber;
  25211. });
  25212. define('amber/parser',['./boot'], function($boot) {
  25213. var $globals = $boot.globals;
  25214. $globals.SmalltalkParser = (function() {
  25215. "use strict";
  25216. /*
  25217. * Generated by PEG.js 0.9.0.
  25218. *
  25219. * http://pegjs.org/
  25220. */
  25221. function peg$subclass(child, parent) {
  25222. function ctor() { this.constructor = child; }
  25223. ctor.prototype = parent.prototype;
  25224. child.prototype = new ctor();
  25225. }
  25226. function peg$SyntaxError(message, expected, found, location) {
  25227. this.message = message;
  25228. this.expected = expected;
  25229. this.found = found;
  25230. this.location = location;
  25231. this.name = "SyntaxError";
  25232. if (typeof Error.captureStackTrace === "function") {
  25233. Error.captureStackTrace(this, peg$SyntaxError);
  25234. }
  25235. }
  25236. peg$subclass(peg$SyntaxError, Error);
  25237. function peg$parse(input) {
  25238. var options = arguments.length > 1 ? arguments[1] : {},
  25239. parser = this,
  25240. peg$FAILED = {},
  25241. peg$startRuleFunctions = { start: peg$parsestart },
  25242. peg$startRuleFunction = peg$parsestart,
  25243. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  25244. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF\\n\\r\\u2028\\u2029]" },
  25245. peg$c2 = "\"",
  25246. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  25247. peg$c4 = /^[^"]/,
  25248. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  25249. peg$c6 = ".",
  25250. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  25251. peg$c8 = /^[a-zA-Z]/,
  25252. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  25253. peg$c10 = /^[a-zA-Z0-9]/,
  25254. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  25255. peg$c12 = ":",
  25256. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  25257. peg$c14 = /^[A-Z]/,
  25258. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  25259. peg$c16 = function(val) {
  25260. return $globals.ValueNode._new()
  25261. ._location_(location())
  25262. ._source_(text())
  25263. ._value_(val);
  25264. },
  25265. peg$c17 = "'",
  25266. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  25267. peg$c19 = "''",
  25268. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  25269. peg$c21 = function() {return '\'';},
  25270. peg$c22 = /^[^']/,
  25271. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  25272. peg$c24 = function(val) {return val.join('');},
  25273. peg$c25 = "$",
  25274. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  25275. peg$c27 = { type: "any", description: "any character" },
  25276. peg$c28 = function(char) {
  25277. return $globals.ValueNode._new()
  25278. ._location_(location())
  25279. ._source_(text())
  25280. ._value_(char);
  25281. },
  25282. peg$c29 = "#",
  25283. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  25284. peg$c31 = function(rest) {return rest;},
  25285. peg$c32 = "e",
  25286. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  25287. peg$c34 = function(n) {return parseFloat(n);},
  25288. peg$c35 = "-",
  25289. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  25290. peg$c37 = "16r",
  25291. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  25292. peg$c39 = /^[0-9a-fA-F]/,
  25293. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  25294. peg$c41 = function(neg, num) {
  25295. return parseInt(((neg || '') + num), 16);
  25296. },
  25297. peg$c42 = /^[0-9]/,
  25298. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  25299. peg$c44 = function(n) {return parseFloat(n, 10);},
  25300. peg$c45 = function(n) {return parseInt(n, 10);},
  25301. peg$c46 = "#(",
  25302. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  25303. peg$c48 = ")",
  25304. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  25305. peg$c50 = function(rest) {
  25306. return rest
  25307. ._location_(location())
  25308. ._source_(text());
  25309. },
  25310. peg$c51 = "(",
  25311. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  25312. peg$c53 = function(lit) {return lit._value();},
  25313. peg$c54 = function(lits) {
  25314. return $globals.ValueNode._new()
  25315. ._value_(lits);
  25316. },
  25317. peg$c55 = "{",
  25318. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  25319. peg$c57 = "}",
  25320. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  25321. peg$c59 = function(expressions) {
  25322. return $globals.DynamicArrayNode._new()
  25323. ._location_(location())
  25324. ._source_(text())
  25325. ._dagChildren_(expressions || []);
  25326. },
  25327. peg$c60 = "#{",
  25328. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  25329. peg$c62 = function(expressions) {
  25330. return $globals.DynamicDictionaryNode._new()
  25331. ._location_(location())
  25332. ._source_(text())
  25333. ._dagChildren_(expressions || []);
  25334. },
  25335. peg$c63 = "true",
  25336. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  25337. peg$c65 = function() {return true;},
  25338. peg$c66 = "false",
  25339. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  25340. peg$c68 = function() {return false;},
  25341. peg$c69 = "nil",
  25342. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  25343. peg$c71 = function() {return null;},
  25344. peg$c72 = function(identifier) {
  25345. return $globals.VariableNode._new()
  25346. ._location_(location())
  25347. ._source_(text())
  25348. ._value_(identifier);
  25349. },
  25350. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  25351. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  25352. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  25353. peg$c76 = function(pairs) {
  25354. var selector = '';
  25355. var params = [];
  25356. for(var i = 0; i < pairs.length; i++) {
  25357. selector += pairs[i].key;
  25358. params.push(pairs[i].arg);
  25359. }
  25360. return [selector, params];
  25361. },
  25362. peg$c77 = function(selector, arg) {
  25363. return [selector, [arg]];
  25364. },
  25365. peg$c78 = function(selector) {return [selector, []];},
  25366. peg$c79 = function(expression) {
  25367. return expression;
  25368. },
  25369. peg$c80 = function(first, others) {
  25370. return [first].concat(others);
  25371. },
  25372. peg$c81 = ":=",
  25373. peg$c82 = { type: "literal", value: ":=", description: "\":=\"" },
  25374. peg$c83 = function(variable, expression) {
  25375. return $globals.AssignmentNode._new()
  25376. ._location_(location())
  25377. ._source_(text())
  25378. ._left_(variable)
  25379. ._right_(expression);
  25380. },
  25381. peg$c84 = "^",
  25382. peg$c85 = { type: "literal", value: "^", description: "\"^\"" },
  25383. peg$c86 = function(expression) {
  25384. return $globals.ReturnNode._new()
  25385. ._location_(location())
  25386. ._source_(text())
  25387. ._dagChildren_([expression]);
  25388. },
  25389. peg$c87 = "|",
  25390. peg$c88 = { type: "literal", value: "|", description: "\"|\"" },
  25391. peg$c89 = function(variable) {return variable;},
  25392. peg$c90 = function(vars) {
  25393. return vars;
  25394. },
  25395. peg$c91 = function(param) {return param;},
  25396. peg$c92 = function(params) {
  25397. return params;
  25398. },
  25399. peg$c93 = function(ret) {return [ret];},
  25400. peg$c94 = function(exps, ret) {
  25401. var expressions = exps;
  25402. expressions.push(ret);
  25403. return expressions;
  25404. },
  25405. peg$c95 = function(expressions) {return expressions || [];},
  25406. peg$c96 = function(js) {return js;},
  25407. peg$c97 = function(temps, statements) {
  25408. return $globals.SequenceNode._new()
  25409. ._location_(location())
  25410. ._source_(text())
  25411. ._temps_(temps || [])
  25412. ._dagChildren_(statements || []);
  25413. },
  25414. peg$c98 = "[",
  25415. peg$c99 = { type: "literal", value: "[", description: "\"[\"" },
  25416. peg$c100 = "]",
  25417. peg$c101 = { type: "literal", value: "]", description: "\"]\"" },
  25418. peg$c102 = function(params, sequence) {
  25419. return $globals.BlockNode._new()
  25420. ._location_(location())
  25421. ._source_(text())
  25422. ._parameters_(params || [])
  25423. ._dagChildren_([sequence._asBlockSequenceNode()]);
  25424. },
  25425. peg$c103 = function(selector) {
  25426. return $globals.SendNode._new()
  25427. ._location_(location())
  25428. ._source_(text())
  25429. ._selector_(selector);
  25430. },
  25431. peg$c104 = function(receiver, tail) {
  25432. return receiver._withTail_(tail);
  25433. },
  25434. peg$c105 = function(selector, arg) {
  25435. return $globals.SendNode._new()
  25436. ._location_(location())
  25437. ._source_(text())
  25438. ._selector_(selector)
  25439. ._arguments_([arg]);
  25440. },
  25441. peg$c106 = function(pairs) {
  25442. var selector = '';
  25443. var args = [];
  25444. for(var i = 0; i < pairs.length; i++) {
  25445. selector += pairs[i].key;
  25446. args.push(pairs[i].arg);
  25447. }
  25448. return $globals.SendNode._new()
  25449. ._location_(location())
  25450. ._source_(text())
  25451. ._selector_(selector)
  25452. ._arguments_(args);
  25453. },
  25454. peg$c107 = function(receiver, tail) {
  25455. return tail ? receiver._withTail_([tail]) : receiver;
  25456. },
  25457. peg$c108 = function(send) {return send._isSendNode();},
  25458. peg$c109 = ";",
  25459. peg$c110 = { type: "literal", value: ";", description: "\";\"" },
  25460. peg$c111 = function(send, mess) {return mess;},
  25461. peg$c112 = function(send, messages) {
  25462. messages.unshift(send);
  25463. return $globals.CascadeNode._new()
  25464. ._location_(location())
  25465. ._source_(text())
  25466. ._dagChildren_(messages);
  25467. },
  25468. peg$c113 = "<",
  25469. peg$c114 = { type: "literal", value: "<", description: "\"<\"" },
  25470. peg$c115 = ">>",
  25471. peg$c116 = { type: "literal", value: ">>", description: "\">>\"" },
  25472. peg$c117 = function() {return '>';},
  25473. peg$c118 = /^[^>]/,
  25474. peg$c119 = { type: "class", value: "[^>]", description: "[^>]" },
  25475. peg$c120 = ">",
  25476. peg$c121 = { type: "literal", value: ">", description: "\">\"" },
  25477. peg$c122 = function(val) {return !/^\s*inlineJS/.test(val.join(''));},
  25478. peg$c123 = function(val) {
  25479. console.warn('Use of <...js code...> is deprecated, in:\n' + val.join(''));
  25480. return $globals.JSStatementNode._new()
  25481. ._location_(location())
  25482. ._source_(val.join(''))
  25483. },
  25484. peg$c124 = "inlineJS:",
  25485. peg$c125 = { type: "literal", value: "inlineJS:", description: "\"inlineJS:\"" },
  25486. peg$c126 = function(val) {
  25487. return $globals.JSStatementNode._new()
  25488. ._location_(location())
  25489. ._source_(val)
  25490. },
  25491. peg$c127 = function(pattern, sequence) {
  25492. return $globals.MethodNode._new()
  25493. ._location_(location())
  25494. ._source_(text())
  25495. ._selector_(pattern[0])
  25496. ._arguments_(pattern[1])
  25497. ._dagChildren_([sequence]);
  25498. },
  25499. peg$c128 = function(send) { return send._isSendNode() && send._selector() === '->' },
  25500. peg$c129 = function(send) {
  25501. return [send._receiver(), send._arguments()[0]];
  25502. },
  25503. peg$c130 = function(first, others) {
  25504. return first.concat.apply(first, others);
  25505. },
  25506. peg$currPos = 0,
  25507. peg$savedPos = 0,
  25508. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  25509. peg$maxFailPos = 0,
  25510. peg$maxFailExpected = [],
  25511. peg$silentFails = 0,
  25512. peg$resultsCache = {},
  25513. peg$result;
  25514. if ("startRule" in options) {
  25515. if (!(options.startRule in peg$startRuleFunctions)) {
  25516. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  25517. }
  25518. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  25519. }
  25520. function text() {
  25521. return input.substring(peg$savedPos, peg$currPos);
  25522. }
  25523. function location() {
  25524. return peg$computeLocation(peg$savedPos, peg$currPos);
  25525. }
  25526. function expected(description) {
  25527. throw peg$buildException(
  25528. null,
  25529. [{ type: "other", description: description }],
  25530. input.substring(peg$savedPos, peg$currPos),
  25531. peg$computeLocation(peg$savedPos, peg$currPos)
  25532. );
  25533. }
  25534. function error(message) {
  25535. throw peg$buildException(
  25536. message,
  25537. null,
  25538. input.substring(peg$savedPos, peg$currPos),
  25539. peg$computeLocation(peg$savedPos, peg$currPos)
  25540. );
  25541. }
  25542. function peg$computePosDetails(pos) {
  25543. var details = peg$posDetailsCache[pos],
  25544. p, ch;
  25545. if (details) {
  25546. return details;
  25547. } else {
  25548. p = pos - 1;
  25549. while (!peg$posDetailsCache[p]) {
  25550. p--;
  25551. }
  25552. details = peg$posDetailsCache[p];
  25553. details = {
  25554. line: details.line,
  25555. column: details.column,
  25556. seenCR: details.seenCR
  25557. };
  25558. while (p < pos) {
  25559. ch = input.charAt(p);
  25560. if (ch === "\n") {
  25561. if (!details.seenCR) { details.line++; }
  25562. details.column = 1;
  25563. details.seenCR = false;
  25564. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  25565. details.line++;
  25566. details.column = 1;
  25567. details.seenCR = true;
  25568. } else {
  25569. details.column++;
  25570. details.seenCR = false;
  25571. }
  25572. p++;
  25573. }
  25574. peg$posDetailsCache[pos] = details;
  25575. return details;
  25576. }
  25577. }
  25578. function peg$computeLocation(startPos, endPos) {
  25579. var startPosDetails = peg$computePosDetails(startPos),
  25580. endPosDetails = peg$computePosDetails(endPos);
  25581. return {
  25582. start: {
  25583. offset: startPos,
  25584. line: startPosDetails.line,
  25585. column: startPosDetails.column
  25586. },
  25587. end: {
  25588. offset: endPos,
  25589. line: endPosDetails.line,
  25590. column: endPosDetails.column
  25591. }
  25592. };
  25593. }
  25594. function peg$fail(expected) {
  25595. if (peg$currPos < peg$maxFailPos) { return; }
  25596. if (peg$currPos > peg$maxFailPos) {
  25597. peg$maxFailPos = peg$currPos;
  25598. peg$maxFailExpected = [];
  25599. }
  25600. peg$maxFailExpected.push(expected);
  25601. }
  25602. function peg$buildException(message, expected, found, location) {
  25603. function cleanupExpected(expected) {
  25604. var i = 1;
  25605. expected.sort(function(a, b) {
  25606. if (a.description < b.description) {
  25607. return -1;
  25608. } else if (a.description > b.description) {
  25609. return 1;
  25610. } else {
  25611. return 0;
  25612. }
  25613. });
  25614. while (i < expected.length) {
  25615. if (expected[i - 1] === expected[i]) {
  25616. expected.splice(i, 1);
  25617. } else {
  25618. i++;
  25619. }
  25620. }
  25621. }
  25622. function buildMessage(expected, found) {
  25623. function stringEscape(s) {
  25624. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  25625. return s
  25626. .replace(/\\/g, '\\\\')
  25627. .replace(/"/g, '\\"')
  25628. .replace(/\x08/g, '\\b')
  25629. .replace(/\t/g, '\\t')
  25630. .replace(/\n/g, '\\n')
  25631. .replace(/\f/g, '\\f')
  25632. .replace(/\r/g, '\\r')
  25633. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  25634. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  25635. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  25636. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  25637. }
  25638. var expectedDescs = new Array(expected.length),
  25639. expectedDesc, foundDesc, i;
  25640. for (i = 0; i < expected.length; i++) {
  25641. expectedDescs[i] = expected[i].description;
  25642. }
  25643. expectedDesc = expected.length > 1
  25644. ? expectedDescs.slice(0, -1).join(", ")
  25645. + " or "
  25646. + expectedDescs[expected.length - 1]
  25647. : expectedDescs[0];
  25648. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  25649. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  25650. }
  25651. if (expected !== null) {
  25652. cleanupExpected(expected);
  25653. }
  25654. return new peg$SyntaxError(
  25655. message !== null ? message : buildMessage(expected, found),
  25656. expected,
  25657. found,
  25658. location
  25659. );
  25660. }
  25661. function peg$parsestart() {
  25662. var s0;
  25663. var key = peg$currPos * 62 + 0,
  25664. cached = peg$resultsCache[key];
  25665. if (cached) {
  25666. peg$currPos = cached.nextPos;
  25667. return cached.result;
  25668. }
  25669. s0 = peg$parsemethod();
  25670. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25671. return s0;
  25672. }
  25673. function peg$parseseparator() {
  25674. var s0, s1;
  25675. var key = peg$currPos * 62 + 1,
  25676. cached = peg$resultsCache[key];
  25677. if (cached) {
  25678. peg$currPos = cached.nextPos;
  25679. return cached.result;
  25680. }
  25681. s0 = [];
  25682. if (peg$c0.test(input.charAt(peg$currPos))) {
  25683. s1 = input.charAt(peg$currPos);
  25684. peg$currPos++;
  25685. } else {
  25686. s1 = peg$FAILED;
  25687. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  25688. }
  25689. if (s1 !== peg$FAILED) {
  25690. while (s1 !== peg$FAILED) {
  25691. s0.push(s1);
  25692. if (peg$c0.test(input.charAt(peg$currPos))) {
  25693. s1 = input.charAt(peg$currPos);
  25694. peg$currPos++;
  25695. } else {
  25696. s1 = peg$FAILED;
  25697. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  25698. }
  25699. }
  25700. } else {
  25701. s0 = peg$FAILED;
  25702. }
  25703. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25704. return s0;
  25705. }
  25706. function peg$parsecomments() {
  25707. var s0, s1, s2, s3, s4;
  25708. var key = peg$currPos * 62 + 2,
  25709. cached = peg$resultsCache[key];
  25710. if (cached) {
  25711. peg$currPos = cached.nextPos;
  25712. return cached.result;
  25713. }
  25714. s0 = [];
  25715. s1 = peg$currPos;
  25716. if (input.charCodeAt(peg$currPos) === 34) {
  25717. s2 = peg$c2;
  25718. peg$currPos++;
  25719. } else {
  25720. s2 = peg$FAILED;
  25721. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  25722. }
  25723. if (s2 !== peg$FAILED) {
  25724. s3 = [];
  25725. if (peg$c4.test(input.charAt(peg$currPos))) {
  25726. s4 = input.charAt(peg$currPos);
  25727. peg$currPos++;
  25728. } else {
  25729. s4 = peg$FAILED;
  25730. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  25731. }
  25732. while (s4 !== peg$FAILED) {
  25733. s3.push(s4);
  25734. if (peg$c4.test(input.charAt(peg$currPos))) {
  25735. s4 = input.charAt(peg$currPos);
  25736. peg$currPos++;
  25737. } else {
  25738. s4 = peg$FAILED;
  25739. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  25740. }
  25741. }
  25742. if (s3 !== peg$FAILED) {
  25743. if (input.charCodeAt(peg$currPos) === 34) {
  25744. s4 = peg$c2;
  25745. peg$currPos++;
  25746. } else {
  25747. s4 = peg$FAILED;
  25748. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  25749. }
  25750. if (s4 !== peg$FAILED) {
  25751. s2 = [s2, s3, s4];
  25752. s1 = s2;
  25753. } else {
  25754. peg$currPos = s1;
  25755. s1 = peg$FAILED;
  25756. }
  25757. } else {
  25758. peg$currPos = s1;
  25759. s1 = peg$FAILED;
  25760. }
  25761. } else {
  25762. peg$currPos = s1;
  25763. s1 = peg$FAILED;
  25764. }
  25765. if (s1 !== peg$FAILED) {
  25766. while (s1 !== peg$FAILED) {
  25767. s0.push(s1);
  25768. s1 = peg$currPos;
  25769. if (input.charCodeAt(peg$currPos) === 34) {
  25770. s2 = peg$c2;
  25771. peg$currPos++;
  25772. } else {
  25773. s2 = peg$FAILED;
  25774. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  25775. }
  25776. if (s2 !== peg$FAILED) {
  25777. s3 = [];
  25778. if (peg$c4.test(input.charAt(peg$currPos))) {
  25779. s4 = input.charAt(peg$currPos);
  25780. peg$currPos++;
  25781. } else {
  25782. s4 = peg$FAILED;
  25783. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  25784. }
  25785. while (s4 !== peg$FAILED) {
  25786. s3.push(s4);
  25787. if (peg$c4.test(input.charAt(peg$currPos))) {
  25788. s4 = input.charAt(peg$currPos);
  25789. peg$currPos++;
  25790. } else {
  25791. s4 = peg$FAILED;
  25792. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  25793. }
  25794. }
  25795. if (s3 !== peg$FAILED) {
  25796. if (input.charCodeAt(peg$currPos) === 34) {
  25797. s4 = peg$c2;
  25798. peg$currPos++;
  25799. } else {
  25800. s4 = peg$FAILED;
  25801. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  25802. }
  25803. if (s4 !== peg$FAILED) {
  25804. s2 = [s2, s3, s4];
  25805. s1 = s2;
  25806. } else {
  25807. peg$currPos = s1;
  25808. s1 = peg$FAILED;
  25809. }
  25810. } else {
  25811. peg$currPos = s1;
  25812. s1 = peg$FAILED;
  25813. }
  25814. } else {
  25815. peg$currPos = s1;
  25816. s1 = peg$FAILED;
  25817. }
  25818. }
  25819. } else {
  25820. s0 = peg$FAILED;
  25821. }
  25822. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25823. return s0;
  25824. }
  25825. function peg$parsews() {
  25826. var s0, s1;
  25827. var key = peg$currPos * 62 + 3,
  25828. cached = peg$resultsCache[key];
  25829. if (cached) {
  25830. peg$currPos = cached.nextPos;
  25831. return cached.result;
  25832. }
  25833. s0 = [];
  25834. s1 = peg$parseseparator();
  25835. if (s1 === peg$FAILED) {
  25836. s1 = peg$parsecomments();
  25837. }
  25838. while (s1 !== peg$FAILED) {
  25839. s0.push(s1);
  25840. s1 = peg$parseseparator();
  25841. if (s1 === peg$FAILED) {
  25842. s1 = peg$parsecomments();
  25843. }
  25844. }
  25845. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25846. return s0;
  25847. }
  25848. function peg$parsemaybeDotsWs() {
  25849. var s0, s1;
  25850. var key = peg$currPos * 62 + 4,
  25851. cached = peg$resultsCache[key];
  25852. if (cached) {
  25853. peg$currPos = cached.nextPos;
  25854. return cached.result;
  25855. }
  25856. s0 = [];
  25857. if (input.charCodeAt(peg$currPos) === 46) {
  25858. s1 = peg$c6;
  25859. peg$currPos++;
  25860. } else {
  25861. s1 = peg$FAILED;
  25862. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25863. }
  25864. if (s1 === peg$FAILED) {
  25865. s1 = peg$parseseparator();
  25866. if (s1 === peg$FAILED) {
  25867. s1 = peg$parsecomments();
  25868. }
  25869. }
  25870. while (s1 !== peg$FAILED) {
  25871. s0.push(s1);
  25872. if (input.charCodeAt(peg$currPos) === 46) {
  25873. s1 = peg$c6;
  25874. peg$currPos++;
  25875. } else {
  25876. s1 = peg$FAILED;
  25877. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25878. }
  25879. if (s1 === peg$FAILED) {
  25880. s1 = peg$parseseparator();
  25881. if (s1 === peg$FAILED) {
  25882. s1 = peg$parsecomments();
  25883. }
  25884. }
  25885. }
  25886. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25887. return s0;
  25888. }
  25889. function peg$parseidentifier() {
  25890. var s0, s1, s2, s3, s4;
  25891. var key = peg$currPos * 62 + 5,
  25892. cached = peg$resultsCache[key];
  25893. if (cached) {
  25894. peg$currPos = cached.nextPos;
  25895. return cached.result;
  25896. }
  25897. s0 = peg$currPos;
  25898. s1 = peg$currPos;
  25899. if (peg$c8.test(input.charAt(peg$currPos))) {
  25900. s2 = input.charAt(peg$currPos);
  25901. peg$currPos++;
  25902. } else {
  25903. s2 = peg$FAILED;
  25904. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  25905. }
  25906. if (s2 !== peg$FAILED) {
  25907. s3 = [];
  25908. if (peg$c10.test(input.charAt(peg$currPos))) {
  25909. s4 = input.charAt(peg$currPos);
  25910. peg$currPos++;
  25911. } else {
  25912. s4 = peg$FAILED;
  25913. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  25914. }
  25915. while (s4 !== peg$FAILED) {
  25916. s3.push(s4);
  25917. if (peg$c10.test(input.charAt(peg$currPos))) {
  25918. s4 = input.charAt(peg$currPos);
  25919. peg$currPos++;
  25920. } else {
  25921. s4 = peg$FAILED;
  25922. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  25923. }
  25924. }
  25925. if (s3 !== peg$FAILED) {
  25926. s2 = [s2, s3];
  25927. s1 = s2;
  25928. } else {
  25929. peg$currPos = s1;
  25930. s1 = peg$FAILED;
  25931. }
  25932. } else {
  25933. peg$currPos = s1;
  25934. s1 = peg$FAILED;
  25935. }
  25936. if (s1 !== peg$FAILED) {
  25937. s0 = input.substring(s0, peg$currPos);
  25938. } else {
  25939. s0 = s1;
  25940. }
  25941. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25942. return s0;
  25943. }
  25944. function peg$parsekeyword() {
  25945. var s0, s1, s2, s3;
  25946. var key = peg$currPos * 62 + 6,
  25947. cached = peg$resultsCache[key];
  25948. if (cached) {
  25949. peg$currPos = cached.nextPos;
  25950. return cached.result;
  25951. }
  25952. s0 = peg$currPos;
  25953. s1 = peg$currPos;
  25954. s2 = peg$parseidentifier();
  25955. if (s2 !== peg$FAILED) {
  25956. if (input.charCodeAt(peg$currPos) === 58) {
  25957. s3 = peg$c12;
  25958. peg$currPos++;
  25959. } else {
  25960. s3 = peg$FAILED;
  25961. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  25962. }
  25963. if (s3 !== peg$FAILED) {
  25964. s2 = [s2, s3];
  25965. s1 = s2;
  25966. } else {
  25967. peg$currPos = s1;
  25968. s1 = peg$FAILED;
  25969. }
  25970. } else {
  25971. peg$currPos = s1;
  25972. s1 = peg$FAILED;
  25973. }
  25974. if (s1 !== peg$FAILED) {
  25975. s0 = input.substring(s0, peg$currPos);
  25976. } else {
  25977. s0 = s1;
  25978. }
  25979. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25980. return s0;
  25981. }
  25982. function peg$parseclassName() {
  25983. var s0, s1, s2, s3, s4;
  25984. var key = peg$currPos * 62 + 7,
  25985. cached = peg$resultsCache[key];
  25986. if (cached) {
  25987. peg$currPos = cached.nextPos;
  25988. return cached.result;
  25989. }
  25990. s0 = peg$currPos;
  25991. s1 = peg$currPos;
  25992. if (peg$c14.test(input.charAt(peg$currPos))) {
  25993. s2 = input.charAt(peg$currPos);
  25994. peg$currPos++;
  25995. } else {
  25996. s2 = peg$FAILED;
  25997. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  25998. }
  25999. if (s2 !== peg$FAILED) {
  26000. s3 = [];
  26001. if (peg$c10.test(input.charAt(peg$currPos))) {
  26002. s4 = input.charAt(peg$currPos);
  26003. peg$currPos++;
  26004. } else {
  26005. s4 = peg$FAILED;
  26006. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  26007. }
  26008. while (s4 !== peg$FAILED) {
  26009. s3.push(s4);
  26010. if (peg$c10.test(input.charAt(peg$currPos))) {
  26011. s4 = input.charAt(peg$currPos);
  26012. peg$currPos++;
  26013. } else {
  26014. s4 = peg$FAILED;
  26015. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  26016. }
  26017. }
  26018. if (s3 !== peg$FAILED) {
  26019. s2 = [s2, s3];
  26020. s1 = s2;
  26021. } else {
  26022. peg$currPos = s1;
  26023. s1 = peg$FAILED;
  26024. }
  26025. } else {
  26026. peg$currPos = s1;
  26027. s1 = peg$FAILED;
  26028. }
  26029. if (s1 !== peg$FAILED) {
  26030. s0 = input.substring(s0, peg$currPos);
  26031. } else {
  26032. s0 = s1;
  26033. }
  26034. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26035. return s0;
  26036. }
  26037. function peg$parsestring() {
  26038. var s0, s1;
  26039. var key = peg$currPos * 62 + 8,
  26040. cached = peg$resultsCache[key];
  26041. if (cached) {
  26042. peg$currPos = cached.nextPos;
  26043. return cached.result;
  26044. }
  26045. s0 = peg$currPos;
  26046. s1 = peg$parserawString();
  26047. if (s1 !== peg$FAILED) {
  26048. peg$savedPos = s0;
  26049. s1 = peg$c16(s1);
  26050. }
  26051. s0 = s1;
  26052. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26053. return s0;
  26054. }
  26055. function peg$parserawString() {
  26056. var s0, s1, s2, s3, s4;
  26057. var key = peg$currPos * 62 + 9,
  26058. cached = peg$resultsCache[key];
  26059. if (cached) {
  26060. peg$currPos = cached.nextPos;
  26061. return cached.result;
  26062. }
  26063. s0 = peg$currPos;
  26064. if (input.charCodeAt(peg$currPos) === 39) {
  26065. s1 = peg$c17;
  26066. peg$currPos++;
  26067. } else {
  26068. s1 = peg$FAILED;
  26069. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  26070. }
  26071. if (s1 !== peg$FAILED) {
  26072. s2 = [];
  26073. s3 = peg$currPos;
  26074. if (input.substr(peg$currPos, 2) === peg$c19) {
  26075. s4 = peg$c19;
  26076. peg$currPos += 2;
  26077. } else {
  26078. s4 = peg$FAILED;
  26079. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  26080. }
  26081. if (s4 !== peg$FAILED) {
  26082. peg$savedPos = s3;
  26083. s4 = peg$c21();
  26084. }
  26085. s3 = s4;
  26086. if (s3 === peg$FAILED) {
  26087. if (peg$c22.test(input.charAt(peg$currPos))) {
  26088. s3 = input.charAt(peg$currPos);
  26089. peg$currPos++;
  26090. } else {
  26091. s3 = peg$FAILED;
  26092. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  26093. }
  26094. }
  26095. while (s3 !== peg$FAILED) {
  26096. s2.push(s3);
  26097. s3 = peg$currPos;
  26098. if (input.substr(peg$currPos, 2) === peg$c19) {
  26099. s4 = peg$c19;
  26100. peg$currPos += 2;
  26101. } else {
  26102. s4 = peg$FAILED;
  26103. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  26104. }
  26105. if (s4 !== peg$FAILED) {
  26106. peg$savedPos = s3;
  26107. s4 = peg$c21();
  26108. }
  26109. s3 = s4;
  26110. if (s3 === peg$FAILED) {
  26111. if (peg$c22.test(input.charAt(peg$currPos))) {
  26112. s3 = input.charAt(peg$currPos);
  26113. peg$currPos++;
  26114. } else {
  26115. s3 = peg$FAILED;
  26116. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  26117. }
  26118. }
  26119. }
  26120. if (s2 !== peg$FAILED) {
  26121. if (input.charCodeAt(peg$currPos) === 39) {
  26122. s3 = peg$c17;
  26123. peg$currPos++;
  26124. } else {
  26125. s3 = peg$FAILED;
  26126. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  26127. }
  26128. if (s3 !== peg$FAILED) {
  26129. peg$savedPos = s0;
  26130. s1 = peg$c24(s2);
  26131. s0 = s1;
  26132. } else {
  26133. peg$currPos = s0;
  26134. s0 = peg$FAILED;
  26135. }
  26136. } else {
  26137. peg$currPos = s0;
  26138. s0 = peg$FAILED;
  26139. }
  26140. } else {
  26141. peg$currPos = s0;
  26142. s0 = peg$FAILED;
  26143. }
  26144. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26145. return s0;
  26146. }
  26147. function peg$parsecharacter() {
  26148. var s0, s1, s2;
  26149. var key = peg$currPos * 62 + 10,
  26150. cached = peg$resultsCache[key];
  26151. if (cached) {
  26152. peg$currPos = cached.nextPos;
  26153. return cached.result;
  26154. }
  26155. s0 = peg$currPos;
  26156. if (input.charCodeAt(peg$currPos) === 36) {
  26157. s1 = peg$c25;
  26158. peg$currPos++;
  26159. } else {
  26160. s1 = peg$FAILED;
  26161. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  26162. }
  26163. if (s1 !== peg$FAILED) {
  26164. if (input.length > peg$currPos) {
  26165. s2 = input.charAt(peg$currPos);
  26166. peg$currPos++;
  26167. } else {
  26168. s2 = peg$FAILED;
  26169. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  26170. }
  26171. if (s2 !== peg$FAILED) {
  26172. peg$savedPos = s0;
  26173. s1 = peg$c28(s2);
  26174. s0 = s1;
  26175. } else {
  26176. peg$currPos = s0;
  26177. s0 = peg$FAILED;
  26178. }
  26179. } else {
  26180. peg$currPos = s0;
  26181. s0 = peg$FAILED;
  26182. }
  26183. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26184. return s0;
  26185. }
  26186. function peg$parsesymbol() {
  26187. var s0, s1, s2;
  26188. var key = peg$currPos * 62 + 11,
  26189. cached = peg$resultsCache[key];
  26190. if (cached) {
  26191. peg$currPos = cached.nextPos;
  26192. return cached.result;
  26193. }
  26194. s0 = peg$currPos;
  26195. if (input.charCodeAt(peg$currPos) === 35) {
  26196. s1 = peg$c29;
  26197. peg$currPos++;
  26198. } else {
  26199. s1 = peg$FAILED;
  26200. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  26201. }
  26202. if (s1 !== peg$FAILED) {
  26203. s2 = peg$parsebareSymbol();
  26204. if (s2 !== peg$FAILED) {
  26205. peg$savedPos = s0;
  26206. s1 = peg$c31(s2);
  26207. s0 = s1;
  26208. } else {
  26209. peg$currPos = s0;
  26210. s0 = peg$FAILED;
  26211. }
  26212. } else {
  26213. peg$currPos = s0;
  26214. s0 = peg$FAILED;
  26215. }
  26216. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26217. return s0;
  26218. }
  26219. function peg$parsebareSymbol() {
  26220. var s0, s1, s2, s3;
  26221. var key = peg$currPos * 62 + 12,
  26222. cached = peg$resultsCache[key];
  26223. if (cached) {
  26224. peg$currPos = cached.nextPos;
  26225. return cached.result;
  26226. }
  26227. s0 = peg$currPos;
  26228. s1 = peg$currPos;
  26229. s2 = [];
  26230. s3 = peg$parsekeyword();
  26231. if (s3 !== peg$FAILED) {
  26232. while (s3 !== peg$FAILED) {
  26233. s2.push(s3);
  26234. s3 = peg$parsekeyword();
  26235. }
  26236. } else {
  26237. s2 = peg$FAILED;
  26238. }
  26239. if (s2 !== peg$FAILED) {
  26240. s1 = input.substring(s1, peg$currPos);
  26241. } else {
  26242. s1 = s2;
  26243. }
  26244. if (s1 === peg$FAILED) {
  26245. s1 = peg$parsebinarySelector();
  26246. if (s1 === peg$FAILED) {
  26247. s1 = peg$parseidentifier();
  26248. if (s1 === peg$FAILED) {
  26249. s1 = peg$parserawString();
  26250. }
  26251. }
  26252. }
  26253. if (s1 !== peg$FAILED) {
  26254. peg$savedPos = s0;
  26255. s1 = peg$c16(s1);
  26256. }
  26257. s0 = s1;
  26258. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26259. return s0;
  26260. }
  26261. function peg$parsenumber() {
  26262. var s0, s1;
  26263. var key = peg$currPos * 62 + 13,
  26264. cached = peg$resultsCache[key];
  26265. if (cached) {
  26266. peg$currPos = cached.nextPos;
  26267. return cached.result;
  26268. }
  26269. s0 = peg$currPos;
  26270. s1 = peg$parserawNumber();
  26271. if (s1 !== peg$FAILED) {
  26272. peg$savedPos = s0;
  26273. s1 = peg$c16(s1);
  26274. }
  26275. s0 = s1;
  26276. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26277. return s0;
  26278. }
  26279. function peg$parserawNumber() {
  26280. var s0;
  26281. var key = peg$currPos * 62 + 14,
  26282. cached = peg$resultsCache[key];
  26283. if (cached) {
  26284. peg$currPos = cached.nextPos;
  26285. return cached.result;
  26286. }
  26287. s0 = peg$parsenumberExp();
  26288. if (s0 === peg$FAILED) {
  26289. s0 = peg$parsehex();
  26290. if (s0 === peg$FAILED) {
  26291. s0 = peg$parsefloat();
  26292. if (s0 === peg$FAILED) {
  26293. s0 = peg$parseinteger();
  26294. }
  26295. }
  26296. }
  26297. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26298. return s0;
  26299. }
  26300. function peg$parsenumberExp() {
  26301. var s0, s1, s2, s3, s4, s5;
  26302. var key = peg$currPos * 62 + 15,
  26303. cached = peg$resultsCache[key];
  26304. if (cached) {
  26305. peg$currPos = cached.nextPos;
  26306. return cached.result;
  26307. }
  26308. s0 = peg$currPos;
  26309. s1 = peg$currPos;
  26310. s2 = peg$currPos;
  26311. s3 = peg$parsefloat();
  26312. if (s3 === peg$FAILED) {
  26313. s3 = peg$parseinteger();
  26314. }
  26315. if (s3 !== peg$FAILED) {
  26316. if (input.charCodeAt(peg$currPos) === 101) {
  26317. s4 = peg$c32;
  26318. peg$currPos++;
  26319. } else {
  26320. s4 = peg$FAILED;
  26321. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  26322. }
  26323. if (s4 !== peg$FAILED) {
  26324. s5 = peg$parseinteger();
  26325. if (s5 !== peg$FAILED) {
  26326. s3 = [s3, s4, s5];
  26327. s2 = s3;
  26328. } else {
  26329. peg$currPos = s2;
  26330. s2 = peg$FAILED;
  26331. }
  26332. } else {
  26333. peg$currPos = s2;
  26334. s2 = peg$FAILED;
  26335. }
  26336. } else {
  26337. peg$currPos = s2;
  26338. s2 = peg$FAILED;
  26339. }
  26340. if (s2 !== peg$FAILED) {
  26341. s1 = input.substring(s1, peg$currPos);
  26342. } else {
  26343. s1 = s2;
  26344. }
  26345. if (s1 !== peg$FAILED) {
  26346. peg$savedPos = s0;
  26347. s1 = peg$c34(s1);
  26348. }
  26349. s0 = s1;
  26350. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26351. return s0;
  26352. }
  26353. function peg$parsehex() {
  26354. var s0, s1, s2, s3, s4, s5;
  26355. var key = peg$currPos * 62 + 16,
  26356. cached = peg$resultsCache[key];
  26357. if (cached) {
  26358. peg$currPos = cached.nextPos;
  26359. return cached.result;
  26360. }
  26361. s0 = peg$currPos;
  26362. if (input.charCodeAt(peg$currPos) === 45) {
  26363. s1 = peg$c35;
  26364. peg$currPos++;
  26365. } else {
  26366. s1 = peg$FAILED;
  26367. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  26368. }
  26369. if (s1 === peg$FAILED) {
  26370. s1 = null;
  26371. }
  26372. if (s1 !== peg$FAILED) {
  26373. if (input.substr(peg$currPos, 3) === peg$c37) {
  26374. s2 = peg$c37;
  26375. peg$currPos += 3;
  26376. } else {
  26377. s2 = peg$FAILED;
  26378. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  26379. }
  26380. if (s2 !== peg$FAILED) {
  26381. s3 = peg$currPos;
  26382. s4 = [];
  26383. if (peg$c39.test(input.charAt(peg$currPos))) {
  26384. s5 = input.charAt(peg$currPos);
  26385. peg$currPos++;
  26386. } else {
  26387. s5 = peg$FAILED;
  26388. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  26389. }
  26390. if (s5 !== peg$FAILED) {
  26391. while (s5 !== peg$FAILED) {
  26392. s4.push(s5);
  26393. if (peg$c39.test(input.charAt(peg$currPos))) {
  26394. s5 = input.charAt(peg$currPos);
  26395. peg$currPos++;
  26396. } else {
  26397. s5 = peg$FAILED;
  26398. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  26399. }
  26400. }
  26401. } else {
  26402. s4 = peg$FAILED;
  26403. }
  26404. if (s4 !== peg$FAILED) {
  26405. s3 = input.substring(s3, peg$currPos);
  26406. } else {
  26407. s3 = s4;
  26408. }
  26409. if (s3 !== peg$FAILED) {
  26410. peg$savedPos = s0;
  26411. s1 = peg$c41(s1, s3);
  26412. s0 = s1;
  26413. } else {
  26414. peg$currPos = s0;
  26415. s0 = peg$FAILED;
  26416. }
  26417. } else {
  26418. peg$currPos = s0;
  26419. s0 = peg$FAILED;
  26420. }
  26421. } else {
  26422. peg$currPos = s0;
  26423. s0 = peg$FAILED;
  26424. }
  26425. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26426. return s0;
  26427. }
  26428. function peg$parsefloat() {
  26429. var s0, s1, s2, s3, s4, s5, s6, s7;
  26430. var key = peg$currPos * 62 + 17,
  26431. cached = peg$resultsCache[key];
  26432. if (cached) {
  26433. peg$currPos = cached.nextPos;
  26434. return cached.result;
  26435. }
  26436. s0 = peg$currPos;
  26437. s1 = peg$currPos;
  26438. s2 = peg$currPos;
  26439. if (input.charCodeAt(peg$currPos) === 45) {
  26440. s3 = peg$c35;
  26441. peg$currPos++;
  26442. } else {
  26443. s3 = peg$FAILED;
  26444. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  26445. }
  26446. if (s3 === peg$FAILED) {
  26447. s3 = null;
  26448. }
  26449. if (s3 !== peg$FAILED) {
  26450. s4 = [];
  26451. if (peg$c42.test(input.charAt(peg$currPos))) {
  26452. s5 = input.charAt(peg$currPos);
  26453. peg$currPos++;
  26454. } else {
  26455. s5 = peg$FAILED;
  26456. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26457. }
  26458. if (s5 !== peg$FAILED) {
  26459. while (s5 !== peg$FAILED) {
  26460. s4.push(s5);
  26461. if (peg$c42.test(input.charAt(peg$currPos))) {
  26462. s5 = input.charAt(peg$currPos);
  26463. peg$currPos++;
  26464. } else {
  26465. s5 = peg$FAILED;
  26466. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26467. }
  26468. }
  26469. } else {
  26470. s4 = peg$FAILED;
  26471. }
  26472. if (s4 !== peg$FAILED) {
  26473. if (input.charCodeAt(peg$currPos) === 46) {
  26474. s5 = peg$c6;
  26475. peg$currPos++;
  26476. } else {
  26477. s5 = peg$FAILED;
  26478. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26479. }
  26480. if (s5 !== peg$FAILED) {
  26481. s6 = [];
  26482. if (peg$c42.test(input.charAt(peg$currPos))) {
  26483. s7 = input.charAt(peg$currPos);
  26484. peg$currPos++;
  26485. } else {
  26486. s7 = peg$FAILED;
  26487. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26488. }
  26489. if (s7 !== peg$FAILED) {
  26490. while (s7 !== peg$FAILED) {
  26491. s6.push(s7);
  26492. if (peg$c42.test(input.charAt(peg$currPos))) {
  26493. s7 = input.charAt(peg$currPos);
  26494. peg$currPos++;
  26495. } else {
  26496. s7 = peg$FAILED;
  26497. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26498. }
  26499. }
  26500. } else {
  26501. s6 = peg$FAILED;
  26502. }
  26503. if (s6 !== peg$FAILED) {
  26504. s3 = [s3, s4, s5, s6];
  26505. s2 = s3;
  26506. } else {
  26507. peg$currPos = s2;
  26508. s2 = peg$FAILED;
  26509. }
  26510. } else {
  26511. peg$currPos = s2;
  26512. s2 = peg$FAILED;
  26513. }
  26514. } else {
  26515. peg$currPos = s2;
  26516. s2 = peg$FAILED;
  26517. }
  26518. } else {
  26519. peg$currPos = s2;
  26520. s2 = peg$FAILED;
  26521. }
  26522. if (s2 !== peg$FAILED) {
  26523. s1 = input.substring(s1, peg$currPos);
  26524. } else {
  26525. s1 = s2;
  26526. }
  26527. if (s1 !== peg$FAILED) {
  26528. peg$savedPos = s0;
  26529. s1 = peg$c44(s1);
  26530. }
  26531. s0 = s1;
  26532. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26533. return s0;
  26534. }
  26535. function peg$parseinteger() {
  26536. var s0, s1, s2, s3, s4, s5;
  26537. var key = peg$currPos * 62 + 18,
  26538. cached = peg$resultsCache[key];
  26539. if (cached) {
  26540. peg$currPos = cached.nextPos;
  26541. return cached.result;
  26542. }
  26543. s0 = peg$currPos;
  26544. s1 = peg$currPos;
  26545. s2 = peg$currPos;
  26546. if (input.charCodeAt(peg$currPos) === 45) {
  26547. s3 = peg$c35;
  26548. peg$currPos++;
  26549. } else {
  26550. s3 = peg$FAILED;
  26551. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  26552. }
  26553. if (s3 === peg$FAILED) {
  26554. s3 = null;
  26555. }
  26556. if (s3 !== peg$FAILED) {
  26557. s4 = [];
  26558. if (peg$c42.test(input.charAt(peg$currPos))) {
  26559. s5 = input.charAt(peg$currPos);
  26560. peg$currPos++;
  26561. } else {
  26562. s5 = peg$FAILED;
  26563. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26564. }
  26565. if (s5 !== peg$FAILED) {
  26566. while (s5 !== peg$FAILED) {
  26567. s4.push(s5);
  26568. if (peg$c42.test(input.charAt(peg$currPos))) {
  26569. s5 = input.charAt(peg$currPos);
  26570. peg$currPos++;
  26571. } else {
  26572. s5 = peg$FAILED;
  26573. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26574. }
  26575. }
  26576. } else {
  26577. s4 = peg$FAILED;
  26578. }
  26579. if (s4 !== peg$FAILED) {
  26580. s3 = [s3, s4];
  26581. s2 = s3;
  26582. } else {
  26583. peg$currPos = s2;
  26584. s2 = peg$FAILED;
  26585. }
  26586. } else {
  26587. peg$currPos = s2;
  26588. s2 = peg$FAILED;
  26589. }
  26590. if (s2 !== peg$FAILED) {
  26591. s1 = input.substring(s1, peg$currPos);
  26592. } else {
  26593. s1 = s2;
  26594. }
  26595. if (s1 !== peg$FAILED) {
  26596. peg$savedPos = s0;
  26597. s1 = peg$c45(s1);
  26598. }
  26599. s0 = s1;
  26600. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26601. return s0;
  26602. }
  26603. function peg$parseliteralArray() {
  26604. var s0, s1, s2, s3, s4;
  26605. var key = peg$currPos * 62 + 19,
  26606. cached = peg$resultsCache[key];
  26607. if (cached) {
  26608. peg$currPos = cached.nextPos;
  26609. return cached.result;
  26610. }
  26611. s0 = peg$currPos;
  26612. if (input.substr(peg$currPos, 2) === peg$c46) {
  26613. s1 = peg$c46;
  26614. peg$currPos += 2;
  26615. } else {
  26616. s1 = peg$FAILED;
  26617. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  26618. }
  26619. if (s1 !== peg$FAILED) {
  26620. s2 = peg$parsewsLiteralArrayContents();
  26621. if (s2 !== peg$FAILED) {
  26622. s3 = peg$parsews();
  26623. if (s3 !== peg$FAILED) {
  26624. if (input.charCodeAt(peg$currPos) === 41) {
  26625. s4 = peg$c48;
  26626. peg$currPos++;
  26627. } else {
  26628. s4 = peg$FAILED;
  26629. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  26630. }
  26631. if (s4 !== peg$FAILED) {
  26632. peg$savedPos = s0;
  26633. s1 = peg$c50(s2);
  26634. s0 = s1;
  26635. } else {
  26636. peg$currPos = s0;
  26637. s0 = peg$FAILED;
  26638. }
  26639. } else {
  26640. peg$currPos = s0;
  26641. s0 = peg$FAILED;
  26642. }
  26643. } else {
  26644. peg$currPos = s0;
  26645. s0 = peg$FAILED;
  26646. }
  26647. } else {
  26648. peg$currPos = s0;
  26649. s0 = peg$FAILED;
  26650. }
  26651. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26652. return s0;
  26653. }
  26654. function peg$parsebareLiteralArray() {
  26655. var s0, s1, s2, s3, s4;
  26656. var key = peg$currPos * 62 + 20,
  26657. cached = peg$resultsCache[key];
  26658. if (cached) {
  26659. peg$currPos = cached.nextPos;
  26660. return cached.result;
  26661. }
  26662. s0 = peg$currPos;
  26663. if (input.charCodeAt(peg$currPos) === 40) {
  26664. s1 = peg$c51;
  26665. peg$currPos++;
  26666. } else {
  26667. s1 = peg$FAILED;
  26668. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26669. }
  26670. if (s1 !== peg$FAILED) {
  26671. s2 = peg$parsewsLiteralArrayContents();
  26672. if (s2 !== peg$FAILED) {
  26673. s3 = peg$parsews();
  26674. if (s3 !== peg$FAILED) {
  26675. if (input.charCodeAt(peg$currPos) === 41) {
  26676. s4 = peg$c48;
  26677. peg$currPos++;
  26678. } else {
  26679. s4 = peg$FAILED;
  26680. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  26681. }
  26682. if (s4 !== peg$FAILED) {
  26683. peg$savedPos = s0;
  26684. s1 = peg$c50(s2);
  26685. s0 = s1;
  26686. } else {
  26687. peg$currPos = s0;
  26688. s0 = peg$FAILED;
  26689. }
  26690. } else {
  26691. peg$currPos = s0;
  26692. s0 = peg$FAILED;
  26693. }
  26694. } else {
  26695. peg$currPos = s0;
  26696. s0 = peg$FAILED;
  26697. }
  26698. } else {
  26699. peg$currPos = s0;
  26700. s0 = peg$FAILED;
  26701. }
  26702. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26703. return s0;
  26704. }
  26705. function peg$parseliteralArrayElement() {
  26706. var s0;
  26707. var key = peg$currPos * 62 + 21,
  26708. cached = peg$resultsCache[key];
  26709. if (cached) {
  26710. peg$currPos = cached.nextPos;
  26711. return cached.result;
  26712. }
  26713. s0 = peg$parseparseTimeLiteral();
  26714. if (s0 === peg$FAILED) {
  26715. s0 = peg$parsebareLiteralArray();
  26716. if (s0 === peg$FAILED) {
  26717. s0 = peg$parsebareSymbol();
  26718. }
  26719. }
  26720. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26721. return s0;
  26722. }
  26723. function peg$parsewsLiteralArrayContents() {
  26724. var s0, s1, s2, s3, s4;
  26725. var key = peg$currPos * 62 + 22,
  26726. cached = peg$resultsCache[key];
  26727. if (cached) {
  26728. peg$currPos = cached.nextPos;
  26729. return cached.result;
  26730. }
  26731. s0 = peg$currPos;
  26732. s1 = [];
  26733. s2 = peg$currPos;
  26734. s3 = peg$parsews();
  26735. if (s3 !== peg$FAILED) {
  26736. s4 = peg$parseliteralArrayElement();
  26737. if (s4 !== peg$FAILED) {
  26738. peg$savedPos = s2;
  26739. s3 = peg$c53(s4);
  26740. s2 = s3;
  26741. } else {
  26742. peg$currPos = s2;
  26743. s2 = peg$FAILED;
  26744. }
  26745. } else {
  26746. peg$currPos = s2;
  26747. s2 = peg$FAILED;
  26748. }
  26749. while (s2 !== peg$FAILED) {
  26750. s1.push(s2);
  26751. s2 = peg$currPos;
  26752. s3 = peg$parsews();
  26753. if (s3 !== peg$FAILED) {
  26754. s4 = peg$parseliteralArrayElement();
  26755. if (s4 !== peg$FAILED) {
  26756. peg$savedPos = s2;
  26757. s3 = peg$c53(s4);
  26758. s2 = s3;
  26759. } else {
  26760. peg$currPos = s2;
  26761. s2 = peg$FAILED;
  26762. }
  26763. } else {
  26764. peg$currPos = s2;
  26765. s2 = peg$FAILED;
  26766. }
  26767. }
  26768. if (s1 !== peg$FAILED) {
  26769. peg$savedPos = s0;
  26770. s1 = peg$c54(s1);
  26771. }
  26772. s0 = s1;
  26773. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26774. return s0;
  26775. }
  26776. function peg$parsedynamicArray() {
  26777. var s0, s1, s2, s3, s4;
  26778. var key = peg$currPos * 62 + 23,
  26779. cached = peg$resultsCache[key];
  26780. if (cached) {
  26781. peg$currPos = cached.nextPos;
  26782. return cached.result;
  26783. }
  26784. s0 = peg$currPos;
  26785. if (input.charCodeAt(peg$currPos) === 123) {
  26786. s1 = peg$c55;
  26787. peg$currPos++;
  26788. } else {
  26789. s1 = peg$FAILED;
  26790. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  26791. }
  26792. if (s1 !== peg$FAILED) {
  26793. s2 = peg$parsewsExpressions();
  26794. if (s2 === peg$FAILED) {
  26795. s2 = null;
  26796. }
  26797. if (s2 !== peg$FAILED) {
  26798. s3 = peg$parsemaybeDotsWs();
  26799. if (s3 !== peg$FAILED) {
  26800. if (input.charCodeAt(peg$currPos) === 125) {
  26801. s4 = peg$c57;
  26802. peg$currPos++;
  26803. } else {
  26804. s4 = peg$FAILED;
  26805. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  26806. }
  26807. if (s4 !== peg$FAILED) {
  26808. peg$savedPos = s0;
  26809. s1 = peg$c59(s2);
  26810. s0 = s1;
  26811. } else {
  26812. peg$currPos = s0;
  26813. s0 = peg$FAILED;
  26814. }
  26815. } else {
  26816. peg$currPos = s0;
  26817. s0 = peg$FAILED;
  26818. }
  26819. } else {
  26820. peg$currPos = s0;
  26821. s0 = peg$FAILED;
  26822. }
  26823. } else {
  26824. peg$currPos = s0;
  26825. s0 = peg$FAILED;
  26826. }
  26827. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26828. return s0;
  26829. }
  26830. function peg$parsedynamicDictionary() {
  26831. var s0, s1, s2, s3, s4;
  26832. var key = peg$currPos * 62 + 24,
  26833. cached = peg$resultsCache[key];
  26834. if (cached) {
  26835. peg$currPos = cached.nextPos;
  26836. return cached.result;
  26837. }
  26838. s0 = peg$currPos;
  26839. if (input.substr(peg$currPos, 2) === peg$c60) {
  26840. s1 = peg$c60;
  26841. peg$currPos += 2;
  26842. } else {
  26843. s1 = peg$FAILED;
  26844. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  26845. }
  26846. if (s1 !== peg$FAILED) {
  26847. s2 = peg$parsewsAssociations();
  26848. if (s2 === peg$FAILED) {
  26849. s2 = null;
  26850. }
  26851. if (s2 !== peg$FAILED) {
  26852. s3 = peg$parsemaybeDotsWs();
  26853. if (s3 !== peg$FAILED) {
  26854. if (input.charCodeAt(peg$currPos) === 125) {
  26855. s4 = peg$c57;
  26856. peg$currPos++;
  26857. } else {
  26858. s4 = peg$FAILED;
  26859. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  26860. }
  26861. if (s4 !== peg$FAILED) {
  26862. peg$savedPos = s0;
  26863. s1 = peg$c62(s2);
  26864. s0 = s1;
  26865. } else {
  26866. peg$currPos = s0;
  26867. s0 = peg$FAILED;
  26868. }
  26869. } else {
  26870. peg$currPos = s0;
  26871. s0 = peg$FAILED;
  26872. }
  26873. } else {
  26874. peg$currPos = s0;
  26875. s0 = peg$FAILED;
  26876. }
  26877. } else {
  26878. peg$currPos = s0;
  26879. s0 = peg$FAILED;
  26880. }
  26881. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26882. return s0;
  26883. }
  26884. function peg$parsepseudoVariable() {
  26885. var s0, s1, s2;
  26886. var key = peg$currPos * 62 + 25,
  26887. cached = peg$resultsCache[key];
  26888. if (cached) {
  26889. peg$currPos = cached.nextPos;
  26890. return cached.result;
  26891. }
  26892. s0 = peg$currPos;
  26893. s1 = peg$currPos;
  26894. if (input.substr(peg$currPos, 4) === peg$c63) {
  26895. s2 = peg$c63;
  26896. peg$currPos += 4;
  26897. } else {
  26898. s2 = peg$FAILED;
  26899. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  26900. }
  26901. if (s2 !== peg$FAILED) {
  26902. peg$savedPos = s1;
  26903. s2 = peg$c65();
  26904. }
  26905. s1 = s2;
  26906. if (s1 === peg$FAILED) {
  26907. s1 = peg$currPos;
  26908. if (input.substr(peg$currPos, 5) === peg$c66) {
  26909. s2 = peg$c66;
  26910. peg$currPos += 5;
  26911. } else {
  26912. s2 = peg$FAILED;
  26913. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  26914. }
  26915. if (s2 !== peg$FAILED) {
  26916. peg$savedPos = s1;
  26917. s2 = peg$c68();
  26918. }
  26919. s1 = s2;
  26920. if (s1 === peg$FAILED) {
  26921. s1 = peg$currPos;
  26922. if (input.substr(peg$currPos, 3) === peg$c69) {
  26923. s2 = peg$c69;
  26924. peg$currPos += 3;
  26925. } else {
  26926. s2 = peg$FAILED;
  26927. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  26928. }
  26929. if (s2 !== peg$FAILED) {
  26930. peg$savedPos = s1;
  26931. s2 = peg$c71();
  26932. }
  26933. s1 = s2;
  26934. }
  26935. }
  26936. if (s1 !== peg$FAILED) {
  26937. peg$savedPos = s0;
  26938. s1 = peg$c16(s1);
  26939. }
  26940. s0 = s1;
  26941. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26942. return s0;
  26943. }
  26944. function peg$parseparseTimeLiteral() {
  26945. var s0;
  26946. var key = peg$currPos * 62 + 26,
  26947. cached = peg$resultsCache[key];
  26948. if (cached) {
  26949. peg$currPos = cached.nextPos;
  26950. return cached.result;
  26951. }
  26952. s0 = peg$parsepseudoVariable();
  26953. if (s0 === peg$FAILED) {
  26954. s0 = peg$parsenumber();
  26955. if (s0 === peg$FAILED) {
  26956. s0 = peg$parseliteralArray();
  26957. if (s0 === peg$FAILED) {
  26958. s0 = peg$parsestring();
  26959. if (s0 === peg$FAILED) {
  26960. s0 = peg$parsesymbol();
  26961. if (s0 === peg$FAILED) {
  26962. s0 = peg$parsecharacter();
  26963. }
  26964. }
  26965. }
  26966. }
  26967. }
  26968. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26969. return s0;
  26970. }
  26971. function peg$parseruntimeLiteral() {
  26972. var s0;
  26973. var key = peg$currPos * 62 + 27,
  26974. cached = peg$resultsCache[key];
  26975. if (cached) {
  26976. peg$currPos = cached.nextPos;
  26977. return cached.result;
  26978. }
  26979. s0 = peg$parsedynamicDictionary();
  26980. if (s0 === peg$FAILED) {
  26981. s0 = peg$parsedynamicArray();
  26982. if (s0 === peg$FAILED) {
  26983. s0 = peg$parseblock();
  26984. }
  26985. }
  26986. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26987. return s0;
  26988. }
  26989. function peg$parseliteral() {
  26990. var s0;
  26991. var key = peg$currPos * 62 + 28,
  26992. cached = peg$resultsCache[key];
  26993. if (cached) {
  26994. peg$currPos = cached.nextPos;
  26995. return cached.result;
  26996. }
  26997. s0 = peg$parseruntimeLiteral();
  26998. if (s0 === peg$FAILED) {
  26999. s0 = peg$parseparseTimeLiteral();
  27000. }
  27001. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27002. return s0;
  27003. }
  27004. function peg$parsevariable() {
  27005. var s0, s1;
  27006. var key = peg$currPos * 62 + 29,
  27007. cached = peg$resultsCache[key];
  27008. if (cached) {
  27009. peg$currPos = cached.nextPos;
  27010. return cached.result;
  27011. }
  27012. s0 = peg$currPos;
  27013. s1 = peg$parseidentifier();
  27014. if (s1 !== peg$FAILED) {
  27015. peg$savedPos = s0;
  27016. s1 = peg$c72(s1);
  27017. }
  27018. s0 = s1;
  27019. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27020. return s0;
  27021. }
  27022. function peg$parsebinarySelector() {
  27023. var s0, s1, s2;
  27024. var key = peg$currPos * 62 + 30,
  27025. cached = peg$resultsCache[key];
  27026. if (cached) {
  27027. peg$currPos = cached.nextPos;
  27028. return cached.result;
  27029. }
  27030. s0 = peg$currPos;
  27031. s1 = [];
  27032. if (peg$c73.test(input.charAt(peg$currPos))) {
  27033. s2 = input.charAt(peg$currPos);
  27034. peg$currPos++;
  27035. } else {
  27036. s2 = peg$FAILED;
  27037. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  27038. }
  27039. if (s2 !== peg$FAILED) {
  27040. while (s2 !== peg$FAILED) {
  27041. s1.push(s2);
  27042. if (peg$c73.test(input.charAt(peg$currPos))) {
  27043. s2 = input.charAt(peg$currPos);
  27044. peg$currPos++;
  27045. } else {
  27046. s2 = peg$FAILED;
  27047. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  27048. }
  27049. }
  27050. } else {
  27051. s1 = peg$FAILED;
  27052. }
  27053. if (s1 !== peg$FAILED) {
  27054. s0 = input.substring(s0, peg$currPos);
  27055. } else {
  27056. s0 = s1;
  27057. }
  27058. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27059. return s0;
  27060. }
  27061. function peg$parsewsKeywordPattern() {
  27062. var s0, s1, s2, s3, s4, s5, s6;
  27063. var key = peg$currPos * 62 + 31,
  27064. cached = peg$resultsCache[key];
  27065. if (cached) {
  27066. peg$currPos = cached.nextPos;
  27067. return cached.result;
  27068. }
  27069. s0 = peg$currPos;
  27070. s1 = [];
  27071. s2 = peg$currPos;
  27072. s3 = peg$parsews();
  27073. if (s3 !== peg$FAILED) {
  27074. s4 = peg$parsekeyword();
  27075. if (s4 !== peg$FAILED) {
  27076. s5 = peg$parsews();
  27077. if (s5 !== peg$FAILED) {
  27078. s6 = peg$parseidentifier();
  27079. if (s6 !== peg$FAILED) {
  27080. peg$savedPos = s2;
  27081. s3 = peg$c75(s4, s6);
  27082. s2 = s3;
  27083. } else {
  27084. peg$currPos = s2;
  27085. s2 = peg$FAILED;
  27086. }
  27087. } else {
  27088. peg$currPos = s2;
  27089. s2 = peg$FAILED;
  27090. }
  27091. } else {
  27092. peg$currPos = s2;
  27093. s2 = peg$FAILED;
  27094. }
  27095. } else {
  27096. peg$currPos = s2;
  27097. s2 = peg$FAILED;
  27098. }
  27099. if (s2 !== peg$FAILED) {
  27100. while (s2 !== peg$FAILED) {
  27101. s1.push(s2);
  27102. s2 = peg$currPos;
  27103. s3 = peg$parsews();
  27104. if (s3 !== peg$FAILED) {
  27105. s4 = peg$parsekeyword();
  27106. if (s4 !== peg$FAILED) {
  27107. s5 = peg$parsews();
  27108. if (s5 !== peg$FAILED) {
  27109. s6 = peg$parseidentifier();
  27110. if (s6 !== peg$FAILED) {
  27111. peg$savedPos = s2;
  27112. s3 = peg$c75(s4, s6);
  27113. s2 = s3;
  27114. } else {
  27115. peg$currPos = s2;
  27116. s2 = peg$FAILED;
  27117. }
  27118. } else {
  27119. peg$currPos = s2;
  27120. s2 = peg$FAILED;
  27121. }
  27122. } else {
  27123. peg$currPos = s2;
  27124. s2 = peg$FAILED;
  27125. }
  27126. } else {
  27127. peg$currPos = s2;
  27128. s2 = peg$FAILED;
  27129. }
  27130. }
  27131. } else {
  27132. s1 = peg$FAILED;
  27133. }
  27134. if (s1 !== peg$FAILED) {
  27135. peg$savedPos = s0;
  27136. s1 = peg$c76(s1);
  27137. }
  27138. s0 = s1;
  27139. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27140. return s0;
  27141. }
  27142. function peg$parsewsBinaryPattern() {
  27143. var s0, s1, s2, s3, s4;
  27144. var key = peg$currPos * 62 + 32,
  27145. cached = peg$resultsCache[key];
  27146. if (cached) {
  27147. peg$currPos = cached.nextPos;
  27148. return cached.result;
  27149. }
  27150. s0 = peg$currPos;
  27151. s1 = peg$parsews();
  27152. if (s1 !== peg$FAILED) {
  27153. s2 = peg$parsebinarySelector();
  27154. if (s2 !== peg$FAILED) {
  27155. s3 = peg$parsews();
  27156. if (s3 !== peg$FAILED) {
  27157. s4 = peg$parseidentifier();
  27158. if (s4 !== peg$FAILED) {
  27159. peg$savedPos = s0;
  27160. s1 = peg$c77(s2, s4);
  27161. s0 = s1;
  27162. } else {
  27163. peg$currPos = s0;
  27164. s0 = peg$FAILED;
  27165. }
  27166. } else {
  27167. peg$currPos = s0;
  27168. s0 = peg$FAILED;
  27169. }
  27170. } else {
  27171. peg$currPos = s0;
  27172. s0 = peg$FAILED;
  27173. }
  27174. } else {
  27175. peg$currPos = s0;
  27176. s0 = peg$FAILED;
  27177. }
  27178. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27179. return s0;
  27180. }
  27181. function peg$parsewsUnaryPattern() {
  27182. var s0, s1, s2;
  27183. var key = peg$currPos * 62 + 33,
  27184. cached = peg$resultsCache[key];
  27185. if (cached) {
  27186. peg$currPos = cached.nextPos;
  27187. return cached.result;
  27188. }
  27189. s0 = peg$currPos;
  27190. s1 = peg$parsews();
  27191. if (s1 !== peg$FAILED) {
  27192. s2 = peg$parseidentifier();
  27193. if (s2 !== peg$FAILED) {
  27194. peg$savedPos = s0;
  27195. s1 = peg$c78(s2);
  27196. s0 = s1;
  27197. } else {
  27198. peg$currPos = s0;
  27199. s0 = peg$FAILED;
  27200. }
  27201. } else {
  27202. peg$currPos = s0;
  27203. s0 = peg$FAILED;
  27204. }
  27205. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27206. return s0;
  27207. }
  27208. function peg$parseexpression() {
  27209. var s0;
  27210. var key = peg$currPos * 62 + 34,
  27211. cached = peg$resultsCache[key];
  27212. if (cached) {
  27213. peg$currPos = cached.nextPos;
  27214. return cached.result;
  27215. }
  27216. s0 = peg$parseassignment();
  27217. if (s0 === peg$FAILED) {
  27218. s0 = peg$parsecascade();
  27219. if (s0 === peg$FAILED) {
  27220. s0 = peg$parsekeywordSend();
  27221. }
  27222. }
  27223. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27224. return s0;
  27225. }
  27226. function peg$parsewsExpressionsRest() {
  27227. var s0, s1, s2, s3, s4;
  27228. var key = peg$currPos * 62 + 35,
  27229. cached = peg$resultsCache[key];
  27230. if (cached) {
  27231. peg$currPos = cached.nextPos;
  27232. return cached.result;
  27233. }
  27234. s0 = peg$currPos;
  27235. s1 = peg$parsews();
  27236. if (s1 !== peg$FAILED) {
  27237. if (input.charCodeAt(peg$currPos) === 46) {
  27238. s2 = peg$c6;
  27239. peg$currPos++;
  27240. } else {
  27241. s2 = peg$FAILED;
  27242. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27243. }
  27244. if (s2 !== peg$FAILED) {
  27245. s3 = peg$parsemaybeDotsWs();
  27246. if (s3 !== peg$FAILED) {
  27247. s4 = peg$parseexpression();
  27248. if (s4 !== peg$FAILED) {
  27249. peg$savedPos = s0;
  27250. s1 = peg$c79(s4);
  27251. s0 = s1;
  27252. } else {
  27253. peg$currPos = s0;
  27254. s0 = peg$FAILED;
  27255. }
  27256. } else {
  27257. peg$currPos = s0;
  27258. s0 = peg$FAILED;
  27259. }
  27260. } else {
  27261. peg$currPos = s0;
  27262. s0 = peg$FAILED;
  27263. }
  27264. } else {
  27265. peg$currPos = s0;
  27266. s0 = peg$FAILED;
  27267. }
  27268. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27269. return s0;
  27270. }
  27271. function peg$parsewsExpressions() {
  27272. var s0, s1, s2, s3, s4;
  27273. var key = peg$currPos * 62 + 36,
  27274. cached = peg$resultsCache[key];
  27275. if (cached) {
  27276. peg$currPos = cached.nextPos;
  27277. return cached.result;
  27278. }
  27279. s0 = peg$currPos;
  27280. s1 = peg$parsemaybeDotsWs();
  27281. if (s1 !== peg$FAILED) {
  27282. s2 = peg$parseexpression();
  27283. if (s2 !== peg$FAILED) {
  27284. s3 = [];
  27285. s4 = peg$parsewsExpressionsRest();
  27286. while (s4 !== peg$FAILED) {
  27287. s3.push(s4);
  27288. s4 = peg$parsewsExpressionsRest();
  27289. }
  27290. if (s3 !== peg$FAILED) {
  27291. peg$savedPos = s0;
  27292. s1 = peg$c80(s2, s3);
  27293. s0 = s1;
  27294. } else {
  27295. peg$currPos = s0;
  27296. s0 = peg$FAILED;
  27297. }
  27298. } else {
  27299. peg$currPos = s0;
  27300. s0 = peg$FAILED;
  27301. }
  27302. } else {
  27303. peg$currPos = s0;
  27304. s0 = peg$FAILED;
  27305. }
  27306. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27307. return s0;
  27308. }
  27309. function peg$parseassignment() {
  27310. var s0, s1, s2, s3, s4, s5;
  27311. var key = peg$currPos * 62 + 37,
  27312. cached = peg$resultsCache[key];
  27313. if (cached) {
  27314. peg$currPos = cached.nextPos;
  27315. return cached.result;
  27316. }
  27317. s0 = peg$currPos;
  27318. s1 = peg$parsevariable();
  27319. if (s1 !== peg$FAILED) {
  27320. s2 = peg$parsews();
  27321. if (s2 !== peg$FAILED) {
  27322. if (input.substr(peg$currPos, 2) === peg$c81) {
  27323. s3 = peg$c81;
  27324. peg$currPos += 2;
  27325. } else {
  27326. s3 = peg$FAILED;
  27327. if (peg$silentFails === 0) { peg$fail(peg$c82); }
  27328. }
  27329. if (s3 !== peg$FAILED) {
  27330. s4 = peg$parsews();
  27331. if (s4 !== peg$FAILED) {
  27332. s5 = peg$parseexpression();
  27333. if (s5 !== peg$FAILED) {
  27334. peg$savedPos = s0;
  27335. s1 = peg$c83(s1, s5);
  27336. s0 = s1;
  27337. } else {
  27338. peg$currPos = s0;
  27339. s0 = peg$FAILED;
  27340. }
  27341. } else {
  27342. peg$currPos = s0;
  27343. s0 = peg$FAILED;
  27344. }
  27345. } else {
  27346. peg$currPos = s0;
  27347. s0 = peg$FAILED;
  27348. }
  27349. } else {
  27350. peg$currPos = s0;
  27351. s0 = peg$FAILED;
  27352. }
  27353. } else {
  27354. peg$currPos = s0;
  27355. s0 = peg$FAILED;
  27356. }
  27357. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27358. return s0;
  27359. }
  27360. function peg$parseret() {
  27361. var s0, s1, s2, s3;
  27362. var key = peg$currPos * 62 + 38,
  27363. cached = peg$resultsCache[key];
  27364. if (cached) {
  27365. peg$currPos = cached.nextPos;
  27366. return cached.result;
  27367. }
  27368. s0 = peg$currPos;
  27369. if (input.charCodeAt(peg$currPos) === 94) {
  27370. s1 = peg$c84;
  27371. peg$currPos++;
  27372. } else {
  27373. s1 = peg$FAILED;
  27374. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  27375. }
  27376. if (s1 !== peg$FAILED) {
  27377. s2 = peg$parsews();
  27378. if (s2 !== peg$FAILED) {
  27379. s3 = peg$parseexpression();
  27380. if (s3 !== peg$FAILED) {
  27381. peg$savedPos = s0;
  27382. s1 = peg$c86(s3);
  27383. s0 = s1;
  27384. } else {
  27385. peg$currPos = s0;
  27386. s0 = peg$FAILED;
  27387. }
  27388. } else {
  27389. peg$currPos = s0;
  27390. s0 = peg$FAILED;
  27391. }
  27392. } else {
  27393. peg$currPos = s0;
  27394. s0 = peg$FAILED;
  27395. }
  27396. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27397. return s0;
  27398. }
  27399. function peg$parsetemps() {
  27400. var s0, s1, s2, s3, s4, s5;
  27401. var key = peg$currPos * 62 + 39,
  27402. cached = peg$resultsCache[key];
  27403. if (cached) {
  27404. peg$currPos = cached.nextPos;
  27405. return cached.result;
  27406. }
  27407. s0 = peg$currPos;
  27408. if (input.charCodeAt(peg$currPos) === 124) {
  27409. s1 = peg$c87;
  27410. peg$currPos++;
  27411. } else {
  27412. s1 = peg$FAILED;
  27413. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  27414. }
  27415. if (s1 !== peg$FAILED) {
  27416. s2 = [];
  27417. s3 = peg$currPos;
  27418. s4 = peg$parsews();
  27419. if (s4 !== peg$FAILED) {
  27420. s5 = peg$parseidentifier();
  27421. if (s5 !== peg$FAILED) {
  27422. peg$savedPos = s3;
  27423. s4 = peg$c89(s5);
  27424. s3 = s4;
  27425. } else {
  27426. peg$currPos = s3;
  27427. s3 = peg$FAILED;
  27428. }
  27429. } else {
  27430. peg$currPos = s3;
  27431. s3 = peg$FAILED;
  27432. }
  27433. while (s3 !== peg$FAILED) {
  27434. s2.push(s3);
  27435. s3 = peg$currPos;
  27436. s4 = peg$parsews();
  27437. if (s4 !== peg$FAILED) {
  27438. s5 = peg$parseidentifier();
  27439. if (s5 !== peg$FAILED) {
  27440. peg$savedPos = s3;
  27441. s4 = peg$c89(s5);
  27442. s3 = s4;
  27443. } else {
  27444. peg$currPos = s3;
  27445. s3 = peg$FAILED;
  27446. }
  27447. } else {
  27448. peg$currPos = s3;
  27449. s3 = peg$FAILED;
  27450. }
  27451. }
  27452. if (s2 !== peg$FAILED) {
  27453. s3 = peg$parsews();
  27454. if (s3 !== peg$FAILED) {
  27455. if (input.charCodeAt(peg$currPos) === 124) {
  27456. s4 = peg$c87;
  27457. peg$currPos++;
  27458. } else {
  27459. s4 = peg$FAILED;
  27460. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  27461. }
  27462. if (s4 !== peg$FAILED) {
  27463. peg$savedPos = s0;
  27464. s1 = peg$c90(s2);
  27465. s0 = s1;
  27466. } else {
  27467. peg$currPos = s0;
  27468. s0 = peg$FAILED;
  27469. }
  27470. } else {
  27471. peg$currPos = s0;
  27472. s0 = peg$FAILED;
  27473. }
  27474. } else {
  27475. peg$currPos = s0;
  27476. s0 = peg$FAILED;
  27477. }
  27478. } else {
  27479. peg$currPos = s0;
  27480. s0 = peg$FAILED;
  27481. }
  27482. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27483. return s0;
  27484. }
  27485. function peg$parsewsBlockParamList() {
  27486. var s0, s1, s2, s3, s4, s5, s6;
  27487. var key = peg$currPos * 62 + 40,
  27488. cached = peg$resultsCache[key];
  27489. if (cached) {
  27490. peg$currPos = cached.nextPos;
  27491. return cached.result;
  27492. }
  27493. s0 = peg$currPos;
  27494. s1 = [];
  27495. s2 = peg$currPos;
  27496. s3 = peg$parsews();
  27497. if (s3 !== peg$FAILED) {
  27498. if (input.charCodeAt(peg$currPos) === 58) {
  27499. s4 = peg$c12;
  27500. peg$currPos++;
  27501. } else {
  27502. s4 = peg$FAILED;
  27503. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27504. }
  27505. if (s4 !== peg$FAILED) {
  27506. s5 = peg$parsews();
  27507. if (s5 !== peg$FAILED) {
  27508. s6 = peg$parseidentifier();
  27509. if (s6 !== peg$FAILED) {
  27510. peg$savedPos = s2;
  27511. s3 = peg$c91(s6);
  27512. s2 = s3;
  27513. } else {
  27514. peg$currPos = s2;
  27515. s2 = peg$FAILED;
  27516. }
  27517. } else {
  27518. peg$currPos = s2;
  27519. s2 = peg$FAILED;
  27520. }
  27521. } else {
  27522. peg$currPos = s2;
  27523. s2 = peg$FAILED;
  27524. }
  27525. } else {
  27526. peg$currPos = s2;
  27527. s2 = peg$FAILED;
  27528. }
  27529. if (s2 !== peg$FAILED) {
  27530. while (s2 !== peg$FAILED) {
  27531. s1.push(s2);
  27532. s2 = peg$currPos;
  27533. s3 = peg$parsews();
  27534. if (s3 !== peg$FAILED) {
  27535. if (input.charCodeAt(peg$currPos) === 58) {
  27536. s4 = peg$c12;
  27537. peg$currPos++;
  27538. } else {
  27539. s4 = peg$FAILED;
  27540. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27541. }
  27542. if (s4 !== peg$FAILED) {
  27543. s5 = peg$parsews();
  27544. if (s5 !== peg$FAILED) {
  27545. s6 = peg$parseidentifier();
  27546. if (s6 !== peg$FAILED) {
  27547. peg$savedPos = s2;
  27548. s3 = peg$c91(s6);
  27549. s2 = s3;
  27550. } else {
  27551. peg$currPos = s2;
  27552. s2 = peg$FAILED;
  27553. }
  27554. } else {
  27555. peg$currPos = s2;
  27556. s2 = peg$FAILED;
  27557. }
  27558. } else {
  27559. peg$currPos = s2;
  27560. s2 = peg$FAILED;
  27561. }
  27562. } else {
  27563. peg$currPos = s2;
  27564. s2 = peg$FAILED;
  27565. }
  27566. }
  27567. } else {
  27568. s1 = peg$FAILED;
  27569. }
  27570. if (s1 !== peg$FAILED) {
  27571. s2 = peg$parsews();
  27572. if (s2 !== peg$FAILED) {
  27573. if (input.charCodeAt(peg$currPos) === 124) {
  27574. s3 = peg$c87;
  27575. peg$currPos++;
  27576. } else {
  27577. s3 = peg$FAILED;
  27578. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  27579. }
  27580. if (s3 !== peg$FAILED) {
  27581. peg$savedPos = s0;
  27582. s1 = peg$c92(s1);
  27583. s0 = s1;
  27584. } else {
  27585. peg$currPos = s0;
  27586. s0 = peg$FAILED;
  27587. }
  27588. } else {
  27589. peg$currPos = s0;
  27590. s0 = peg$FAILED;
  27591. }
  27592. } else {
  27593. peg$currPos = s0;
  27594. s0 = peg$FAILED;
  27595. }
  27596. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27597. return s0;
  27598. }
  27599. function peg$parsesubexpression() {
  27600. var s0, s1, s2, s3, s4, s5;
  27601. var key = peg$currPos * 62 + 41,
  27602. cached = peg$resultsCache[key];
  27603. if (cached) {
  27604. peg$currPos = cached.nextPos;
  27605. return cached.result;
  27606. }
  27607. s0 = peg$currPos;
  27608. if (input.charCodeAt(peg$currPos) === 40) {
  27609. s1 = peg$c51;
  27610. peg$currPos++;
  27611. } else {
  27612. s1 = peg$FAILED;
  27613. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  27614. }
  27615. if (s1 !== peg$FAILED) {
  27616. s2 = peg$parsews();
  27617. if (s2 !== peg$FAILED) {
  27618. s3 = peg$parseexpression();
  27619. if (s3 !== peg$FAILED) {
  27620. s4 = peg$parsews();
  27621. if (s4 !== peg$FAILED) {
  27622. if (input.charCodeAt(peg$currPos) === 41) {
  27623. s5 = peg$c48;
  27624. peg$currPos++;
  27625. } else {
  27626. s5 = peg$FAILED;
  27627. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  27628. }
  27629. if (s5 !== peg$FAILED) {
  27630. peg$savedPos = s0;
  27631. s1 = peg$c79(s3);
  27632. s0 = s1;
  27633. } else {
  27634. peg$currPos = s0;
  27635. s0 = peg$FAILED;
  27636. }
  27637. } else {
  27638. peg$currPos = s0;
  27639. s0 = peg$FAILED;
  27640. }
  27641. } else {
  27642. peg$currPos = s0;
  27643. s0 = peg$FAILED;
  27644. }
  27645. } else {
  27646. peg$currPos = s0;
  27647. s0 = peg$FAILED;
  27648. }
  27649. } else {
  27650. peg$currPos = s0;
  27651. s0 = peg$FAILED;
  27652. }
  27653. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27654. return s0;
  27655. }
  27656. function peg$parsewsStatementsWs() {
  27657. var s0, s1, s2, s3, s4, s5, s6;
  27658. var key = peg$currPos * 62 + 42,
  27659. cached = peg$resultsCache[key];
  27660. if (cached) {
  27661. peg$currPos = cached.nextPos;
  27662. return cached.result;
  27663. }
  27664. s0 = peg$currPos;
  27665. s1 = peg$parsemaybeDotsWs();
  27666. if (s1 !== peg$FAILED) {
  27667. s2 = peg$parseret();
  27668. if (s2 !== peg$FAILED) {
  27669. s3 = peg$parsemaybeDotsWs();
  27670. if (s3 !== peg$FAILED) {
  27671. peg$savedPos = s0;
  27672. s1 = peg$c93(s2);
  27673. s0 = s1;
  27674. } else {
  27675. peg$currPos = s0;
  27676. s0 = peg$FAILED;
  27677. }
  27678. } else {
  27679. peg$currPos = s0;
  27680. s0 = peg$FAILED;
  27681. }
  27682. } else {
  27683. peg$currPos = s0;
  27684. s0 = peg$FAILED;
  27685. }
  27686. if (s0 === peg$FAILED) {
  27687. s0 = peg$currPos;
  27688. s1 = peg$parsewsExpressions();
  27689. if (s1 !== peg$FAILED) {
  27690. s2 = peg$parsews();
  27691. if (s2 !== peg$FAILED) {
  27692. if (input.charCodeAt(peg$currPos) === 46) {
  27693. s3 = peg$c6;
  27694. peg$currPos++;
  27695. } else {
  27696. s3 = peg$FAILED;
  27697. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27698. }
  27699. if (s3 !== peg$FAILED) {
  27700. s4 = peg$parsemaybeDotsWs();
  27701. if (s4 !== peg$FAILED) {
  27702. s5 = peg$parseret();
  27703. if (s5 !== peg$FAILED) {
  27704. s6 = peg$parsemaybeDotsWs();
  27705. if (s6 !== peg$FAILED) {
  27706. peg$savedPos = s0;
  27707. s1 = peg$c94(s1, s5);
  27708. s0 = s1;
  27709. } else {
  27710. peg$currPos = s0;
  27711. s0 = peg$FAILED;
  27712. }
  27713. } else {
  27714. peg$currPos = s0;
  27715. s0 = peg$FAILED;
  27716. }
  27717. } else {
  27718. peg$currPos = s0;
  27719. s0 = peg$FAILED;
  27720. }
  27721. } else {
  27722. peg$currPos = s0;
  27723. s0 = peg$FAILED;
  27724. }
  27725. } else {
  27726. peg$currPos = s0;
  27727. s0 = peg$FAILED;
  27728. }
  27729. } else {
  27730. peg$currPos = s0;
  27731. s0 = peg$FAILED;
  27732. }
  27733. if (s0 === peg$FAILED) {
  27734. s0 = peg$currPos;
  27735. s1 = peg$parsewsExpressions();
  27736. if (s1 === peg$FAILED) {
  27737. s1 = null;
  27738. }
  27739. if (s1 !== peg$FAILED) {
  27740. s2 = peg$parsemaybeDotsWs();
  27741. if (s2 !== peg$FAILED) {
  27742. peg$savedPos = s0;
  27743. s1 = peg$c95(s1);
  27744. s0 = s1;
  27745. } else {
  27746. peg$currPos = s0;
  27747. s0 = peg$FAILED;
  27748. }
  27749. } else {
  27750. peg$currPos = s0;
  27751. s0 = peg$FAILED;
  27752. }
  27753. }
  27754. }
  27755. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27756. return s0;
  27757. }
  27758. function peg$parsewsSequenceWs() {
  27759. var s0, s1, s2, s3;
  27760. var key = peg$currPos * 62 + 43,
  27761. cached = peg$resultsCache[key];
  27762. if (cached) {
  27763. peg$currPos = cached.nextPos;
  27764. return cached.result;
  27765. }
  27766. s0 = peg$currPos;
  27767. s1 = peg$parsews();
  27768. if (s1 !== peg$FAILED) {
  27769. s2 = peg$parsejsStatement();
  27770. if (s2 !== peg$FAILED) {
  27771. s3 = peg$parsews();
  27772. if (s3 !== peg$FAILED) {
  27773. peg$savedPos = s0;
  27774. s1 = peg$c96(s2);
  27775. s0 = s1;
  27776. } else {
  27777. peg$currPos = s0;
  27778. s0 = peg$FAILED;
  27779. }
  27780. } else {
  27781. peg$currPos = s0;
  27782. s0 = peg$FAILED;
  27783. }
  27784. } else {
  27785. peg$currPos = s0;
  27786. s0 = peg$FAILED;
  27787. }
  27788. if (s0 === peg$FAILED) {
  27789. s0 = peg$parsewsStSequenceWs();
  27790. }
  27791. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27792. return s0;
  27793. }
  27794. function peg$parsewsStSequenceWs() {
  27795. var s0, s1, s2, s3;
  27796. var key = peg$currPos * 62 + 44,
  27797. cached = peg$resultsCache[key];
  27798. if (cached) {
  27799. peg$currPos = cached.nextPos;
  27800. return cached.result;
  27801. }
  27802. s0 = peg$currPos;
  27803. s1 = peg$parsews();
  27804. if (s1 !== peg$FAILED) {
  27805. s2 = peg$parsetemps();
  27806. if (s2 === peg$FAILED) {
  27807. s2 = null;
  27808. }
  27809. if (s2 !== peg$FAILED) {
  27810. s3 = peg$parsewsStatementsWs();
  27811. if (s3 === peg$FAILED) {
  27812. s3 = null;
  27813. }
  27814. if (s3 !== peg$FAILED) {
  27815. peg$savedPos = s0;
  27816. s1 = peg$c97(s2, s3);
  27817. s0 = s1;
  27818. } else {
  27819. peg$currPos = s0;
  27820. s0 = peg$FAILED;
  27821. }
  27822. } else {
  27823. peg$currPos = s0;
  27824. s0 = peg$FAILED;
  27825. }
  27826. } else {
  27827. peg$currPos = s0;
  27828. s0 = peg$FAILED;
  27829. }
  27830. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27831. return s0;
  27832. }
  27833. function peg$parseblock() {
  27834. var s0, s1, s2, s3, s4;
  27835. var key = peg$currPos * 62 + 45,
  27836. cached = peg$resultsCache[key];
  27837. if (cached) {
  27838. peg$currPos = cached.nextPos;
  27839. return cached.result;
  27840. }
  27841. s0 = peg$currPos;
  27842. if (input.charCodeAt(peg$currPos) === 91) {
  27843. s1 = peg$c98;
  27844. peg$currPos++;
  27845. } else {
  27846. s1 = peg$FAILED;
  27847. if (peg$silentFails === 0) { peg$fail(peg$c99); }
  27848. }
  27849. if (s1 !== peg$FAILED) {
  27850. s2 = peg$parsewsBlockParamList();
  27851. if (s2 === peg$FAILED) {
  27852. s2 = null;
  27853. }
  27854. if (s2 !== peg$FAILED) {
  27855. s3 = peg$parsewsSequenceWs();
  27856. if (s3 !== peg$FAILED) {
  27857. if (input.charCodeAt(peg$currPos) === 93) {
  27858. s4 = peg$c100;
  27859. peg$currPos++;
  27860. } else {
  27861. s4 = peg$FAILED;
  27862. if (peg$silentFails === 0) { peg$fail(peg$c101); }
  27863. }
  27864. if (s4 !== peg$FAILED) {
  27865. peg$savedPos = s0;
  27866. s1 = peg$c102(s2, s3);
  27867. s0 = s1;
  27868. } else {
  27869. peg$currPos = s0;
  27870. s0 = peg$FAILED;
  27871. }
  27872. } else {
  27873. peg$currPos = s0;
  27874. s0 = peg$FAILED;
  27875. }
  27876. } else {
  27877. peg$currPos = s0;
  27878. s0 = peg$FAILED;
  27879. }
  27880. } else {
  27881. peg$currPos = s0;
  27882. s0 = peg$FAILED;
  27883. }
  27884. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27885. return s0;
  27886. }
  27887. function peg$parseoperand() {
  27888. var s0;
  27889. var key = peg$currPos * 62 + 46,
  27890. cached = peg$resultsCache[key];
  27891. if (cached) {
  27892. peg$currPos = cached.nextPos;
  27893. return cached.result;
  27894. }
  27895. s0 = peg$parseliteral();
  27896. if (s0 === peg$FAILED) {
  27897. s0 = peg$parsevariable();
  27898. if (s0 === peg$FAILED) {
  27899. s0 = peg$parsesubexpression();
  27900. }
  27901. }
  27902. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27903. return s0;
  27904. }
  27905. function peg$parsewsUnaryMessage() {
  27906. var s0, s1, s2, s3, s4;
  27907. var key = peg$currPos * 62 + 47,
  27908. cached = peg$resultsCache[key];
  27909. if (cached) {
  27910. peg$currPos = cached.nextPos;
  27911. return cached.result;
  27912. }
  27913. s0 = peg$currPos;
  27914. s1 = peg$parsews();
  27915. if (s1 !== peg$FAILED) {
  27916. s2 = peg$parseidentifier();
  27917. if (s2 !== peg$FAILED) {
  27918. s3 = peg$currPos;
  27919. peg$silentFails++;
  27920. if (input.charCodeAt(peg$currPos) === 58) {
  27921. s4 = peg$c12;
  27922. peg$currPos++;
  27923. } else {
  27924. s4 = peg$FAILED;
  27925. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27926. }
  27927. peg$silentFails--;
  27928. if (s4 === peg$FAILED) {
  27929. s3 = void 0;
  27930. } else {
  27931. peg$currPos = s3;
  27932. s3 = peg$FAILED;
  27933. }
  27934. if (s3 !== peg$FAILED) {
  27935. peg$savedPos = s0;
  27936. s1 = peg$c103(s2);
  27937. s0 = s1;
  27938. } else {
  27939. peg$currPos = s0;
  27940. s0 = peg$FAILED;
  27941. }
  27942. } else {
  27943. peg$currPos = s0;
  27944. s0 = peg$FAILED;
  27945. }
  27946. } else {
  27947. peg$currPos = s0;
  27948. s0 = peg$FAILED;
  27949. }
  27950. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27951. return s0;
  27952. }
  27953. function peg$parseunarySend() {
  27954. var s0, s1, s2, s3;
  27955. var key = peg$currPos * 62 + 48,
  27956. cached = peg$resultsCache[key];
  27957. if (cached) {
  27958. peg$currPos = cached.nextPos;
  27959. return cached.result;
  27960. }
  27961. s0 = peg$currPos;
  27962. s1 = peg$parseoperand();
  27963. if (s1 !== peg$FAILED) {
  27964. s2 = [];
  27965. s3 = peg$parsewsUnaryMessage();
  27966. while (s3 !== peg$FAILED) {
  27967. s2.push(s3);
  27968. s3 = peg$parsewsUnaryMessage();
  27969. }
  27970. if (s2 !== peg$FAILED) {
  27971. peg$savedPos = s0;
  27972. s1 = peg$c104(s1, s2);
  27973. s0 = s1;
  27974. } else {
  27975. peg$currPos = s0;
  27976. s0 = peg$FAILED;
  27977. }
  27978. } else {
  27979. peg$currPos = s0;
  27980. s0 = peg$FAILED;
  27981. }
  27982. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27983. return s0;
  27984. }
  27985. function peg$parsewsBinaryMessage() {
  27986. var s0, s1, s2, s3, s4;
  27987. var key = peg$currPos * 62 + 49,
  27988. cached = peg$resultsCache[key];
  27989. if (cached) {
  27990. peg$currPos = cached.nextPos;
  27991. return cached.result;
  27992. }
  27993. s0 = peg$currPos;
  27994. s1 = peg$parsews();
  27995. if (s1 !== peg$FAILED) {
  27996. s2 = peg$parsebinarySelector();
  27997. if (s2 !== peg$FAILED) {
  27998. s3 = peg$parsews();
  27999. if (s3 !== peg$FAILED) {
  28000. s4 = peg$parseunarySend();
  28001. if (s4 !== peg$FAILED) {
  28002. peg$savedPos = s0;
  28003. s1 = peg$c105(s2, s4);
  28004. s0 = s1;
  28005. } else {
  28006. peg$currPos = s0;
  28007. s0 = peg$FAILED;
  28008. }
  28009. } else {
  28010. peg$currPos = s0;
  28011. s0 = peg$FAILED;
  28012. }
  28013. } else {
  28014. peg$currPos = s0;
  28015. s0 = peg$FAILED;
  28016. }
  28017. } else {
  28018. peg$currPos = s0;
  28019. s0 = peg$FAILED;
  28020. }
  28021. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28022. return s0;
  28023. }
  28024. function peg$parsebinarySend() {
  28025. var s0, s1, s2, s3;
  28026. var key = peg$currPos * 62 + 50,
  28027. cached = peg$resultsCache[key];
  28028. if (cached) {
  28029. peg$currPos = cached.nextPos;
  28030. return cached.result;
  28031. }
  28032. s0 = peg$currPos;
  28033. s1 = peg$parseunarySend();
  28034. if (s1 !== peg$FAILED) {
  28035. s2 = [];
  28036. s3 = peg$parsewsBinaryMessage();
  28037. while (s3 !== peg$FAILED) {
  28038. s2.push(s3);
  28039. s3 = peg$parsewsBinaryMessage();
  28040. }
  28041. if (s2 !== peg$FAILED) {
  28042. peg$savedPos = s0;
  28043. s1 = peg$c104(s1, s2);
  28044. s0 = s1;
  28045. } else {
  28046. peg$currPos = s0;
  28047. s0 = peg$FAILED;
  28048. }
  28049. } else {
  28050. peg$currPos = s0;
  28051. s0 = peg$FAILED;
  28052. }
  28053. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28054. return s0;
  28055. }
  28056. function peg$parsewsKeywordMessage() {
  28057. var s0, s1, s2, s3, s4, s5, s6;
  28058. var key = peg$currPos * 62 + 51,
  28059. cached = peg$resultsCache[key];
  28060. if (cached) {
  28061. peg$currPos = cached.nextPos;
  28062. return cached.result;
  28063. }
  28064. s0 = peg$currPos;
  28065. s1 = [];
  28066. s2 = peg$currPos;
  28067. s3 = peg$parsews();
  28068. if (s3 !== peg$FAILED) {
  28069. s4 = peg$parsekeyword();
  28070. if (s4 !== peg$FAILED) {
  28071. s5 = peg$parsews();
  28072. if (s5 !== peg$FAILED) {
  28073. s6 = peg$parsebinarySend();
  28074. if (s6 !== peg$FAILED) {
  28075. peg$savedPos = s2;
  28076. s3 = peg$c75(s4, s6);
  28077. s2 = s3;
  28078. } else {
  28079. peg$currPos = s2;
  28080. s2 = peg$FAILED;
  28081. }
  28082. } else {
  28083. peg$currPos = s2;
  28084. s2 = peg$FAILED;
  28085. }
  28086. } else {
  28087. peg$currPos = s2;
  28088. s2 = peg$FAILED;
  28089. }
  28090. } else {
  28091. peg$currPos = s2;
  28092. s2 = peg$FAILED;
  28093. }
  28094. if (s2 !== peg$FAILED) {
  28095. while (s2 !== peg$FAILED) {
  28096. s1.push(s2);
  28097. s2 = peg$currPos;
  28098. s3 = peg$parsews();
  28099. if (s3 !== peg$FAILED) {
  28100. s4 = peg$parsekeyword();
  28101. if (s4 !== peg$FAILED) {
  28102. s5 = peg$parsews();
  28103. if (s5 !== peg$FAILED) {
  28104. s6 = peg$parsebinarySend();
  28105. if (s6 !== peg$FAILED) {
  28106. peg$savedPos = s2;
  28107. s3 = peg$c75(s4, s6);
  28108. s2 = s3;
  28109. } else {
  28110. peg$currPos = s2;
  28111. s2 = peg$FAILED;
  28112. }
  28113. } else {
  28114. peg$currPos = s2;
  28115. s2 = peg$FAILED;
  28116. }
  28117. } else {
  28118. peg$currPos = s2;
  28119. s2 = peg$FAILED;
  28120. }
  28121. } else {
  28122. peg$currPos = s2;
  28123. s2 = peg$FAILED;
  28124. }
  28125. }
  28126. } else {
  28127. s1 = peg$FAILED;
  28128. }
  28129. if (s1 !== peg$FAILED) {
  28130. peg$savedPos = s0;
  28131. s1 = peg$c106(s1);
  28132. }
  28133. s0 = s1;
  28134. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28135. return s0;
  28136. }
  28137. function peg$parsekeywordSend() {
  28138. var s0, s1, s2;
  28139. var key = peg$currPos * 62 + 52,
  28140. cached = peg$resultsCache[key];
  28141. if (cached) {
  28142. peg$currPos = cached.nextPos;
  28143. return cached.result;
  28144. }
  28145. s0 = peg$currPos;
  28146. s1 = peg$parsebinarySend();
  28147. if (s1 !== peg$FAILED) {
  28148. s2 = peg$parsewsKeywordMessage();
  28149. if (s2 === peg$FAILED) {
  28150. s2 = null;
  28151. }
  28152. if (s2 !== peg$FAILED) {
  28153. peg$savedPos = s0;
  28154. s1 = peg$c107(s1, s2);
  28155. s0 = s1;
  28156. } else {
  28157. peg$currPos = s0;
  28158. s0 = peg$FAILED;
  28159. }
  28160. } else {
  28161. peg$currPos = s0;
  28162. s0 = peg$FAILED;
  28163. }
  28164. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28165. return s0;
  28166. }
  28167. function peg$parsewsMessage() {
  28168. var s0;
  28169. var key = peg$currPos * 62 + 53,
  28170. cached = peg$resultsCache[key];
  28171. if (cached) {
  28172. peg$currPos = cached.nextPos;
  28173. return cached.result;
  28174. }
  28175. s0 = peg$parsewsBinaryMessage();
  28176. if (s0 === peg$FAILED) {
  28177. s0 = peg$parsewsUnaryMessage();
  28178. if (s0 === peg$FAILED) {
  28179. s0 = peg$parsewsKeywordMessage();
  28180. }
  28181. }
  28182. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28183. return s0;
  28184. }
  28185. function peg$parsecascade() {
  28186. var s0, s1, s2, s3, s4, s5, s6, s7;
  28187. var key = peg$currPos * 62 + 54,
  28188. cached = peg$resultsCache[key];
  28189. if (cached) {
  28190. peg$currPos = cached.nextPos;
  28191. return cached.result;
  28192. }
  28193. s0 = peg$currPos;
  28194. s1 = peg$parsekeywordSend();
  28195. if (s1 !== peg$FAILED) {
  28196. peg$savedPos = peg$currPos;
  28197. s2 = peg$c108(s1);
  28198. if (s2) {
  28199. s2 = void 0;
  28200. } else {
  28201. s2 = peg$FAILED;
  28202. }
  28203. if (s2 !== peg$FAILED) {
  28204. s3 = [];
  28205. s4 = peg$currPos;
  28206. s5 = peg$parsews();
  28207. if (s5 !== peg$FAILED) {
  28208. if (input.charCodeAt(peg$currPos) === 59) {
  28209. s6 = peg$c109;
  28210. peg$currPos++;
  28211. } else {
  28212. s6 = peg$FAILED;
  28213. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  28214. }
  28215. if (s6 !== peg$FAILED) {
  28216. s7 = peg$parsewsMessage();
  28217. if (s7 !== peg$FAILED) {
  28218. peg$savedPos = s4;
  28219. s5 = peg$c111(s1, s7);
  28220. s4 = s5;
  28221. } else {
  28222. peg$currPos = s4;
  28223. s4 = peg$FAILED;
  28224. }
  28225. } else {
  28226. peg$currPos = s4;
  28227. s4 = peg$FAILED;
  28228. }
  28229. } else {
  28230. peg$currPos = s4;
  28231. s4 = peg$FAILED;
  28232. }
  28233. if (s4 !== peg$FAILED) {
  28234. while (s4 !== peg$FAILED) {
  28235. s3.push(s4);
  28236. s4 = peg$currPos;
  28237. s5 = peg$parsews();
  28238. if (s5 !== peg$FAILED) {
  28239. if (input.charCodeAt(peg$currPos) === 59) {
  28240. s6 = peg$c109;
  28241. peg$currPos++;
  28242. } else {
  28243. s6 = peg$FAILED;
  28244. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  28245. }
  28246. if (s6 !== peg$FAILED) {
  28247. s7 = peg$parsewsMessage();
  28248. if (s7 !== peg$FAILED) {
  28249. peg$savedPos = s4;
  28250. s5 = peg$c111(s1, s7);
  28251. s4 = s5;
  28252. } else {
  28253. peg$currPos = s4;
  28254. s4 = peg$FAILED;
  28255. }
  28256. } else {
  28257. peg$currPos = s4;
  28258. s4 = peg$FAILED;
  28259. }
  28260. } else {
  28261. peg$currPos = s4;
  28262. s4 = peg$FAILED;
  28263. }
  28264. }
  28265. } else {
  28266. s3 = peg$FAILED;
  28267. }
  28268. if (s3 !== peg$FAILED) {
  28269. peg$savedPos = s0;
  28270. s1 = peg$c112(s1, s3);
  28271. s0 = s1;
  28272. } else {
  28273. peg$currPos = s0;
  28274. s0 = peg$FAILED;
  28275. }
  28276. } else {
  28277. peg$currPos = s0;
  28278. s0 = peg$FAILED;
  28279. }
  28280. } else {
  28281. peg$currPos = s0;
  28282. s0 = peg$FAILED;
  28283. }
  28284. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28285. return s0;
  28286. }
  28287. function peg$parsejsStatement() {
  28288. var s0;
  28289. var key = peg$currPos * 62 + 55,
  28290. cached = peg$resultsCache[key];
  28291. if (cached) {
  28292. peg$currPos = cached.nextPos;
  28293. return cached.result;
  28294. }
  28295. s0 = peg$parsepragmaJsStatement();
  28296. if (s0 === peg$FAILED) {
  28297. s0 = peg$parselegacyJsStatement();
  28298. }
  28299. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28300. return s0;
  28301. }
  28302. function peg$parselegacyJsStatement() {
  28303. var s0, s1, s2, s3, s4;
  28304. var key = peg$currPos * 62 + 56,
  28305. cached = peg$resultsCache[key];
  28306. if (cached) {
  28307. peg$currPos = cached.nextPos;
  28308. return cached.result;
  28309. }
  28310. s0 = peg$currPos;
  28311. if (input.charCodeAt(peg$currPos) === 60) {
  28312. s1 = peg$c113;
  28313. peg$currPos++;
  28314. } else {
  28315. s1 = peg$FAILED;
  28316. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  28317. }
  28318. if (s1 !== peg$FAILED) {
  28319. s2 = [];
  28320. s3 = peg$currPos;
  28321. if (input.substr(peg$currPos, 2) === peg$c115) {
  28322. s4 = peg$c115;
  28323. peg$currPos += 2;
  28324. } else {
  28325. s4 = peg$FAILED;
  28326. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  28327. }
  28328. if (s4 !== peg$FAILED) {
  28329. peg$savedPos = s3;
  28330. s4 = peg$c117();
  28331. }
  28332. s3 = s4;
  28333. if (s3 === peg$FAILED) {
  28334. if (peg$c118.test(input.charAt(peg$currPos))) {
  28335. s3 = input.charAt(peg$currPos);
  28336. peg$currPos++;
  28337. } else {
  28338. s3 = peg$FAILED;
  28339. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  28340. }
  28341. }
  28342. while (s3 !== peg$FAILED) {
  28343. s2.push(s3);
  28344. s3 = peg$currPos;
  28345. if (input.substr(peg$currPos, 2) === peg$c115) {
  28346. s4 = peg$c115;
  28347. peg$currPos += 2;
  28348. } else {
  28349. s4 = peg$FAILED;
  28350. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  28351. }
  28352. if (s4 !== peg$FAILED) {
  28353. peg$savedPos = s3;
  28354. s4 = peg$c117();
  28355. }
  28356. s3 = s4;
  28357. if (s3 === peg$FAILED) {
  28358. if (peg$c118.test(input.charAt(peg$currPos))) {
  28359. s3 = input.charAt(peg$currPos);
  28360. peg$currPos++;
  28361. } else {
  28362. s3 = peg$FAILED;
  28363. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  28364. }
  28365. }
  28366. }
  28367. if (s2 !== peg$FAILED) {
  28368. if (input.charCodeAt(peg$currPos) === 62) {
  28369. s3 = peg$c120;
  28370. peg$currPos++;
  28371. } else {
  28372. s3 = peg$FAILED;
  28373. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  28374. }
  28375. if (s3 !== peg$FAILED) {
  28376. peg$savedPos = peg$currPos;
  28377. s4 = peg$c122(s2);
  28378. if (s4) {
  28379. s4 = void 0;
  28380. } else {
  28381. s4 = peg$FAILED;
  28382. }
  28383. if (s4 !== peg$FAILED) {
  28384. peg$savedPos = s0;
  28385. s1 = peg$c123(s2);
  28386. s0 = s1;
  28387. } else {
  28388. peg$currPos = s0;
  28389. s0 = peg$FAILED;
  28390. }
  28391. } else {
  28392. peg$currPos = s0;
  28393. s0 = peg$FAILED;
  28394. }
  28395. } else {
  28396. peg$currPos = s0;
  28397. s0 = peg$FAILED;
  28398. }
  28399. } else {
  28400. peg$currPos = s0;
  28401. s0 = peg$FAILED;
  28402. }
  28403. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28404. return s0;
  28405. }
  28406. function peg$parsepragmaJsStatement() {
  28407. var s0, s1, s2, s3, s4, s5, s6, s7;
  28408. var key = peg$currPos * 62 + 57,
  28409. cached = peg$resultsCache[key];
  28410. if (cached) {
  28411. peg$currPos = cached.nextPos;
  28412. return cached.result;
  28413. }
  28414. s0 = peg$currPos;
  28415. if (input.charCodeAt(peg$currPos) === 60) {
  28416. s1 = peg$c113;
  28417. peg$currPos++;
  28418. } else {
  28419. s1 = peg$FAILED;
  28420. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  28421. }
  28422. if (s1 !== peg$FAILED) {
  28423. s2 = peg$parsews();
  28424. if (s2 !== peg$FAILED) {
  28425. if (input.substr(peg$currPos, 9) === peg$c124) {
  28426. s3 = peg$c124;
  28427. peg$currPos += 9;
  28428. } else {
  28429. s3 = peg$FAILED;
  28430. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  28431. }
  28432. if (s3 !== peg$FAILED) {
  28433. s4 = peg$parsews();
  28434. if (s4 !== peg$FAILED) {
  28435. s5 = peg$parserawString();
  28436. if (s5 !== peg$FAILED) {
  28437. s6 = peg$parsews();
  28438. if (s6 !== peg$FAILED) {
  28439. if (input.charCodeAt(peg$currPos) === 62) {
  28440. s7 = peg$c120;
  28441. peg$currPos++;
  28442. } else {
  28443. s7 = peg$FAILED;
  28444. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  28445. }
  28446. if (s7 !== peg$FAILED) {
  28447. peg$savedPos = s0;
  28448. s1 = peg$c126(s5);
  28449. s0 = s1;
  28450. } else {
  28451. peg$currPos = s0;
  28452. s0 = peg$FAILED;
  28453. }
  28454. } else {
  28455. peg$currPos = s0;
  28456. s0 = peg$FAILED;
  28457. }
  28458. } else {
  28459. peg$currPos = s0;
  28460. s0 = peg$FAILED;
  28461. }
  28462. } else {
  28463. peg$currPos = s0;
  28464. s0 = peg$FAILED;
  28465. }
  28466. } else {
  28467. peg$currPos = s0;
  28468. s0 = peg$FAILED;
  28469. }
  28470. } else {
  28471. peg$currPos = s0;
  28472. s0 = peg$FAILED;
  28473. }
  28474. } else {
  28475. peg$currPos = s0;
  28476. s0 = peg$FAILED;
  28477. }
  28478. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28479. return s0;
  28480. }
  28481. function peg$parsemethod() {
  28482. var s0, s1, s2;
  28483. var key = peg$currPos * 62 + 58,
  28484. cached = peg$resultsCache[key];
  28485. if (cached) {
  28486. peg$currPos = cached.nextPos;
  28487. return cached.result;
  28488. }
  28489. s0 = peg$currPos;
  28490. s1 = peg$parsewsKeywordPattern();
  28491. if (s1 === peg$FAILED) {
  28492. s1 = peg$parsewsBinaryPattern();
  28493. if (s1 === peg$FAILED) {
  28494. s1 = peg$parsewsUnaryPattern();
  28495. }
  28496. }
  28497. if (s1 !== peg$FAILED) {
  28498. s2 = peg$parsewsSequenceWs();
  28499. if (s2 !== peg$FAILED) {
  28500. peg$savedPos = s0;
  28501. s1 = peg$c127(s1, s2);
  28502. s0 = s1;
  28503. } else {
  28504. peg$currPos = s0;
  28505. s0 = peg$FAILED;
  28506. }
  28507. } else {
  28508. peg$currPos = s0;
  28509. s0 = peg$FAILED;
  28510. }
  28511. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28512. return s0;
  28513. }
  28514. function peg$parseassociationSend() {
  28515. var s0, s1, s2;
  28516. var key = peg$currPos * 62 + 59,
  28517. cached = peg$resultsCache[key];
  28518. if (cached) {
  28519. peg$currPos = cached.nextPos;
  28520. return cached.result;
  28521. }
  28522. s0 = peg$currPos;
  28523. s1 = peg$parsebinarySend();
  28524. if (s1 !== peg$FAILED) {
  28525. peg$savedPos = peg$currPos;
  28526. s2 = peg$c128(s1);
  28527. if (s2) {
  28528. s2 = void 0;
  28529. } else {
  28530. s2 = peg$FAILED;
  28531. }
  28532. if (s2 !== peg$FAILED) {
  28533. peg$savedPos = s0;
  28534. s1 = peg$c129(s1);
  28535. s0 = s1;
  28536. } else {
  28537. peg$currPos = s0;
  28538. s0 = peg$FAILED;
  28539. }
  28540. } else {
  28541. peg$currPos = s0;
  28542. s0 = peg$FAILED;
  28543. }
  28544. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28545. return s0;
  28546. }
  28547. function peg$parsewsAssociationsRest() {
  28548. var s0, s1, s2, s3, s4;
  28549. var key = peg$currPos * 62 + 60,
  28550. cached = peg$resultsCache[key];
  28551. if (cached) {
  28552. peg$currPos = cached.nextPos;
  28553. return cached.result;
  28554. }
  28555. s0 = peg$currPos;
  28556. s1 = peg$parsews();
  28557. if (s1 !== peg$FAILED) {
  28558. if (input.charCodeAt(peg$currPos) === 46) {
  28559. s2 = peg$c6;
  28560. peg$currPos++;
  28561. } else {
  28562. s2 = peg$FAILED;
  28563. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28564. }
  28565. if (s2 !== peg$FAILED) {
  28566. s3 = peg$parsemaybeDotsWs();
  28567. if (s3 !== peg$FAILED) {
  28568. s4 = peg$parseassociationSend();
  28569. if (s4 !== peg$FAILED) {
  28570. peg$savedPos = s0;
  28571. s1 = peg$c79(s4);
  28572. s0 = s1;
  28573. } else {
  28574. peg$currPos = s0;
  28575. s0 = peg$FAILED;
  28576. }
  28577. } else {
  28578. peg$currPos = s0;
  28579. s0 = peg$FAILED;
  28580. }
  28581. } else {
  28582. peg$currPos = s0;
  28583. s0 = peg$FAILED;
  28584. }
  28585. } else {
  28586. peg$currPos = s0;
  28587. s0 = peg$FAILED;
  28588. }
  28589. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28590. return s0;
  28591. }
  28592. function peg$parsewsAssociations() {
  28593. var s0, s1, s2, s3, s4;
  28594. var key = peg$currPos * 62 + 61,
  28595. cached = peg$resultsCache[key];
  28596. if (cached) {
  28597. peg$currPos = cached.nextPos;
  28598. return cached.result;
  28599. }
  28600. s0 = peg$currPos;
  28601. s1 = peg$parsemaybeDotsWs();
  28602. if (s1 !== peg$FAILED) {
  28603. s2 = peg$parseassociationSend();
  28604. if (s2 !== peg$FAILED) {
  28605. s3 = [];
  28606. s4 = peg$parsewsAssociationsRest();
  28607. while (s4 !== peg$FAILED) {
  28608. s3.push(s4);
  28609. s4 = peg$parsewsAssociationsRest();
  28610. }
  28611. if (s3 !== peg$FAILED) {
  28612. peg$savedPos = s0;
  28613. s1 = peg$c130(s2, s3);
  28614. s0 = s1;
  28615. } else {
  28616. peg$currPos = s0;
  28617. s0 = peg$FAILED;
  28618. }
  28619. } else {
  28620. peg$currPos = s0;
  28621. s0 = peg$FAILED;
  28622. }
  28623. } else {
  28624. peg$currPos = s0;
  28625. s0 = peg$FAILED;
  28626. }
  28627. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28628. return s0;
  28629. }
  28630. peg$result = peg$startRuleFunction();
  28631. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  28632. return peg$result;
  28633. } else {
  28634. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  28635. peg$fail({ type: "end", description: "end of input" });
  28636. }
  28637. throw peg$buildException(
  28638. null,
  28639. peg$maxFailExpected,
  28640. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  28641. peg$maxFailPos < input.length
  28642. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  28643. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  28644. );
  28645. }
  28646. }
  28647. return {
  28648. SyntaxError: peg$SyntaxError,
  28649. parse: peg$parse
  28650. };
  28651. })();
  28652. });
  28653. define('amber_core/Platform-ImportExport',["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  28654. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  28655. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  28656. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  28657. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  28658. $core.addPackage("Platform-ImportExport");
  28659. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  28660. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  28661. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  28662. $globals.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream.";
  28663. $core.addMethod(
  28664. $core.method({
  28665. selector: "exportPackage:on:",
  28666. protocol: "output",
  28667. fn: function (aPackage,aStream){
  28668. var self=this,$self=this;
  28669. return $core.withContext(function($ctx1) {
  28670. $self._subclassResponsibility();
  28671. return self;
  28672. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  28673. },
  28674. args: ["aPackage", "aStream"],
  28675. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  28676. referencedClasses: [],
  28677. messageSends: ["subclassResponsibility"]
  28678. }),
  28679. $globals.AbstractExporter);
  28680. $core.addMethod(
  28681. $core.method({
  28682. selector: "extensionMethodsOfPackage:",
  28683. protocol: "accessing",
  28684. fn: function (aPackage){
  28685. var self=this,$self=this;
  28686. var result;
  28687. return $core.withContext(function($ctx1) {
  28688. result=$recv($globals.OrderedCollection)._new();
  28689. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  28690. return $core.withContext(function($ctx2) {
  28691. return $recv(result)._addAll_($recv(each)._ownMethods());
  28692. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28693. }));
  28694. return result;
  28695. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  28696. },
  28697. args: ["aPackage"],
  28698. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each ownMethods ].\x0a\x09\x09\x0a\x09^ result",
  28699. referencedClasses: ["OrderedCollection"],
  28700. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  28701. }),
  28702. $globals.AbstractExporter);
  28703. $core.addMethod(
  28704. $core.method({
  28705. selector: "extensionProtocolsOfPackage:",
  28706. protocol: "accessing",
  28707. fn: function (aPackage){
  28708. var self=this,$self=this;
  28709. var extensionName,result;
  28710. return $core.withContext(function($ctx1) {
  28711. var $1,$2,$3;
  28712. $1=$recv(aPackage)._name();
  28713. $ctx1.sendIdx["name"]=1;
  28714. extensionName="*".__comma($1);
  28715. result=$recv($globals.OrderedCollection)._new();
  28716. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  28717. return $core.withContext(function($ctx2) {
  28718. $2=$recv(a)._name();
  28719. $ctx2.sendIdx["name"]=2;
  28720. return $recv($2).__lt($recv(b)._name());
  28721. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28722. })))._do_((function(each){
  28723. return $core.withContext(function($ctx2) {
  28724. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  28725. return $core.withContext(function($ctx3) {
  28726. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  28727. if($core.assert($3)){
  28728. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  28729. }
  28730. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  28731. }));
  28732. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28733. }));
  28734. $ctx1.sendIdx["do:"]=1;
  28735. return result;
  28736. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  28737. },
  28738. args: ["aPackage"],
  28739. source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09({each. each theMetaClass} copyWithout: nil) do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
  28740. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  28741. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  28742. }),
  28743. $globals.AbstractExporter);
  28744. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  28745. $globals.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code.";
  28746. $core.addMethod(
  28747. $core.method({
  28748. selector: "chunkEscape:",
  28749. protocol: "convenience",
  28750. fn: function (aString){
  28751. var self=this,$self=this;
  28752. return $core.withContext(function($ctx1) {
  28753. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  28754. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  28755. },
  28756. args: ["aString"],
  28757. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  28758. referencedClasses: [],
  28759. messageSends: ["trimBoth", "replace:with:"]
  28760. }),
  28761. $globals.ChunkExporter);
  28762. $core.addMethod(
  28763. $core.method({
  28764. selector: "exportBehavior:on:",
  28765. protocol: "output",
  28766. fn: function (aBehavior,aStream){
  28767. var self=this,$self=this;
  28768. return $core.withContext(function($ctx1) {
  28769. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  28770. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  28771. return self;
  28772. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  28773. },
  28774. args: ["aBehavior", "aStream"],
  28775. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  28776. referencedClasses: [],
  28777. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  28778. }),
  28779. $globals.ChunkExporter);
  28780. $core.addMethod(
  28781. $core.method({
  28782. selector: "exportCategoryEpilogueOf:on:",
  28783. protocol: "output",
  28784. fn: function (aCategory,aStream){
  28785. var self=this,$self=this;
  28786. return $core.withContext(function($ctx1) {
  28787. $recv(aStream)._write_(" !");
  28788. $recv(aStream)._lf();
  28789. $ctx1.sendIdx["lf"]=1;
  28790. $recv(aStream)._lf();
  28791. return self;
  28792. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  28793. },
  28794. args: ["aCategory", "aStream"],
  28795. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  28796. referencedClasses: [],
  28797. messageSends: ["write:", "lf"]
  28798. }),
  28799. $globals.ChunkExporter);
  28800. $core.addMethod(
  28801. $core.method({
  28802. selector: "exportCategoryPrologueOf:on:",
  28803. protocol: "output",
  28804. fn: function (aCategory,aStream){
  28805. var self=this,$self=this;
  28806. return $core.withContext(function($ctx1) {
  28807. $recv(aStream)._write_("!");
  28808. $ctx1.sendIdx["write:"]=1;
  28809. $recv(aStream)._print_($recv(aCategory)._theClass());
  28810. $ctx1.sendIdx["print:"]=1;
  28811. $recv(aStream)._write_(" methodsFor: ");
  28812. $ctx1.sendIdx["write:"]=2;
  28813. $recv(aStream)._print_(aCategory);
  28814. $recv(aStream)._write_("!");
  28815. return self;
  28816. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  28817. },
  28818. args: ["aCategory", "aStream"],
  28819. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09write: '!';\x0a\x09\x09print: aCategory theClass;\x0a\x09\x09write: ' methodsFor: ';\x0a\x09\x09print: aCategory;\x0a\x09\x09write: '!'",
  28820. referencedClasses: [],
  28821. messageSends: ["write:", "print:", "theClass"]
  28822. }),
  28823. $globals.ChunkExporter);
  28824. $core.addMethod(
  28825. $core.method({
  28826. selector: "exportDefinitionOf:on:",
  28827. protocol: "output",
  28828. fn: function (aClass,aStream){
  28829. var self=this,$self=this;
  28830. return $core.withContext(function($ctx1) {
  28831. var $1,$2,$3,$4;
  28832. $recv(aStream)._print_($recv(aClass)._superclass());
  28833. $ctx1.sendIdx["print:"]=1;
  28834. $recv(aStream)._write_(" subclass: ");
  28835. $ctx1.sendIdx["write:"]=1;
  28836. $recv(aStream)._printSymbol_($recv(aClass)._name());
  28837. $1=$recv(aStream)._lf();
  28838. $ctx1.sendIdx["lf"]=1;
  28839. $recv(aStream)._tab();
  28840. $ctx1.sendIdx["tab"]=1;
  28841. $recv(aStream)._write_("instanceVariableNames: ");
  28842. $ctx1.sendIdx["write:"]=2;
  28843. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  28844. $ctx1.sendIdx["print:"]=2;
  28845. $recv(aStream)._lf();
  28846. $ctx1.sendIdx["lf"]=2;
  28847. $recv(aStream)._tab();
  28848. $recv(aStream)._write_("package: ");
  28849. $ctx1.sendIdx["write:"]=3;
  28850. $recv(aStream)._print_($recv(aClass)._category());
  28851. $ctx1.sendIdx["print:"]=3;
  28852. $recv(aStream)._write_("!");
  28853. $ctx1.sendIdx["write:"]=4;
  28854. $2=$recv(aStream)._lf();
  28855. $ctx1.sendIdx["lf"]=3;
  28856. $3=$recv(aClass)._comment();
  28857. $ctx1.sendIdx["comment"]=1;
  28858. $recv($3)._ifNotEmpty_((function(){
  28859. return $core.withContext(function($ctx2) {
  28860. $recv(aStream)._write_("!");
  28861. $ctx2.sendIdx["write:"]=5;
  28862. $recv(aStream)._print_(aClass);
  28863. $recv(aStream)._write_(" commentStamp!");
  28864. $ctx2.sendIdx["write:"]=6;
  28865. $recv(aStream)._lf();
  28866. $ctx2.sendIdx["lf"]=4;
  28867. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  28868. $4=$recv(aStream)._lf();
  28869. $ctx2.sendIdx["lf"]=5;
  28870. return $4;
  28871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28872. }));
  28873. $recv(aStream)._lf();
  28874. return self;
  28875. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  28876. },
  28877. args: ["aClass", "aStream"],
  28878. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09print: aClass superclass;\x0a\x09\x09write: ' subclass: ';\x0a\x09\x09printSymbol: aClass name;\x0a\x09\x09lf.\x0a\x09\x22aClass traitComposition\x0a\x09\x09ifNotEmpty: [ aStream tab; write: {'uses: '. aClass traitCompositionDefinition}; lf ].\x22\x0a\x09aStream\x0a\x09\x09tab;\x0a\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09print: (' ' join: aClass instanceVariableNames);\x0a\x09\x09lf;\x0a\x09\x09tab;\x0a\x09\x09write: 'package: ';\x0a\x09\x09print: aClass category;\x0a\x09\x09write: '!';\x0a\x09\x09lf.\x0a\x09aClass comment ifNotEmpty: [ aStream\x0a\x09\x09write: '!'; print: aClass; write: ' commentStamp!'; lf;\x0a\x09\x09write: { self chunkEscape: aClass comment. '!' }; lf ].\x0a\x09aStream lf",
  28879. referencedClasses: [],
  28880. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  28881. }),
  28882. $globals.ChunkExporter);
  28883. $core.addMethod(
  28884. $core.method({
  28885. selector: "exportMetaDefinitionOf:on:",
  28886. protocol: "output",
  28887. fn: function (aClass,aStream){
  28888. var self=this,$self=this;
  28889. var classIvars,classTraitComposition;
  28890. return $core.withContext(function($ctx1) {
  28891. var $1,$2;
  28892. $1=$recv(aClass)._class();
  28893. $ctx1.sendIdx["class"]=1;
  28894. classIvars=$recv($1)._instanceVariableNames();
  28895. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  28896. $2=$recv(classIvars)._notEmpty();
  28897. if($core.assert($2)){
  28898. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  28899. $ctx1.sendIdx["print:"]=1;
  28900. $recv(aStream)._space();
  28901. $recv(aStream)._write_("instanceVariableNames: ");
  28902. $ctx1.sendIdx["write:"]=1;
  28903. $recv(aStream)._print_(" "._join_(classIvars));
  28904. $recv(aStream)._write_("!");
  28905. $recv(aStream)._lf();
  28906. $ctx1.sendIdx["lf"]=1;
  28907. $recv(aStream)._lf();
  28908. }
  28909. return self;
  28910. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  28911. },
  28912. args: ["aClass", "aStream"],
  28913. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09| classIvars classTraitComposition |\x0a\x09classIvars := aClass class instanceVariableNames.\x0a\x09classTraitComposition := aClass class traitComposition.\x0a\x0a\x09(classIvars notEmpty \x22or: [classTraitComposition notEmpty]\x22) ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09print: aClass theMetaClass.\x0a\x09\x09aStream space. \x22classTraitComposition\x0a\x09\x09\x09ifEmpty: [ aStream space ]\x0a\x09\x09\x09ifNotEmpty: [ aStream lf; tab; write: {'uses: '. aClass class traitCompositionDefinition}; lf; tab ].\x22\x0a\x09\x09aStream\x0a\x09\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09\x09print: (' ' join: classIvars);\x0a\x09\x09\x09write: '!'; lf; lf ]",
  28914. referencedClasses: [],
  28915. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  28916. }),
  28917. $globals.ChunkExporter);
  28918. $core.addMethod(
  28919. $core.method({
  28920. selector: "exportMethod:on:",
  28921. protocol: "output",
  28922. fn: function (aMethod,aStream){
  28923. var self=this,$self=this;
  28924. return $core.withContext(function($ctx1) {
  28925. $recv(aStream)._lf();
  28926. $ctx1.sendIdx["lf"]=1;
  28927. $recv(aStream)._lf();
  28928. $ctx1.sendIdx["lf"]=2;
  28929. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  28930. $ctx1.sendIdx["write:"]=1;
  28931. $recv(aStream)._lf();
  28932. $recv(aStream)._write_("!");
  28933. return self;
  28934. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  28935. },
  28936. args: ["aMethod", "aStream"],
  28937. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  28938. referencedClasses: [],
  28939. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  28940. }),
  28941. $globals.ChunkExporter);
  28942. $core.addMethod(
  28943. $core.method({
  28944. selector: "exportPackage:on:",
  28945. protocol: "output",
  28946. fn: function (aPackage,aStream){
  28947. var self=this,$self=this;
  28948. return $core.withContext(function($ctx1) {
  28949. var $1,$receiver;
  28950. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  28951. $self._exportPackageImportsOf_on_(aPackage,aStream);
  28952. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  28953. return $core.withContext(function($ctx2) {
  28954. $self._exportBehavior_on_(each,aStream);
  28955. $ctx2.sendIdx["exportBehavior:on:"]=1;
  28956. $1=$recv(each)._theMetaClass();
  28957. if(($receiver = $1) == null || $receiver.a$nil){
  28958. return $1;
  28959. } else {
  28960. var meta;
  28961. meta=$receiver;
  28962. return $self._exportBehavior_on_(meta,aStream);
  28963. }
  28964. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28965. }));
  28966. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  28967. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  28968. return self;
  28969. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  28970. },
  28971. args: ["aPackage", "aStream"],
  28972. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | self exportBehavior: meta on: aStream ] ].\x0a\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  28973. referencedClasses: [],
  28974. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  28975. }),
  28976. $globals.ChunkExporter);
  28977. $core.addMethod(
  28978. $core.method({
  28979. selector: "exportPackageDefinitionOf:on:",
  28980. protocol: "output",
  28981. fn: function (aPackage,aStream){
  28982. var self=this,$self=this;
  28983. return $core.withContext(function($ctx1) {
  28984. $recv(aStream)._write_("Smalltalk createPackage: ");
  28985. $ctx1.sendIdx["write:"]=1;
  28986. $recv(aStream)._print_($recv(aPackage)._name());
  28987. $recv(aStream)._write_("!");
  28988. $recv(aStream)._lf();
  28989. return self;
  28990. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  28991. },
  28992. args: ["aPackage", "aStream"],
  28993. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  28994. referencedClasses: [],
  28995. messageSends: ["write:", "print:", "name", "lf"]
  28996. }),
  28997. $globals.ChunkExporter);
  28998. $core.addMethod(
  28999. $core.method({
  29000. selector: "exportPackageImportsOf:on:",
  29001. protocol: "output",
  29002. fn: function (aPackage,aStream){
  29003. var self=this,$self=this;
  29004. return $core.withContext(function($ctx1) {
  29005. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  29006. return $core.withContext(function($ctx2) {
  29007. $recv(aStream)._write_("(Smalltalk packageAt: ");
  29008. $ctx2.sendIdx["write:"]=1;
  29009. $recv(aStream)._print_($recv(aPackage)._name());
  29010. $recv(aStream)._write_([") imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  29011. return $recv(aStream)._lf();
  29012. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  29013. }));
  29014. return self;
  29015. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  29016. },
  29017. args: ["aPackage", "aStream"],
  29018. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports | aStream\x0a\x09\x09write: '(Smalltalk packageAt: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: { ') imports: '. self chunkEscape: aPackage importsDefinition. '!' };\x0a\x09\x09lf ]",
  29019. referencedClasses: [],
  29020. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", "chunkEscape:", "importsDefinition", "lf"]
  29021. }),
  29022. $globals.ChunkExporter);
  29023. $core.addMethod(
  29024. $core.method({
  29025. selector: "exportPackageTraitCompositionsOf:on:",
  29026. protocol: "output",
  29027. fn: function (aPackage,aStream){
  29028. var self=this,$self=this;
  29029. return $core.withContext(function($ctx1) {
  29030. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  29031. return $core.withContext(function($ctx2) {
  29032. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  29033. return $core.withContext(function($ctx3) {
  29034. return $self._exportTraitComposition_of_on_(value,key,aStream);
  29035. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  29036. }));
  29037. $recv(aStream)._write_("! !");
  29038. $recv(aStream)._lf();
  29039. $ctx2.sendIdx["lf"]=1;
  29040. return $recv(aStream)._lf();
  29041. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  29042. }));
  29043. return self;
  29044. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  29045. },
  29046. args: ["aPackage", "aStream"],
  29047. source: "exportPackageTraitCompositionsOf: aPackage on: aStream\x0a\x09aPackage traitCompositions ifNotEmpty: [ :traitCompositions |\x0a\x09\x09traitCompositions keysAndValuesDo: [ :key :value | self exportTraitComposition: value of: key on: aStream ].\x0a\x09\x09aStream write: '! !'; lf; lf ]",
  29048. referencedClasses: [],
  29049. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  29050. }),
  29051. $globals.ChunkExporter);
  29052. $core.addMethod(
  29053. $core.method({
  29054. selector: "exportProtocol:on:",
  29055. protocol: "output",
  29056. fn: function (aProtocol,aStream){
  29057. var self=this,$self=this;
  29058. return $core.withContext(function($ctx1) {
  29059. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  29060. return $core.withContext(function($ctx2) {
  29061. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  29062. $recv(methods)._do_((function(method){
  29063. return $core.withContext(function($ctx3) {
  29064. return $self._exportMethod_on_(method,aStream);
  29065. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  29066. }));
  29067. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  29068. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  29069. }));
  29070. return self;
  29071. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  29072. },
  29073. args: ["aProtocol", "aStream"],
  29074. source: "exportProtocol: aProtocol on: aStream\x0a\x09aProtocol ownMethods ifNotEmpty: [ :methods |\x0a\x09\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09\x09methods do: [ :method | \x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09self exportProtocolEpilogueOf: aProtocol on: aStream ]",
  29075. referencedClasses: [],
  29076. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  29077. }),
  29078. $globals.ChunkExporter);
  29079. $core.addMethod(
  29080. $core.method({
  29081. selector: "exportProtocolEpilogueOf:on:",
  29082. protocol: "output",
  29083. fn: function (aProtocol,aStream){
  29084. var self=this,$self=this;
  29085. return $core.withContext(function($ctx1) {
  29086. $recv(aStream)._write_(" !");
  29087. $recv(aStream)._lf();
  29088. $ctx1.sendIdx["lf"]=1;
  29089. $recv(aStream)._lf();
  29090. return self;
  29091. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  29092. },
  29093. args: ["aProtocol", "aStream"],
  29094. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  29095. referencedClasses: [],
  29096. messageSends: ["write:", "lf"]
  29097. }),
  29098. $globals.ChunkExporter);
  29099. $core.addMethod(
  29100. $core.method({
  29101. selector: "exportProtocolPrologueOf:on:",
  29102. protocol: "output",
  29103. fn: function (aProtocol,aStream){
  29104. var self=this,$self=this;
  29105. return $core.withContext(function($ctx1) {
  29106. $recv(aStream)._write_("!");
  29107. $ctx1.sendIdx["write:"]=1;
  29108. $recv(aStream)._print_($recv(aProtocol)._theClass());
  29109. $ctx1.sendIdx["print:"]=1;
  29110. $recv(aStream)._write_(" methodsFor: ");
  29111. $ctx1.sendIdx["write:"]=2;
  29112. $recv(aStream)._print_($recv(aProtocol)._name());
  29113. $recv(aStream)._write_("!");
  29114. return self;
  29115. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  29116. },
  29117. args: ["aProtocol", "aStream"],
  29118. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09write: '!';\x0a\x09\x09print: aProtocol theClass;\x0a\x09\x09write: ' methodsFor: ';\x0a\x09\x09print: aProtocol name;\x0a\x09\x09write: '!'",
  29119. referencedClasses: [],
  29120. messageSends: ["write:", "print:", "theClass", "name"]
  29121. }),
  29122. $globals.ChunkExporter);
  29123. $core.addMethod(
  29124. $core.method({
  29125. selector: "exportProtocols:on:",
  29126. protocol: "output",
  29127. fn: function (aCollection,aStream){
  29128. var self=this,$self=this;
  29129. return $core.withContext(function($ctx1) {
  29130. $recv(aCollection)._do_((function(each){
  29131. return $core.withContext(function($ctx2) {
  29132. return $self._exportProtocol_on_(each,aStream);
  29133. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29134. }));
  29135. return self;
  29136. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  29137. },
  29138. args: ["aCollection", "aStream"],
  29139. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  29140. referencedClasses: [],
  29141. messageSends: ["do:", "exportProtocol:on:"]
  29142. }),
  29143. $globals.ChunkExporter);
  29144. $core.addMethod(
  29145. $core.method({
  29146. selector: "exportTraitComposition:of:on:",
  29147. protocol: "output",
  29148. fn: function (aTraitComposition,aBehavior,aStream){
  29149. var self=this,$self=this;
  29150. return $core.withContext(function($ctx1) {
  29151. $recv(aStream)._print_(aBehavior);
  29152. $recv(aStream)._write_(" setTraitComposition: ");
  29153. $ctx1.sendIdx["write:"]=1;
  29154. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  29155. $ctx1.sendIdx["write:"]=2;
  29156. $recv(aStream)._write_(" asTraitComposition!");
  29157. $recv(aStream)._lf();
  29158. return self;
  29159. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  29160. },
  29161. args: ["aTraitComposition", "aBehavior", "aStream"],
  29162. source: "exportTraitComposition: aTraitComposition of: aBehavior on: aStream\x0a\x09aStream \x0a\x09\x09print: aBehavior;\x0a\x09\x09write: ' setTraitComposition: ';\x0a\x09\x09write: aBehavior traitCompositionDefinition;\x0a\x09\x09write: ' asTraitComposition!';\x0a\x09\x09lf",
  29163. referencedClasses: [],
  29164. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  29165. }),
  29166. $globals.ChunkExporter);
  29167. $core.addMethod(
  29168. $core.method({
  29169. selector: "exportTraitDefinitionOf:on:",
  29170. protocol: "output",
  29171. fn: function (aClass,aStream){
  29172. var self=this,$self=this;
  29173. return $core.withContext(function($ctx1) {
  29174. var $1,$2,$3,$4;
  29175. $recv(aStream)._write_("Trait named: ");
  29176. $ctx1.sendIdx["write:"]=1;
  29177. $recv(aStream)._printSymbol_($recv(aClass)._name());
  29178. $1=$recv(aStream)._lf();
  29179. $ctx1.sendIdx["lf"]=1;
  29180. $recv(aStream)._tab();
  29181. $recv(aStream)._write_("package: ");
  29182. $ctx1.sendIdx["write:"]=2;
  29183. $recv(aStream)._print_($recv(aClass)._category());
  29184. $ctx1.sendIdx["print:"]=1;
  29185. $recv(aStream)._write_("!");
  29186. $ctx1.sendIdx["write:"]=3;
  29187. $2=$recv(aStream)._lf();
  29188. $ctx1.sendIdx["lf"]=2;
  29189. $3=$recv(aClass)._comment();
  29190. $ctx1.sendIdx["comment"]=1;
  29191. $recv($3)._ifNotEmpty_((function(){
  29192. return $core.withContext(function($ctx2) {
  29193. $recv(aStream)._write_("!");
  29194. $ctx2.sendIdx["write:"]=4;
  29195. $recv(aStream)._print_(aClass);
  29196. $recv(aStream)._write_(" commentStamp!");
  29197. $ctx2.sendIdx["write:"]=5;
  29198. $recv(aStream)._lf();
  29199. $ctx2.sendIdx["lf"]=3;
  29200. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  29201. $4=$recv(aStream)._lf();
  29202. $ctx2.sendIdx["lf"]=4;
  29203. return $4;
  29204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29205. }));
  29206. $recv(aStream)._lf();
  29207. return self;
  29208. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  29209. },
  29210. args: ["aClass", "aStream"],
  29211. source: "exportTraitDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09write: 'Trait named: '; printSymbol: aClass name; lf.\x0a\x09\x22aClass traitComposition\x0a\x09\x09ifNotEmpty: [ aStream tab; write: {'uses: '. aClass traitCompositionDefinition}; lf ].\x22\x0a\x09aStream\x0a\x09\x09tab; write: 'package: '; print:\x09aClass category; write: '!'; lf.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09write: '!'; print: aClass; write: ' commentStamp!'; lf;\x0a\x09\x09write: { self chunkEscape: aClass comment. '!' }; lf ].\x0a\x09aStream lf",
  29212. referencedClasses: [],
  29213. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  29214. }),
  29215. $globals.ChunkExporter);
  29216. $core.addMethod(
  29217. $core.method({
  29218. selector: "extensionCategoriesOfPackage:",
  29219. protocol: "accessing",
  29220. fn: function (aPackage){
  29221. var self=this,$self=this;
  29222. var name,map,result;
  29223. return $core.withContext(function($ctx1) {
  29224. var $1;
  29225. name=$recv(aPackage)._name();
  29226. result=$recv($globals.OrderedCollection)._new();
  29227. $ctx1.sendIdx["new"]=1;
  29228. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  29229. return $core.withContext(function($ctx2) {
  29230. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  29231. return $core.withContext(function($ctx3) {
  29232. map=$recv($globals.Dictionary)._new();
  29233. map;
  29234. $recv(aClass)._protocolsDo_((function(category,methods){
  29235. return $core.withContext(function($ctx4) {
  29236. $1=$recv(category).__eq("*".__comma(name));
  29237. if($core.assert($1)){
  29238. return $recv(map)._at_put_(category,methods);
  29239. }
  29240. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  29241. }));
  29242. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  29243. return $core.withContext(function($ctx4) {
  29244. return $recv(a).__lt_eq(b);
  29245. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  29246. })))._collect_((function(category){
  29247. return $core.withContext(function($ctx4) {
  29248. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  29249. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  29250. })));
  29251. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  29252. }));
  29253. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29254. }));
  29255. $ctx1.sendIdx["do:"]=1;
  29256. return result;
  29257. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  29258. },
  29259. args: ["aPackage"],
  29260. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each theMetaClass} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
  29261. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  29262. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  29263. }),
  29264. $globals.ChunkExporter);
  29265. $core.addMethod(
  29266. $core.method({
  29267. selector: "ownCategoriesOfClass:",
  29268. protocol: "accessing",
  29269. fn: function (aClass){
  29270. var self=this,$self=this;
  29271. var map;
  29272. return $core.withContext(function($ctx1) {
  29273. var $1;
  29274. map=$recv($globals.Dictionary)._new();
  29275. $recv(aClass)._protocolsDo_((function(each,methods){
  29276. return $core.withContext(function($ctx2) {
  29277. $1=$recv(each)._match_("^\x5c*");
  29278. if(!$core.assert($1)){
  29279. return $recv(map)._at_put_(each,methods);
  29280. }
  29281. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  29282. }));
  29283. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  29284. return $core.withContext(function($ctx2) {
  29285. return $recv(a).__lt_eq(b);
  29286. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  29287. })))._collect_((function(each){
  29288. return $core.withContext(function($ctx2) {
  29289. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  29290. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  29291. }));
  29292. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  29293. },
  29294. args: ["aClass"],
  29295. source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that are not package extensions\x22\x0a\x09\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]",
  29296. referencedClasses: ["Dictionary", "MethodCategory"],
  29297. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  29298. }),
  29299. $globals.ChunkExporter);
  29300. $core.addMethod(
  29301. $core.method({
  29302. selector: "ownCategoriesOfMetaClass:",
  29303. protocol: "accessing",
  29304. fn: function (aClass){
  29305. var self=this,$self=this;
  29306. return $core.withContext(function($ctx1) {
  29307. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  29308. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  29309. },
  29310. args: ["aClass"],
  29311. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  29312. referencedClasses: [],
  29313. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  29314. }),
  29315. $globals.ChunkExporter);
  29316. $core.addMethod(
  29317. $core.method({
  29318. selector: "ownMethodProtocolsOfClass:",
  29319. protocol: "accessing",
  29320. fn: function (aClass){
  29321. var self=this,$self=this;
  29322. return $core.withContext(function($ctx1) {
  29323. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  29324. return $core.withContext(function($ctx2) {
  29325. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  29326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29327. }));
  29328. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  29329. },
  29330. args: ["aClass"],
  29331. source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]",
  29332. referencedClasses: ["ExportMethodProtocol"],
  29333. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  29334. }),
  29335. $globals.ChunkExporter);
  29336. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  29337. $globals.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).";
  29338. $core.addMethod(
  29339. $core.method({
  29340. selector: "exportBehavior:on:",
  29341. protocol: "output",
  29342. fn: function (aBehavior,aStream){
  29343. var self=this,$self=this;
  29344. return $core.withContext(function($ctx1) {
  29345. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  29346. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  29347. return $core.withContext(function($ctx2) {
  29348. return $self._exportMethod_on_(method,aStream);
  29349. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  29350. }));
  29351. return self;
  29352. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  29353. },
  29354. args: ["aBehavior", "aStream"],
  29355. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  29356. referencedClasses: [],
  29357. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  29358. }),
  29359. $globals.Exporter);
  29360. $core.addMethod(
  29361. $core.method({
  29362. selector: "exportDefinitionOf:on:",
  29363. protocol: "output",
  29364. fn: function (aClass,aStream){
  29365. var self=this,$self=this;
  29366. return $core.withContext(function($ctx1) {
  29367. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  29368. $recv(aStream)._lf();
  29369. $ctx1.sendIdx["lf"]=1;
  29370. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  29371. $ctx1.sendIdx["asJavaScriptSource"]=1;
  29372. $5=$recv(aClass)._superclass();
  29373. if(($receiver = $5) == null || $receiver.a$nil){
  29374. $4="null";
  29375. } else {
  29376. var superclass;
  29377. superclass=$receiver;
  29378. $4=$recv(superclass)._asJavaScriptSource();
  29379. $ctx1.sendIdx["asJavaScriptSource"]=2;
  29380. }
  29381. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  29382. $ctx1.sendIdx["asJavaScriptSource"]=3;
  29383. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  29384. $ctx1.sendIdx["asJavaScriptSource"]=4;
  29385. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  29386. $1=$recv(aStream)._write_($2);
  29387. $ctx1.sendIdx["write:"]=1;
  29388. $8=$recv(aClass)._comment();
  29389. $ctx1.sendIdx["comment"]=1;
  29390. $recv($8)._ifNotEmpty_((function(){
  29391. return $core.withContext(function($ctx2) {
  29392. $recv(aStream)._lf();
  29393. $ctx2.sendIdx["lf"]=2;
  29394. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  29395. $ctx2.sendIdx["write:"]=2;
  29396. $recv(aStream)._lf();
  29397. $ctx2.sendIdx["lf"]=3;
  29398. $10=$recv(aClass)._asJavaScriptSource();
  29399. $ctx2.sendIdx["asJavaScriptSource"]=5;
  29400. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  29401. $recv(aStream)._write_($9);
  29402. $ctx2.sendIdx["write:"]=3;
  29403. $recv(aStream)._lf();
  29404. $ctx2.sendIdx["lf"]=4;
  29405. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  29406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  29407. }));
  29408. $recv(aStream)._lf();
  29409. return self;
  29410. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  29411. },
  29412. args: ["aClass", "aStream"],
  29413. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.addClass('.\x0a\x09\x09\x09aClass name asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass superclass ifNil: [ 'null' ] ifNotNil: [ :superclass | superclass asJavaScriptSource ]. ', '.\x0a\x09\x09\x09aClass instanceVariableNames asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass category asJavaScriptSource.\x0a\x09\x09\x09');' }.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09\x09write: { aClass asJavaScriptSource. '.comment='. aClass comment crlfSanitized asJavaScriptSource. ';' }; lf;\x0a\x09\x09\x09write: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  29414. referencedClasses: [],
  29415. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  29416. }),
  29417. $globals.Exporter);
  29418. $core.addMethod(
  29419. $core.method({
  29420. selector: "exportMetaDefinitionOf:on:",
  29421. protocol: "output",
  29422. fn: function (aClass,aStream){
  29423. var self=this,$self=this;
  29424. return $core.withContext(function($ctx1) {
  29425. var $2,$1,$4,$3;
  29426. $recv(aStream)._lf();
  29427. $ctx1.sendIdx["lf"]=1;
  29428. $2=$recv(aClass)._theMetaClass();
  29429. $ctx1.sendIdx["theMetaClass"]=1;
  29430. $1=$recv($2)._instanceVariableNames();
  29431. $recv($1)._ifNotEmpty_((function(classIvars){
  29432. return $core.withContext(function($ctx2) {
  29433. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  29434. $ctx2.sendIdx["asJavaScriptSource"]=1;
  29435. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  29436. $recv(aStream)._write_($3);
  29437. return $recv(aStream)._lf();
  29438. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  29439. }));
  29440. return self;
  29441. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  29442. },
  29443. args: ["aClass", "aStream"],
  29444. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass theMetaClass instanceVariableNames ifNotEmpty: [ :classIvars | aStream\x0a\x09\x09write: { aClass theMetaClass asJavaScriptSource. '.iVarNames = '. classIvars asJavaScriptSource. ';' };\x0a\x09\x09lf ]",
  29445. referencedClasses: [],
  29446. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  29447. }),
  29448. $globals.Exporter);
  29449. $core.addMethod(
  29450. $core.method({
  29451. selector: "exportMethod:on:",
  29452. protocol: "output",
  29453. fn: function (aMethod,aStream){
  29454. var self=this,$self=this;
  29455. return $core.withContext(function($ctx1) {
  29456. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  29457. $recv(aStream)._write_("$core.addMethod(");
  29458. $ctx1.sendIdx["write:"]=1;
  29459. $recv(aStream)._lf();
  29460. $ctx1.sendIdx["lf"]=1;
  29461. $recv(aStream)._write_("$core.method({");
  29462. $ctx1.sendIdx["write:"]=2;
  29463. $recv(aStream)._lf();
  29464. $ctx1.sendIdx["lf"]=2;
  29465. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  29466. $ctx1.sendIdx["asJavaScriptSource"]=1;
  29467. $1=["selector: ",$2,","];
  29468. $recv(aStream)._write_($1);
  29469. $ctx1.sendIdx["write:"]=3;
  29470. $recv(aStream)._lf();
  29471. $ctx1.sendIdx["lf"]=3;
  29472. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  29473. $ctx1.sendIdx["asJavaScriptSource"]=2;
  29474. $3=["protocol: ",$4,","];
  29475. $recv(aStream)._write_($3);
  29476. $ctx1.sendIdx["write:"]=4;
  29477. $recv(aStream)._lf();
  29478. $ctx1.sendIdx["lf"]=4;
  29479. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  29480. $ctx1.sendIdx["write:"]=5;
  29481. $recv(aStream)._lf();
  29482. $ctx1.sendIdx["lf"]=5;
  29483. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  29484. $ctx1.sendIdx["write:"]=6;
  29485. $recv(aStream)._lf();
  29486. $ctx1.sendIdx["lf"]=6;
  29487. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  29488. $ctx1.sendIdx["asJavaScriptSource"]=3;
  29489. $5=["args: ",$6,","];
  29490. $recv(aStream)._write_($5);
  29491. $ctx1.sendIdx["write:"]=7;
  29492. $recv(aStream)._lf();
  29493. $ctx1.sendIdx["lf"]=7;
  29494. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  29495. $ctx1.sendIdx["asJavaScriptSource"]=4;
  29496. $7=["source: ",$8,","];
  29497. $recv(aStream)._write_($7);
  29498. $ctx1.sendIdx["write:"]=8;
  29499. $recv(aStream)._lf();
  29500. $ctx1.sendIdx["lf"]=8;
  29501. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  29502. $ctx1.sendIdx["asJavaScriptSource"]=5;
  29503. $9=["referencedClasses: ",$10,","];
  29504. $recv(aStream)._write_($9);
  29505. $ctx1.sendIdx["write:"]=9;
  29506. $recv(aStream)._lf();
  29507. $ctx1.sendIdx["lf"]=9;
  29508. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  29509. $ctx1.sendIdx["write:"]=10;
  29510. $recv(aStream)._lf();
  29511. $ctx1.sendIdx["lf"]=10;
  29512. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  29513. $ctx1.sendIdx["asJavaScriptSource"]=6;
  29514. $11=["messageSends: ",$12];
  29515. $recv(aStream)._write_($11);
  29516. $ctx1.sendIdx["write:"]=11;
  29517. $recv(aStream)._lf();
  29518. $ctx1.sendIdx["lf"]=11;
  29519. $recv(aStream)._write_("}),");
  29520. $ctx1.sendIdx["write:"]=12;
  29521. $recv(aStream)._lf();
  29522. $ctx1.sendIdx["lf"]=12;
  29523. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  29524. $recv(aStream)._lf();
  29525. $ctx1.sendIdx["lf"]=13;
  29526. $recv(aStream)._lf();
  29527. return self;
  29528. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  29529. },
  29530. args: ["aMethod", "aStream"],
  29531. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09write: '$core.addMethod('; lf;\x0a\x09\x09write: '$core.method({'; lf;\x0a\x09\x09write: { 'selector: '. aMethod selector asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'protocol: '. aMethod protocol asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'fn: '. aMethod fn compiledSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09write: { 'args: '. aMethod arguments asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'source: '. aMethod source asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'referencedClasses: '. aMethod referencedClasses asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeEnd(\x22ide\x22);'; lf;\x0a\x09\x09write: { 'messageSends: '. aMethod messageSends asJavaScriptSource }; lf;\x0a\x09\x09write: '}),'; lf;\x0a\x09\x09write: { aMethod methodClass asJavaScriptSource. ');' }; lf; lf",
  29532. referencedClasses: [],
  29533. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  29534. }),
  29535. $globals.Exporter);
  29536. $core.addMethod(
  29537. $core.method({
  29538. selector: "exportPackage:on:",
  29539. protocol: "output",
  29540. fn: function (aPackage,aStream){
  29541. var self=this,$self=this;
  29542. return $core.withContext(function($ctx1) {
  29543. var $1,$receiver;
  29544. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  29545. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  29546. $self._exportPackageContextOf_on_(aPackage,aStream);
  29547. $self._exportPackageImportsOf_on_(aPackage,aStream);
  29548. $self._exportPackageTransportOf_on_(aPackage,aStream);
  29549. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  29550. return $core.withContext(function($ctx2) {
  29551. $self._exportBehavior_on_(each,aStream);
  29552. $ctx2.sendIdx["exportBehavior:on:"]=1;
  29553. $1=$recv(each)._theMetaClass();
  29554. if(($receiver = $1) == null || $receiver.a$nil){
  29555. return $1;
  29556. } else {
  29557. var meta;
  29558. meta=$receiver;
  29559. return $self._exportBehavior_on_(meta,aStream);
  29560. }
  29561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29562. }));
  29563. $ctx1.sendIdx["do:"]=1;
  29564. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  29565. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  29566. return $core.withContext(function($ctx2) {
  29567. return $self._exportMethod_on_(each,aStream);
  29568. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  29569. }));
  29570. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  29571. return self;
  29572. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29573. },
  29574. args: ["aPackage", "aStream"],
  29575. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageContextOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | self exportBehavior: meta on: aStream ] ].\x0a\x09\x09\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  29576. referencedClasses: [],
  29577. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  29578. }),
  29579. $globals.Exporter);
  29580. $core.addMethod(
  29581. $core.method({
  29582. selector: "exportPackageBodyBlockPrologueOf:on:",
  29583. protocol: "output",
  29584. fn: function (aPackage,aStream){
  29585. var self=this,$self=this;
  29586. return $core.withContext(function($ctx1) {
  29587. $recv(aStream)._write_("if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;");
  29588. $ctx1.sendIdx["write:"]=1;
  29589. $recv(aStream)._lf();
  29590. $ctx1.sendIdx["lf"]=1;
  29591. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  29592. $ctx1.sendIdx["write:"]=2;
  29593. $recv(aStream)._lf();
  29594. $ctx1.sendIdx["lf"]=2;
  29595. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  29596. $ctx1.sendIdx["write:"]=3;
  29597. $recv(aStream)._lf();
  29598. $ctx1.sendIdx["lf"]=3;
  29599. $recv(aStream)._write_("if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;");
  29600. $recv(aStream)._lf();
  29601. return self;
  29602. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29603. },
  29604. args: ["aPackage", "aStream"],
  29605. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;'; lf;\x0a\x09\x09write: 'if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;'; lf;\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf;\x0a\x09\x09write: 'if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;'; lf",
  29606. referencedClasses: [],
  29607. messageSends: ["write:", "lf"]
  29608. }),
  29609. $globals.Exporter);
  29610. $core.addMethod(
  29611. $core.method({
  29612. selector: "exportPackageContextOf:on:",
  29613. protocol: "output",
  29614. fn: function (aPackage,aStream){
  29615. var self=this,$self=this;
  29616. return $core.withContext(function($ctx1) {
  29617. $recv(aStream)._write_(["$core.packages[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  29618. $recv(aStream)._lf();
  29619. return self;
  29620. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29621. },
  29622. args: ["aPackage", "aStream"],
  29623. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.packages['.\x0a\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09'].innerEval = '.\x0a\x09\x09\x09'function (expr) { return eval(expr); }'.\x0a\x09\x09\x09';' };\x0a\x09\x09lf",
  29624. referencedClasses: [],
  29625. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  29626. }),
  29627. $globals.Exporter);
  29628. $core.addMethod(
  29629. $core.method({
  29630. selector: "exportPackageDefinitionOf:on:",
  29631. protocol: "output",
  29632. fn: function (aPackage,aStream){
  29633. var self=this,$self=this;
  29634. return $core.withContext(function($ctx1) {
  29635. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  29636. $recv(aStream)._lf();
  29637. return self;
  29638. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29639. },
  29640. args: ["aPackage", "aStream"],
  29641. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  29642. referencedClasses: [],
  29643. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  29644. }),
  29645. $globals.Exporter);
  29646. $core.addMethod(
  29647. $core.method({
  29648. selector: "exportPackageEpilogueOf:on:",
  29649. protocol: "output",
  29650. fn: function (aPackage,aStream){
  29651. var self=this,$self=this;
  29652. return $core.withContext(function($ctx1) {
  29653. $self._subclassResponsibility();
  29654. return self;
  29655. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29656. },
  29657. args: ["aPackage", "aStream"],
  29658. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  29659. referencedClasses: [],
  29660. messageSends: ["subclassResponsibility"]
  29661. }),
  29662. $globals.Exporter);
  29663. $core.addMethod(
  29664. $core.method({
  29665. selector: "exportPackageImportsOf:on:",
  29666. protocol: "output",
  29667. fn: function (aPackage,aStream){
  29668. var self=this,$self=this;
  29669. return $core.withContext(function($ctx1) {
  29670. var $2,$1;
  29671. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  29672. return $core.withContext(function($ctx2) {
  29673. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  29674. $ctx2.sendIdx["asJavaScriptSource"]=1;
  29675. $1=["$core.packages[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  29676. $recv(aStream)._write_($1);
  29677. return $recv(aStream)._lf();
  29678. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  29679. }));
  29680. return self;
  29681. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29682. },
  29683. args: ["aPackage", "aStream"],
  29684. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: {\x0a\x09\x09\x09\x09'$core.packages['.\x0a\x09\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09\x09'].imports = '.\x0a\x09\x09\x09\x09imports asJavaScriptSource.\x0a\x09\x09\x09\x09';' };\x0a\x09\x09\x09lf ]",
  29685. referencedClasses: [],
  29686. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  29687. }),
  29688. $globals.Exporter);
  29689. $core.addMethod(
  29690. $core.method({
  29691. selector: "exportPackagePrologueOf:on:",
  29692. protocol: "output",
  29693. fn: function (aPackage,aStream){
  29694. var self=this,$self=this;
  29695. return $core.withContext(function($ctx1) {
  29696. $self._subclassResponsibility();
  29697. return self;
  29698. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29699. },
  29700. args: ["aPackage", "aStream"],
  29701. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  29702. referencedClasses: [],
  29703. messageSends: ["subclassResponsibility"]
  29704. }),
  29705. $globals.Exporter);
  29706. $core.addMethod(
  29707. $core.method({
  29708. selector: "exportPackageTraitCompositionsOf:on:",
  29709. protocol: "output",
  29710. fn: function (aPackage,aStream){
  29711. var self=this,$self=this;
  29712. return $core.withContext(function($ctx1) {
  29713. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  29714. return $core.withContext(function($ctx2) {
  29715. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  29716. return $core.withContext(function($ctx3) {
  29717. return $self._exportTraitComposition_of_on_(value,key,aStream);
  29718. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  29719. }));
  29720. return $recv(aStream)._lf();
  29721. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  29722. }));
  29723. return self;
  29724. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29725. },
  29726. args: ["aPackage", "aStream"],
  29727. source: "exportPackageTraitCompositionsOf: aPackage on: aStream\x0a\x09aPackage traitCompositions ifNotEmpty: [ :traitCompositions |\x0a\x09\x09traitCompositions keysAndValuesDo: [ :key :value | self exportTraitComposition: value of: key on: aStream ].\x0a\x09\x09aStream lf ]",
  29728. referencedClasses: [],
  29729. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  29730. }),
  29731. $globals.Exporter);
  29732. $core.addMethod(
  29733. $core.method({
  29734. selector: "exportPackageTransportOf:on:",
  29735. protocol: "output",
  29736. fn: function (aPackage,aStream){
  29737. var self=this,$self=this;
  29738. return $core.withContext(function($ctx1) {
  29739. $recv(aStream)._write_(["$core.packages[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  29740. $recv(aStream)._lf();
  29741. return self;
  29742. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29743. },
  29744. args: ["aPackage", "aStream"],
  29745. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.packages['.\x0a\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09'].transport = '.\x0a\x09\x09\x09aPackage transport asJSONString.\x0a\x09\x09\x09';' };\x0a\x09\x09lf",
  29746. referencedClasses: [],
  29747. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  29748. }),
  29749. $globals.Exporter);
  29750. $core.addMethod(
  29751. $core.method({
  29752. selector: "exportTraitComposition:of:on:",
  29753. protocol: "output",
  29754. fn: function (aTraitComposition,aBehavior,aStream){
  29755. var self=this,$self=this;
  29756. return $core.withContext(function($ctx1) {
  29757. var $2,$1;
  29758. $2=$recv(aTraitComposition)._asJavaScriptSource();
  29759. $ctx1.sendIdx["asJavaScriptSource"]=1;
  29760. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  29761. $recv(aStream)._write_($1);
  29762. $recv(aStream)._lf();
  29763. return self;
  29764. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  29765. },
  29766. args: ["aTraitComposition", "aBehavior", "aStream"],
  29767. source: "exportTraitComposition: aTraitComposition of: aBehavior on: aStream\x0a\x09aStream write: {\x0a\x09\x09'$core.setTraitComposition('.\x0a\x09\x09aTraitComposition asJavaScriptSource.\x0a\x09\x09', '.\x0a\x09\x09aBehavior asJavaScriptSource.\x0a\x09\x09');' };\x0a\x09lf",
  29768. referencedClasses: [],
  29769. messageSends: ["write:", "asJavaScriptSource", "lf"]
  29770. }),
  29771. $globals.Exporter);
  29772. $core.addMethod(
  29773. $core.method({
  29774. selector: "exportTraitDefinitionOf:on:",
  29775. protocol: "output",
  29776. fn: function (aClass,aStream){
  29777. var self=this,$self=this;
  29778. return $core.withContext(function($ctx1) {
  29779. var $3,$4,$2,$1,$5,$7,$6;
  29780. $recv(aStream)._lf();
  29781. $ctx1.sendIdx["lf"]=1;
  29782. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  29783. $ctx1.sendIdx["asJavaScriptSource"]=1;
  29784. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  29785. $ctx1.sendIdx["asJavaScriptSource"]=2;
  29786. $2=["$core.addTrait(",$3,", ",$4,");"];
  29787. $1=$recv(aStream)._write_($2);
  29788. $ctx1.sendIdx["write:"]=1;
  29789. $5=$recv(aClass)._comment();
  29790. $ctx1.sendIdx["comment"]=1;
  29791. $recv($5)._ifNotEmpty_((function(){
  29792. return $core.withContext(function($ctx2) {
  29793. $recv(aStream)._lf();
  29794. $ctx2.sendIdx["lf"]=2;
  29795. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  29796. $ctx2.sendIdx["write:"]=2;
  29797. $recv(aStream)._lf();
  29798. $ctx2.sendIdx["lf"]=3;
  29799. $7=$recv(aClass)._asJavaScriptSource();
  29800. $ctx2.sendIdx["asJavaScriptSource"]=3;
  29801. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  29802. $recv(aStream)._write_($6);
  29803. $ctx2.sendIdx["write:"]=3;
  29804. $recv(aStream)._lf();
  29805. $ctx2.sendIdx["lf"]=4;
  29806. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  29807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29808. }));
  29809. $recv(aStream)._lf();
  29810. return self;
  29811. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  29812. },
  29813. args: ["aClass", "aStream"],
  29814. source: "exportTraitDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.addTrait('.\x0a\x09\x09\x09aClass name asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass category asJavaScriptSource.\x0a\x09\x09\x09');' }.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09\x09write: { aClass asJavaScriptSource. '.comment='. aClass comment crlfSanitized asJavaScriptSource. ';' }; lf;\x0a\x09\x09\x09write: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  29815. referencedClasses: [],
  29816. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  29817. }),
  29818. $globals.Exporter);
  29819. $core.addMethod(
  29820. $core.method({
  29821. selector: "ownMethodsOfClass:",
  29822. protocol: "accessing",
  29823. fn: function (aClass){
  29824. var self=this,$self=this;
  29825. return $core.withContext(function($ctx1) {
  29826. var $1;
  29827. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  29828. return $core.withContext(function($ctx2) {
  29829. $1=$recv(a)._selector();
  29830. $ctx2.sendIdx["selector"]=1;
  29831. return $recv($1).__lt_eq($recv(b)._selector());
  29832. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  29833. })))._reject_((function(each){
  29834. return $core.withContext(function($ctx2) {
  29835. return $recv($recv(each)._protocol())._match_("^\x5c*");
  29836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  29837. }));
  29838. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  29839. },
  29840. args: ["aClass"],
  29841. source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ ((aClass methodDictionary values) sorted: [ :a :b | a selector <= b selector ])\x0a\x09\x09reject: [ :each | (each protocol match: '^\x5c*') ]",
  29842. referencedClasses: [],
  29843. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  29844. }),
  29845. $globals.Exporter);
  29846. $core.addMethod(
  29847. $core.method({
  29848. selector: "ownMethodsOfMetaClass:",
  29849. protocol: "accessing",
  29850. fn: function (aClass){
  29851. var self=this,$self=this;
  29852. return $core.withContext(function($ctx1) {
  29853. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  29854. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  29855. },
  29856. args: ["aClass"],
  29857. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  29858. referencedClasses: [],
  29859. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  29860. }),
  29861. $globals.Exporter);
  29862. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  29863. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  29864. $core.addMethod(
  29865. $core.method({
  29866. selector: "amdNamesOfPackages:",
  29867. protocol: "private",
  29868. fn: function (anArray){
  29869. var self=this,$self=this;
  29870. return $core.withContext(function($ctx1) {
  29871. var $1;
  29872. return $recv($recv(anArray)._select_((function(each){
  29873. return $core.withContext(function($ctx2) {
  29874. $1=$self._amdNamespaceOfPackage_(each);
  29875. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  29876. return $recv($1)._notNil();
  29877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29878. })))._collect_((function(each){
  29879. return $core.withContext(function($ctx2) {
  29880. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  29881. $ctx2.sendIdx[","]=1;
  29882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  29883. }));
  29884. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  29885. },
  29886. args: ["anArray"],
  29887. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  29888. referencedClasses: [],
  29889. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  29890. }),
  29891. $globals.AmdExporter);
  29892. $core.addMethod(
  29893. $core.method({
  29894. selector: "amdNamespaceOfPackage:",
  29895. protocol: "private",
  29896. fn: function (aPackage){
  29897. var self=this,$self=this;
  29898. return $core.withContext(function($ctx1) {
  29899. var $3,$2,$1;
  29900. $3=$recv(aPackage)._transport();
  29901. $ctx1.sendIdx["transport"]=1;
  29902. $2=$recv($3)._type();
  29903. $1=$recv($2).__eq("amd");
  29904. if($core.assert($1)){
  29905. return $recv($recv(aPackage)._transport())._namespace();
  29906. } else {
  29907. return nil;
  29908. }
  29909. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  29910. },
  29911. args: ["aPackage"],
  29912. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  29913. referencedClasses: [],
  29914. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  29915. }),
  29916. $globals.AmdExporter);
  29917. $core.addMethod(
  29918. $core.method({
  29919. selector: "exportPackageEpilogueOf:on:",
  29920. protocol: "output",
  29921. fn: function (aPackage,aStream){
  29922. var self=this,$self=this;
  29923. return $core.withContext(function($ctx1) {
  29924. $recv(aStream)._write_("});");
  29925. $recv(aStream)._lf();
  29926. return self;
  29927. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  29928. },
  29929. args: ["aPackage", "aStream"],
  29930. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  29931. referencedClasses: [],
  29932. messageSends: ["write:", "lf"]
  29933. }),
  29934. $globals.AmdExporter);
  29935. $core.addMethod(
  29936. $core.method({
  29937. selector: "exportPackagePrologueOf:on:",
  29938. protocol: "output",
  29939. fn: function (aPackage,aStream){
  29940. var self=this,$self=this;
  29941. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  29942. return $core.withContext(function($ctx1) {
  29943. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  29944. pragmaStart="";
  29945. pragmaEnd="";
  29946. importsForOutput=$self._importsForOutput_(aPackage);
  29947. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  29948. $1=$recv(importsForOutput)._value();
  29949. $ctx1.sendIdx["value"]=1;
  29950. $recv($1)._ifNotEmpty_((function(){
  29951. return $core.withContext(function($ctx2) {
  29952. $3=$recv($globals.String)._lf();
  29953. $ctx2.sendIdx["lf"]=1;
  29954. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  29955. $ctx2.sendIdx[","]=2;
  29956. $4=$recv($globals.String)._lf();
  29957. $ctx2.sendIdx["lf"]=2;
  29958. pragmaStart=$recv($2).__comma($4);
  29959. $ctx2.sendIdx[","]=1;
  29960. pragmaStart;
  29961. $6=$recv($globals.String)._lf();
  29962. $ctx2.sendIdx["lf"]=3;
  29963. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  29964. $ctx2.sendIdx[","]=4;
  29965. $7=$recv($globals.String)._lf();
  29966. $ctx2.sendIdx["lf"]=4;
  29967. pragmaEnd=$recv($5).__comma($7);
  29968. $ctx2.sendIdx[","]=3;
  29969. return pragmaEnd;
  29970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29971. }));
  29972. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  29973. $ctx1.sendIdx[","]=7;
  29974. $13=$recv($14).__comma([":2:"]);
  29975. $ctx1.sendIdx[","]=6;
  29976. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  29977. $ctx1.sendIdx[","]=5;
  29978. $11=$recv($12)._asJavaScriptSource();
  29979. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  29980. $ctx1.sendIdx["replace:with:"]=2;
  29981. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  29982. $ctx1.sendIdx["replace:with:"]=1;
  29983. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  29984. $ctx1.sendIdx[","]=8;
  29985. $17=$recv($18)._join_(",");
  29986. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  29987. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  29988. $ctx1.sendIdx["replace:with:"]=3;
  29989. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  29990. $recv(aStream)._write_($8);
  29991. $recv(aStream)._lf();
  29992. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  29993. return self;
  29994. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  29995. },
  29996. args: ["aPackage", "aStream"],
  29997. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| importsForOutput loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := ''.\x0a\x09pragmaEnd := ''.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09importsForOutput value ifNotEmpty: [\x0a\x09\x09pragmaStart := String lf, '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09\x09pragmaEnd := String lf, '//>>excludeEnd(\x22imports\x22);', String lf ].\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'define('.\x0a\x09\x09\x09((#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies asArray sorted) asJavaScriptSource\x0a\x09\x09\x09\x09replace: ',\x5cs*[\x22'']:1:[\x22'']' with: pragmaStart)\x0a\x09\x09\x09\x09replace: ',\x5cs*[\x22'']:2:[\x22'']' with: pragmaEnd.\x0a\x09\x09\x09', function('.\x0a\x09\x09\x09((((#('$boot' ':1:'), importsForOutput key, #(':2:')) join: ',') \x0a\x09\x09\x09\x09replace: ',\x5cs*:1:' with: pragmaStart)\x0a\x09\x09\x09\x09replace: ',\x5cs*:2:' with: pragmaEnd).\x0a\x09\x09\x09'){\x22use strict\x22;' };\x0a\x09\x09lf.\x0a\x09self exportPackageBodyBlockPrologueOf: aPackage on: aStream",
  29998. referencedClasses: ["String"],
  29999. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  30000. }),
  30001. $globals.AmdExporter);
  30002. $core.addMethod(
  30003. $core.method({
  30004. selector: "importsForOutput:",
  30005. protocol: "private",
  30006. fn: function (aPackage){
  30007. var self=this,$self=this;
  30008. var namedImports,anonImports,importVarNames;
  30009. return $core.withContext(function($ctx1) {
  30010. var $1;
  30011. namedImports=[];
  30012. anonImports=[];
  30013. importVarNames=[];
  30014. $recv($recv(aPackage)._imports())._do_((function(each){
  30015. return $core.withContext(function($ctx2) {
  30016. $1=$recv(each)._isString();
  30017. if($core.assert($1)){
  30018. return $recv(anonImports)._add_(each);
  30019. $ctx2.sendIdx["add:"]=1;
  30020. } else {
  30021. $recv(namedImports)._add_($recv(each)._value());
  30022. $ctx2.sendIdx["add:"]=2;
  30023. return $recv(importVarNames)._add_($recv(each)._key());
  30024. }
  30025. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30026. }));
  30027. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  30028. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  30029. },
  30030. args: ["aPackage"],
  30031. source: "importsForOutput: aPackage\x0a\x09\x22Returns an association where key is list of import variables\x0a\x09and value is list of external dependencies, with ones imported as variables\x0a\x09put at the beginning with same order as is in key.\x0a\x09\x0a\x09For example imports:{'jQuery'->'jquery'. 'bootstrap'} would yield\x0a\x09#('jQuery') -> #('jquery' 'bootstrap')\x22\x0a\x09| namedImports anonImports importVarNames |\x0a\x09namedImports := #().\x0a\x09anonImports := #().\x0a\x09importVarNames := #().\x0a\x09aPackage imports do: [ :each | each isString\x0a\x09\x09ifTrue: [ anonImports add: each ]\x0a\x09\x09ifFalse: [ namedImports add: each value.\x0a\x09\x09\x09importVarNames add: each key ]].\x0a\x09^ importVarNames -> (namedImports, anonImports)",
  30032. referencedClasses: [],
  30033. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  30034. }),
  30035. $globals.AmdExporter);
  30036. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  30037. $globals.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk";
  30038. $core.addMethod(
  30039. $core.method({
  30040. selector: "last",
  30041. protocol: "accessing",
  30042. fn: function (){
  30043. var self=this,$self=this;
  30044. return $self["@last"];
  30045. },
  30046. args: [],
  30047. source: "last\x0a\x09^ last",
  30048. referencedClasses: [],
  30049. messageSends: []
  30050. }),
  30051. $globals.ChunkParser);
  30052. $core.addMethod(
  30053. $core.method({
  30054. selector: "nextChunk",
  30055. protocol: "reading",
  30056. fn: function (){
  30057. var self=this,$self=this;
  30058. var char,result,chunk;
  30059. return $core.withContext(function($ctx1) {
  30060. var $1,$2,$3,$4;
  30061. var $early={};
  30062. try {
  30063. result=""._writeStream();
  30064. $recv((function(){
  30065. return $core.withContext(function($ctx2) {
  30066. char=$recv($self["@stream"])._next();
  30067. $ctx2.sendIdx["next"]=1;
  30068. char;
  30069. return $recv(char)._notNil();
  30070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30071. }))._whileTrue_((function(){
  30072. return $core.withContext(function($ctx2) {
  30073. $1=$recv(char).__eq("!");
  30074. $ctx2.sendIdx["="]=1;
  30075. if($core.assert($1)){
  30076. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  30077. if($core.assert($2)){
  30078. $recv($self["@stream"])._next();
  30079. } else {
  30080. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  30081. $3=$self["@last"];
  30082. throw $early=[$3];
  30083. }
  30084. }
  30085. return $recv(result)._nextPut_(char);
  30086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  30087. }));
  30088. $self["@last"]=nil;
  30089. $4=$self["@last"];
  30090. return $4;
  30091. }
  30092. catch(e) {if(e===$early)return e[0]; throw e}
  30093. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  30094. },
  30095. args: [],
  30096. source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This method returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[ char := stream next.\x0a\x09\x09char notNil ] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [ stream next \x22skipping the escape double\x22 ]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [ ^ last := result contents trimBoth \x22chunk end marker found\x22 ]].\x0a\x09\x09\x09\x09result nextPut: char ].\x0a\x09^ last := nil \x22a chunk needs to end with !\x22",
  30097. referencedClasses: [],
  30098. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  30099. }),
  30100. $globals.ChunkParser);
  30101. $core.addMethod(
  30102. $core.method({
  30103. selector: "stream:",
  30104. protocol: "accessing",
  30105. fn: function (aStream){
  30106. var self=this,$self=this;
  30107. $self["@stream"]=aStream;
  30108. return self;
  30109. },
  30110. args: ["aStream"],
  30111. source: "stream: aStream\x0a\x09stream := aStream",
  30112. referencedClasses: [],
  30113. messageSends: []
  30114. }),
  30115. $globals.ChunkParser);
  30116. $core.addMethod(
  30117. $core.method({
  30118. selector: "on:",
  30119. protocol: "instance creation",
  30120. fn: function (aStream){
  30121. var self=this,$self=this;
  30122. return $core.withContext(function($ctx1) {
  30123. return $recv($self._new())._stream_(aStream);
  30124. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  30125. },
  30126. args: ["aStream"],
  30127. source: "on: aStream\x0a\x09^ self new stream: aStream",
  30128. referencedClasses: [],
  30129. messageSends: ["stream:", "new"]
  30130. }),
  30131. $globals.ChunkParser.a$cls);
  30132. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  30133. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  30134. $core.addMethod(
  30135. $core.method({
  30136. selector: "class:",
  30137. protocol: "accessing",
  30138. fn: function (aClass){
  30139. var self=this,$self=this;
  30140. $self["@class"]=aClass;
  30141. return self;
  30142. },
  30143. args: ["aClass"],
  30144. source: "class: aClass\x0a\x09class := aClass",
  30145. referencedClasses: [],
  30146. messageSends: []
  30147. }),
  30148. $globals.ClassCommentReader);
  30149. $core.addMethod(
  30150. $core.method({
  30151. selector: "initialize",
  30152. protocol: "initialization",
  30153. fn: function (){
  30154. var self=this,$self=this;
  30155. return $core.withContext(function($ctx1) {
  30156. (
  30157. $ctx1.supercall = true,
  30158. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  30159. $ctx1.supercall = false;
  30160. return self;
  30161. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  30162. },
  30163. args: [],
  30164. source: "initialize\x0a\x09super initialize.",
  30165. referencedClasses: [],
  30166. messageSends: ["initialize"]
  30167. }),
  30168. $globals.ClassCommentReader);
  30169. $core.addMethod(
  30170. $core.method({
  30171. selector: "scanFrom:",
  30172. protocol: "fileIn",
  30173. fn: function (aChunkParser){
  30174. var self=this,$self=this;
  30175. var chunk;
  30176. return $core.withContext(function($ctx1) {
  30177. chunk=$recv(aChunkParser)._nextChunk();
  30178. $recv(chunk)._ifNotEmpty_((function(){
  30179. return $core.withContext(function($ctx2) {
  30180. return $self._setComment_(chunk);
  30181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30182. }));
  30183. return self;
  30184. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  30185. },
  30186. args: ["aChunkParser"],
  30187. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  30188. referencedClasses: [],
  30189. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  30190. }),
  30191. $globals.ClassCommentReader);
  30192. $core.addMethod(
  30193. $core.method({
  30194. selector: "setComment:",
  30195. protocol: "private",
  30196. fn: function (aString){
  30197. var self=this,$self=this;
  30198. return $core.withContext(function($ctx1) {
  30199. $recv($self["@class"])._comment_(aString);
  30200. return self;
  30201. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  30202. },
  30203. args: ["aString"],
  30204. source: "setComment: aString\x0a\x09class comment: aString",
  30205. referencedClasses: [],
  30206. messageSends: ["comment:"]
  30207. }),
  30208. $globals.ClassCommentReader);
  30209. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  30210. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  30211. $core.addMethod(
  30212. $core.method({
  30213. selector: "class:category:",
  30214. protocol: "accessing",
  30215. fn: function (aClass,aString){
  30216. var self=this,$self=this;
  30217. $self["@class"]=aClass;
  30218. $self["@category"]=aString;
  30219. return self;
  30220. },
  30221. args: ["aClass", "aString"],
  30222. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  30223. referencedClasses: [],
  30224. messageSends: []
  30225. }),
  30226. $globals.ClassProtocolReader);
  30227. $core.addMethod(
  30228. $core.method({
  30229. selector: "compileMethod:",
  30230. protocol: "private",
  30231. fn: function (aString){
  30232. var self=this,$self=this;
  30233. return $core.withContext(function($ctx1) {
  30234. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  30235. return self;
  30236. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  30237. },
  30238. args: ["aString"],
  30239. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  30240. referencedClasses: ["Compiler"],
  30241. messageSends: ["install:forClass:protocol:", "new"]
  30242. }),
  30243. $globals.ClassProtocolReader);
  30244. $core.addMethod(
  30245. $core.method({
  30246. selector: "initialize",
  30247. protocol: "initialization",
  30248. fn: function (){
  30249. var self=this,$self=this;
  30250. return $core.withContext(function($ctx1) {
  30251. (
  30252. $ctx1.supercall = true,
  30253. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  30254. $ctx1.supercall = false;
  30255. return self;
  30256. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  30257. },
  30258. args: [],
  30259. source: "initialize\x0a\x09super initialize.",
  30260. referencedClasses: [],
  30261. messageSends: ["initialize"]
  30262. }),
  30263. $globals.ClassProtocolReader);
  30264. $core.addMethod(
  30265. $core.method({
  30266. selector: "scanFrom:",
  30267. protocol: "fileIn",
  30268. fn: function (aChunkParser){
  30269. var self=this,$self=this;
  30270. var chunk;
  30271. return $core.withContext(function($ctx1) {
  30272. $recv((function(){
  30273. return $core.withContext(function($ctx2) {
  30274. chunk=$recv(aChunkParser)._nextChunk();
  30275. chunk;
  30276. return $recv(chunk)._isEmpty();
  30277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30278. }))._whileFalse_((function(){
  30279. return $core.withContext(function($ctx2) {
  30280. return $self._compileMethod_(chunk);
  30281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  30282. }));
  30283. return self;
  30284. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  30285. },
  30286. args: ["aChunkParser"],
  30287. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  30288. referencedClasses: [],
  30289. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  30290. }),
  30291. $globals.ClassProtocolReader);
  30292. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  30293. $globals.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
  30294. $core.addMethod(
  30295. $core.method({
  30296. selector: "methods",
  30297. protocol: "accessing",
  30298. fn: function (){
  30299. var self=this,$self=this;
  30300. return $core.withContext(function($ctx1) {
  30301. var $1;
  30302. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  30303. return $core.withContext(function($ctx2) {
  30304. $1=$recv(a)._selector();
  30305. $ctx2.sendIdx["selector"]=1;
  30306. return $recv($1).__lt_eq($recv(b)._selector());
  30307. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30308. }));
  30309. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  30310. },
  30311. args: [],
  30312. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  30313. referencedClasses: [],
  30314. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  30315. }),
  30316. $globals.ExportMethodProtocol);
  30317. $core.addMethod(
  30318. $core.method({
  30319. selector: "name",
  30320. protocol: "accessing",
  30321. fn: function (){
  30322. var self=this,$self=this;
  30323. return $self["@name"];
  30324. },
  30325. args: [],
  30326. source: "name\x0a\x09^ name",
  30327. referencedClasses: [],
  30328. messageSends: []
  30329. }),
  30330. $globals.ExportMethodProtocol);
  30331. $core.addMethod(
  30332. $core.method({
  30333. selector: "name:",
  30334. protocol: "accessing",
  30335. fn: function (aString){
  30336. var self=this,$self=this;
  30337. $self["@name"]=aString;
  30338. return self;
  30339. },
  30340. args: ["aString"],
  30341. source: "name: aString\x0a\x09name := aString",
  30342. referencedClasses: [],
  30343. messageSends: []
  30344. }),
  30345. $globals.ExportMethodProtocol);
  30346. $core.addMethod(
  30347. $core.method({
  30348. selector: "ownMethods",
  30349. protocol: "accessing",
  30350. fn: function (){
  30351. var self=this,$self=this;
  30352. return $core.withContext(function($ctx1) {
  30353. var $1;
  30354. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  30355. return $core.withContext(function($ctx2) {
  30356. $1=$recv(a)._selector();
  30357. $ctx2.sendIdx["selector"]=1;
  30358. return $recv($1).__lt_eq($recv(b)._selector());
  30359. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30360. }));
  30361. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  30362. },
  30363. args: [],
  30364. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  30365. referencedClasses: [],
  30366. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  30367. }),
  30368. $globals.ExportMethodProtocol);
  30369. $core.addMethod(
  30370. $core.method({
  30371. selector: "theClass",
  30372. protocol: "accessing",
  30373. fn: function (){
  30374. var self=this,$self=this;
  30375. return $self["@theClass"];
  30376. },
  30377. args: [],
  30378. source: "theClass\x0a\x09^ theClass",
  30379. referencedClasses: [],
  30380. messageSends: []
  30381. }),
  30382. $globals.ExportMethodProtocol);
  30383. $core.addMethod(
  30384. $core.method({
  30385. selector: "theClass:",
  30386. protocol: "accessing",
  30387. fn: function (aClass){
  30388. var self=this,$self=this;
  30389. $self["@theClass"]=aClass;
  30390. return self;
  30391. },
  30392. args: ["aClass"],
  30393. source: "theClass: aClass\x0a\x09theClass := aClass",
  30394. referencedClasses: [],
  30395. messageSends: []
  30396. }),
  30397. $globals.ExportMethodProtocol);
  30398. $core.addMethod(
  30399. $core.method({
  30400. selector: "name:theClass:",
  30401. protocol: "instance creation",
  30402. fn: function (aString,aClass){
  30403. var self=this,$self=this;
  30404. return $core.withContext(function($ctx1) {
  30405. var $1;
  30406. $1=$self._new();
  30407. $recv($1)._name_(aString);
  30408. $recv($1)._theClass_(aClass);
  30409. return $recv($1)._yourself();
  30410. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  30411. },
  30412. args: ["aString", "aClass"],
  30413. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  30414. referencedClasses: [],
  30415. messageSends: ["name:", "new", "theClass:", "yourself"]
  30416. }),
  30417. $globals.ExportMethodProtocol.a$cls);
  30418. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  30419. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  30420. $core.addMethod(
  30421. $core.method({
  30422. selector: "import:",
  30423. protocol: "fileIn",
  30424. fn: function (aStream){
  30425. var self=this,$self=this;
  30426. var chunk,result,parser,lastEmpty;
  30427. return $core.withContext(function($ctx1) {
  30428. var $1;
  30429. parser=$recv($globals.ChunkParser)._on_(aStream);
  30430. lastEmpty=false;
  30431. $self["@lastSection"]="n/a, not started";
  30432. $self["@lastChunk"]=nil;
  30433. $recv((function(){
  30434. return $core.withContext(function($ctx2) {
  30435. $recv((function(){
  30436. return $core.withContext(function($ctx3) {
  30437. chunk=$recv(parser)._nextChunk();
  30438. chunk;
  30439. return $recv(chunk)._isNil();
  30440. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  30441. }))._whileFalse_((function(){
  30442. return $core.withContext(function($ctx3) {
  30443. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  30444. lastEmpty=true;
  30445. return lastEmpty;
  30446. }),(function(){
  30447. return $core.withContext(function($ctx4) {
  30448. $self["@lastSection"]=chunk;
  30449. $self["@lastSection"];
  30450. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  30451. result;
  30452. $1=lastEmpty;
  30453. if($core.assert($1)){
  30454. lastEmpty=false;
  30455. lastEmpty;
  30456. return $recv(result)._scanFrom_(parser);
  30457. }
  30458. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  30459. }));
  30460. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  30461. }));
  30462. $self["@lastSection"]="n/a, finished";
  30463. return $self["@lastSection"];
  30464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30465. }))._on_do_($globals.Error,(function(e){
  30466. return $core.withContext(function($ctx2) {
  30467. $self["@lastChunk"]=$recv(parser)._last();
  30468. $self["@lastChunk"];
  30469. return $recv(e)._resignal();
  30470. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  30471. }));
  30472. return self;
  30473. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  30474. },
  30475. args: ["aStream"],
  30476. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].",
  30477. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  30478. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  30479. }),
  30480. $globals.Importer);
  30481. $core.addMethod(
  30482. $core.method({
  30483. selector: "lastChunk",
  30484. protocol: "accessing",
  30485. fn: function (){
  30486. var self=this,$self=this;
  30487. return $self["@lastChunk"];
  30488. },
  30489. args: [],
  30490. source: "lastChunk\x0a\x09^ lastChunk",
  30491. referencedClasses: [],
  30492. messageSends: []
  30493. }),
  30494. $globals.Importer);
  30495. $core.addMethod(
  30496. $core.method({
  30497. selector: "lastSection",
  30498. protocol: "accessing",
  30499. fn: function (){
  30500. var self=this,$self=this;
  30501. return $self["@lastSection"];
  30502. },
  30503. args: [],
  30504. source: "lastSection\x0a\x09^ lastSection",
  30505. referencedClasses: [],
  30506. messageSends: []
  30507. }),
  30508. $globals.Importer);
  30509. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  30510. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  30511. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  30512. $globals.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  30513. $core.addMethod(
  30514. $core.method({
  30515. selector: "ajaxPutAt:data:onSuccess:onError:",
  30516. protocol: "private",
  30517. fn: function (aURL,aString,aBlock,anotherBlock){
  30518. var self=this,$self=this;
  30519. var xhr;
  30520. return $core.withContext(function($ctx1) {
  30521. var $1,$4,$3,$2;
  30522. xhr=$recv($globals.Platform)._newXhr();
  30523. $recv(xhr)._open_url_async_("PUT",aURL,true);
  30524. $recv(xhr)._onreadystatechange_((function(){
  30525. return $core.withContext(function($ctx2) {
  30526. $1=$recv($recv(xhr)._readyState()).__eq((4));
  30527. if($core.assert($1)){
  30528. $4=$recv(xhr)._status();
  30529. $ctx2.sendIdx["status"]=1;
  30530. $3=$recv($4).__gt_eq((200));
  30531. $2=$recv($3)._and_((function(){
  30532. return $core.withContext(function($ctx3) {
  30533. return $recv($recv(xhr)._status()).__lt((300));
  30534. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  30535. }));
  30536. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  30537. }
  30538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30539. }));
  30540. $recv(xhr)._send_(aString);
  30541. return self;
  30542. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  30543. },
  30544. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  30545. source: "ajaxPutAt: aURL data: aString onSuccess: aBlock onError: anotherBlock\x0a\x09| xhr |\x0a\x09xhr := Platform newXhr.\x0a\x09xhr open: 'PUT' url: aURL async: true.\x0a\x09xhr onreadystatechange: [\x0a\x09\x09xhr readyState = 4 ifTrue: [\x0a\x09\x09\x09(xhr status >= 200 and: [ xhr status < 300 ])\x0a\x09\x09\x09\x09ifTrue: aBlock\x0a\x09\x09\x09\x09ifFalse: anotherBlock ]].\x0a\x09xhr send: aString",
  30546. referencedClasses: ["Platform"],
  30547. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  30548. }),
  30549. $globals.PackageHandler);
  30550. $core.addMethod(
  30551. $core.method({
  30552. selector: "chunkContentsFor:",
  30553. protocol: "accessing",
  30554. fn: function (aPackage){
  30555. var self=this,$self=this;
  30556. return $core.withContext(function($ctx1) {
  30557. return $recv($globals.String)._streamContents_((function(str){
  30558. return $core.withContext(function($ctx2) {
  30559. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  30560. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  30561. }));
  30562. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  30563. },
  30564. args: ["aPackage"],
  30565. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  30566. referencedClasses: ["String"],
  30567. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  30568. }),
  30569. $globals.PackageHandler);
  30570. $core.addMethod(
  30571. $core.method({
  30572. selector: "chunkExporter",
  30573. protocol: "factory",
  30574. fn: function (){
  30575. var self=this,$self=this;
  30576. return $core.withContext(function($ctx1) {
  30577. return $recv($self._chunkExporterClass())._new();
  30578. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  30579. },
  30580. args: [],
  30581. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  30582. referencedClasses: [],
  30583. messageSends: ["new", "chunkExporterClass"]
  30584. }),
  30585. $globals.PackageHandler);
  30586. $core.addMethod(
  30587. $core.method({
  30588. selector: "chunkExporterClass",
  30589. protocol: "accessing",
  30590. fn: function (){
  30591. var self=this,$self=this;
  30592. return $globals.ChunkExporter;
  30593. },
  30594. args: [],
  30595. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  30596. referencedClasses: ["ChunkExporter"],
  30597. messageSends: []
  30598. }),
  30599. $globals.PackageHandler);
  30600. $core.addMethod(
  30601. $core.method({
  30602. selector: "commit:",
  30603. protocol: "committing",
  30604. fn: function (aPackage){
  30605. var self=this,$self=this;
  30606. return $core.withContext(function($ctx1) {
  30607. var $1,$2;
  30608. $self._commit_onSuccess_onError_(aPackage,(function(){
  30609. }),(function(error){
  30610. return $core.withContext(function($ctx2) {
  30611. $1=$recv($globals.PackageCommitError)._new();
  30612. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  30613. $ctx2.sendIdx[","]=1;
  30614. $recv($1)._messageText_($2);
  30615. return $recv($1)._signal();
  30616. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  30617. }));
  30618. return self;
  30619. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  30620. },
  30621. args: ["aPackage"],
  30622. source: "commit: aPackage\x0a\x09self \x0a\x09\x09commit: aPackage\x0a\x09\x09onSuccess: []\x0a\x09\x09onError: [ :error |\x0a\x09\x09\x09PackageCommitError new\x0a\x09\x09\x09\x09messageText: 'Commiting failed with reason: \x22' , (error responseText) , '\x22';\x0a\x09\x09\x09\x09signal ]",
  30623. referencedClasses: ["PackageCommitError"],
  30624. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  30625. }),
  30626. $globals.PackageHandler);
  30627. $core.addMethod(
  30628. $core.method({
  30629. selector: "commit:onSuccess:onError:",
  30630. protocol: "committing",
  30631. fn: function (aPackage,aBlock,anotherBlock){
  30632. var self=this,$self=this;
  30633. return $core.withContext(function($ctx1) {
  30634. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  30635. return $core.withContext(function($ctx2) {
  30636. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  30637. return $core.withContext(function($ctx3) {
  30638. $recv(aPackage)._beClean();
  30639. return $recv(aBlock)._value();
  30640. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  30641. }),anotherBlock);
  30642. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30643. }),anotherBlock);
  30644. return self;
  30645. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  30646. },
  30647. args: ["aPackage", "aBlock", "anotherBlock"],
  30648. source: "commit: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09commitJsFileFor: aPackage \x0a\x09\x09onSuccess: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09commitStFileFor: aPackage \x0a\x09\x09\x09\x09onSuccess: [ aPackage beClean. aBlock value ]\x0a\x09\x09\x09\x09onError: anotherBlock ] \x0a\x09\x09onError: anotherBlock",
  30649. referencedClasses: [],
  30650. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  30651. }),
  30652. $globals.PackageHandler);
  30653. $core.addMethod(
  30654. $core.method({
  30655. selector: "commitJsFileFor:onSuccess:onError:",
  30656. protocol: "committing",
  30657. fn: function (aPackage,aBlock,anotherBlock){
  30658. var self=this,$self=this;
  30659. return $core.withContext(function($ctx1) {
  30660. var $2,$1;
  30661. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  30662. $ctx1.sendIdx[","]=2;
  30663. $1=$recv($2).__comma(".js");
  30664. $ctx1.sendIdx[","]=1;
  30665. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  30666. return self;
  30667. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  30668. },
  30669. args: ["aPackage", "aBlock", "anotherBlock"],
  30670. source: "commitJsFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  30671. referencedClasses: [],
  30672. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  30673. }),
  30674. $globals.PackageHandler);
  30675. $core.addMethod(
  30676. $core.method({
  30677. selector: "commitPathJsFor:",
  30678. protocol: "accessing",
  30679. fn: function (aPackage){
  30680. var self=this,$self=this;
  30681. return $core.withContext(function($ctx1) {
  30682. $self._subclassResponsibility();
  30683. return self;
  30684. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  30685. },
  30686. args: ["aPackage"],
  30687. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  30688. referencedClasses: [],
  30689. messageSends: ["subclassResponsibility"]
  30690. }),
  30691. $globals.PackageHandler);
  30692. $core.addMethod(
  30693. $core.method({
  30694. selector: "commitPathStFor:",
  30695. protocol: "accessing",
  30696. fn: function (aPackage){
  30697. var self=this,$self=this;
  30698. return $core.withContext(function($ctx1) {
  30699. $self._subclassResponsibility();
  30700. return self;
  30701. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  30702. },
  30703. args: ["aPackage"],
  30704. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  30705. referencedClasses: [],
  30706. messageSends: ["subclassResponsibility"]
  30707. }),
  30708. $globals.PackageHandler);
  30709. $core.addMethod(
  30710. $core.method({
  30711. selector: "commitStFileFor:onSuccess:onError:",
  30712. protocol: "committing",
  30713. fn: function (aPackage,aBlock,anotherBlock){
  30714. var self=this,$self=this;
  30715. return $core.withContext(function($ctx1) {
  30716. var $2,$1;
  30717. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  30718. $ctx1.sendIdx[","]=2;
  30719. $1=$recv($2).__comma(".st");
  30720. $ctx1.sendIdx[","]=1;
  30721. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  30722. return self;
  30723. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  30724. },
  30725. args: ["aPackage", "aBlock", "anotherBlock"],
  30726. source: "commitStFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  30727. referencedClasses: [],
  30728. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  30729. }),
  30730. $globals.PackageHandler);
  30731. $core.addMethod(
  30732. $core.method({
  30733. selector: "contentsFor:",
  30734. protocol: "accessing",
  30735. fn: function (aPackage){
  30736. var self=this,$self=this;
  30737. return $core.withContext(function($ctx1) {
  30738. return $recv($globals.String)._streamContents_((function(str){
  30739. return $core.withContext(function($ctx2) {
  30740. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  30741. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  30742. }));
  30743. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  30744. },
  30745. args: ["aPackage"],
  30746. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  30747. referencedClasses: ["String"],
  30748. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  30749. }),
  30750. $globals.PackageHandler);
  30751. $core.addMethod(
  30752. $core.method({
  30753. selector: "exporter",
  30754. protocol: "factory",
  30755. fn: function (){
  30756. var self=this,$self=this;
  30757. return $core.withContext(function($ctx1) {
  30758. return $recv($self._exporterClass())._new();
  30759. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  30760. },
  30761. args: [],
  30762. source: "exporter\x0a\x09^ self exporterClass new",
  30763. referencedClasses: [],
  30764. messageSends: ["new", "exporterClass"]
  30765. }),
  30766. $globals.PackageHandler);
  30767. $core.addMethod(
  30768. $core.method({
  30769. selector: "exporterClass",
  30770. protocol: "accessing",
  30771. fn: function (){
  30772. var self=this,$self=this;
  30773. return $core.withContext(function($ctx1) {
  30774. $self._subclassResponsibility();
  30775. return self;
  30776. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  30777. },
  30778. args: [],
  30779. source: "exporterClass\x0a\x09self subclassResponsibility",
  30780. referencedClasses: [],
  30781. messageSends: ["subclassResponsibility"]
  30782. }),
  30783. $globals.PackageHandler);
  30784. $core.addMethod(
  30785. $core.method({
  30786. selector: "load:",
  30787. protocol: "loading",
  30788. fn: function (aPackage){
  30789. var self=this,$self=this;
  30790. return $core.withContext(function($ctx1) {
  30791. $self._subclassResponsibility();
  30792. return self;
  30793. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  30794. },
  30795. args: ["aPackage"],
  30796. source: "load: aPackage\x0a\x09self subclassResponsibility",
  30797. referencedClasses: [],
  30798. messageSends: ["subclassResponsibility"]
  30799. }),
  30800. $globals.PackageHandler);
  30801. $core.addMethod(
  30802. $core.method({
  30803. selector: "onCommitError:",
  30804. protocol: "error handling",
  30805. fn: function (anError){
  30806. var self=this,$self=this;
  30807. return $core.withContext(function($ctx1) {
  30808. var $1,$2;
  30809. $1=$recv($globals.PackageCommitError)._new();
  30810. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  30811. $ctx1.sendIdx[","]=1;
  30812. $recv($1)._messageText_($2);
  30813. $recv($1)._signal();
  30814. return self;
  30815. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  30816. },
  30817. args: ["anError"],
  30818. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  30819. referencedClasses: ["PackageCommitError"],
  30820. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  30821. }),
  30822. $globals.PackageHandler);
  30823. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  30824. $globals.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  30825. $core.addMethod(
  30826. $core.method({
  30827. selector: "commitPathJsFor:",
  30828. protocol: "accessing",
  30829. fn: function (aPackage){
  30830. var self=this,$self=this;
  30831. return $core.withContext(function($ctx1) {
  30832. return $self._toUrl_($self._namespaceFor_(aPackage));
  30833. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  30834. },
  30835. args: ["aPackage"],
  30836. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  30837. referencedClasses: [],
  30838. messageSends: ["toUrl:", "namespaceFor:"]
  30839. }),
  30840. $globals.AmdPackageHandler);
  30841. $core.addMethod(
  30842. $core.method({
  30843. selector: "commitPathStFor:",
  30844. protocol: "accessing",
  30845. fn: function (aPackage){
  30846. var self=this,$self=this;
  30847. var path,pathWithout;
  30848. return $core.withContext(function($ctx1) {
  30849. var $1,$2;
  30850. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  30851. $ctx1.sendIdx[","]=1;
  30852. path=$self._toUrl_($1);
  30853. pathWithout=$self._commitPathJsFor_(aPackage);
  30854. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  30855. if($core.assert($2)){
  30856. return pathWithout;
  30857. } else {
  30858. return path;
  30859. }
  30860. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  30861. },
  30862. args: ["aPackage"],
  30863. source: "commitPathStFor: aPackage\x0a\x09\x22If _source is not mapped, .st will be committed to .js path.\x0a\x09It is recommended not to use _source as it can be deprecated.\x22\x0a\x09\x0a\x09| path pathWithout |\x0a\x09path := self toUrl: (self namespaceFor: aPackage), '/_source'.\x0a\x09pathWithout := self commitPathJsFor: aPackage.\x0a\x09^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]",
  30864. referencedClasses: [],
  30865. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  30866. }),
  30867. $globals.AmdPackageHandler);
  30868. $core.addMethod(
  30869. $core.method({
  30870. selector: "exporterClass",
  30871. protocol: "accessing",
  30872. fn: function (){
  30873. var self=this,$self=this;
  30874. return $globals.AmdExporter;
  30875. },
  30876. args: [],
  30877. source: "exporterClass\x0a\x09^ AmdExporter",
  30878. referencedClasses: ["AmdExporter"],
  30879. messageSends: []
  30880. }),
  30881. $globals.AmdPackageHandler);
  30882. $core.addMethod(
  30883. $core.method({
  30884. selector: "load:",
  30885. protocol: "loading",
  30886. fn: function (aPackage){
  30887. var self=this,$self=this;
  30888. return $core.withContext(function($ctx1) {
  30889. var $1,$3,$2,$receiver;
  30890. $1=$recv($globals.Smalltalk)._amdRequire();
  30891. if(($receiver = $1) == null || $receiver.a$nil){
  30892. $self._error_("AMD loader not present");
  30893. } else {
  30894. var require;
  30895. require=$receiver;
  30896. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  30897. $ctx1.sendIdx[","]=1;
  30898. $2=$recv($globals.Array)._with_($3);
  30899. $recv(require)._value_($2);
  30900. }
  30901. return self;
  30902. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  30903. },
  30904. args: ["aPackage"],
  30905. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  30906. referencedClasses: ["Smalltalk", "Array"],
  30907. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  30908. }),
  30909. $globals.AmdPackageHandler);
  30910. $core.addMethod(
  30911. $core.method({
  30912. selector: "namespaceFor:",
  30913. protocol: "committing",
  30914. fn: function (aPackage){
  30915. var self=this,$self=this;
  30916. return $core.withContext(function($ctx1) {
  30917. return $recv($recv(aPackage)._transport())._namespace();
  30918. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  30919. },
  30920. args: ["aPackage"],
  30921. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  30922. referencedClasses: [],
  30923. messageSends: ["namespace", "transport"]
  30924. }),
  30925. $globals.AmdPackageHandler);
  30926. $core.addMethod(
  30927. $core.method({
  30928. selector: "toUrl:",
  30929. protocol: "private",
  30930. fn: function (aString){
  30931. var self=this,$self=this;
  30932. return $core.withContext(function($ctx1) {
  30933. var $1,$receiver;
  30934. $1=$recv($globals.Smalltalk)._amdRequire();
  30935. if(($receiver = $1) == null || $receiver.a$nil){
  30936. return $self._error_("AMD loader not present");
  30937. } else {
  30938. var require;
  30939. require=$receiver;
  30940. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  30941. }
  30942. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  30943. },
  30944. args: ["aString"],
  30945. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  30946. referencedClasses: ["Smalltalk"],
  30947. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  30948. }),
  30949. $globals.AmdPackageHandler);
  30950. $core.addMethod(
  30951. $core.method({
  30952. selector: "defaultNamespace",
  30953. protocol: "commit paths",
  30954. fn: function (){
  30955. var self=this,$self=this;
  30956. return $core.withContext(function($ctx1) {
  30957. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  30958. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  30959. },
  30960. args: [],
  30961. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  30962. referencedClasses: ["Smalltalk"],
  30963. messageSends: ["defaultAmdNamespace"]
  30964. }),
  30965. $globals.AmdPackageHandler.a$cls);
  30966. $core.addMethod(
  30967. $core.method({
  30968. selector: "defaultNamespace:",
  30969. protocol: "commit paths",
  30970. fn: function (aString){
  30971. var self=this,$self=this;
  30972. return $core.withContext(function($ctx1) {
  30973. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  30974. return self;
  30975. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  30976. },
  30977. args: ["aString"],
  30978. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  30979. referencedClasses: ["Smalltalk"],
  30980. messageSends: ["defaultAmdNamespace:"]
  30981. }),
  30982. $globals.AmdPackageHandler.a$cls);
  30983. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  30984. $globals.PackageTransport.comment="I represent the transport mechanism used to commit a package.\x0a\x0aMy concrete subclasses have a `#handler` to which committing is delegated.";
  30985. $core.addMethod(
  30986. $core.method({
  30987. selector: "asJavaScriptObject",
  30988. protocol: "converting",
  30989. fn: function (){
  30990. var self=this,$self=this;
  30991. return $core.withContext(function($ctx1) {
  30992. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  30993. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  30994. },
  30995. args: [],
  30996. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  30997. referencedClasses: [],
  30998. messageSends: ["type"]
  30999. }),
  31000. $globals.PackageTransport);
  31001. $core.addMethod(
  31002. $core.method({
  31003. selector: "commit",
  31004. protocol: "committing",
  31005. fn: function (){
  31006. var self=this,$self=this;
  31007. return $core.withContext(function($ctx1) {
  31008. $recv($self._commitHandler())._commit_($self._package());
  31009. return self;
  31010. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  31011. },
  31012. args: [],
  31013. source: "commit\x0a\x09self commitHandler commit: self package",
  31014. referencedClasses: [],
  31015. messageSends: ["commit:", "commitHandler", "package"]
  31016. }),
  31017. $globals.PackageTransport);
  31018. $core.addMethod(
  31019. $core.method({
  31020. selector: "commitHandler",
  31021. protocol: "factory",
  31022. fn: function (){
  31023. var self=this,$self=this;
  31024. return $core.withContext(function($ctx1) {
  31025. return $recv($self._commitHandlerClass())._new();
  31026. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  31027. },
  31028. args: [],
  31029. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  31030. referencedClasses: [],
  31031. messageSends: ["new", "commitHandlerClass"]
  31032. }),
  31033. $globals.PackageTransport);
  31034. $core.addMethod(
  31035. $core.method({
  31036. selector: "commitHandlerClass",
  31037. protocol: "accessing",
  31038. fn: function (){
  31039. var self=this,$self=this;
  31040. return $core.withContext(function($ctx1) {
  31041. $self._subclassResponsibility();
  31042. return self;
  31043. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  31044. },
  31045. args: [],
  31046. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  31047. referencedClasses: [],
  31048. messageSends: ["subclassResponsibility"]
  31049. }),
  31050. $globals.PackageTransport);
  31051. $core.addMethod(
  31052. $core.method({
  31053. selector: "commitOnSuccess:onError:",
  31054. protocol: "committing",
  31055. fn: function (aBlock,anotherBlock){
  31056. var self=this,$self=this;
  31057. return $core.withContext(function($ctx1) {
  31058. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  31059. return self;
  31060. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  31061. },
  31062. args: ["aBlock", "anotherBlock"],
  31063. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  31064. referencedClasses: [],
  31065. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  31066. }),
  31067. $globals.PackageTransport);
  31068. $core.addMethod(
  31069. $core.method({
  31070. selector: "definition",
  31071. protocol: "accessing",
  31072. fn: function (){
  31073. var self=this,$self=this;
  31074. return "";
  31075. },
  31076. args: [],
  31077. source: "definition\x0a\x09^ ''",
  31078. referencedClasses: [],
  31079. messageSends: []
  31080. }),
  31081. $globals.PackageTransport);
  31082. $core.addMethod(
  31083. $core.method({
  31084. selector: "load",
  31085. protocol: "loading",
  31086. fn: function (){
  31087. var self=this,$self=this;
  31088. return $core.withContext(function($ctx1) {
  31089. $recv($self._commitHandler())._load_($self._package());
  31090. return self;
  31091. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  31092. },
  31093. args: [],
  31094. source: "load\x0a\x09self commitHandler load: self package",
  31095. referencedClasses: [],
  31096. messageSends: ["load:", "commitHandler", "package"]
  31097. }),
  31098. $globals.PackageTransport);
  31099. $core.addMethod(
  31100. $core.method({
  31101. selector: "package",
  31102. protocol: "accessing",
  31103. fn: function (){
  31104. var self=this,$self=this;
  31105. return $self["@package"];
  31106. },
  31107. args: [],
  31108. source: "package\x0a\x09^ package",
  31109. referencedClasses: [],
  31110. messageSends: []
  31111. }),
  31112. $globals.PackageTransport);
  31113. $core.addMethod(
  31114. $core.method({
  31115. selector: "package:",
  31116. protocol: "accessing",
  31117. fn: function (aPackage){
  31118. var self=this,$self=this;
  31119. $self["@package"]=aPackage;
  31120. return self;
  31121. },
  31122. args: ["aPackage"],
  31123. source: "package: aPackage\x0a\x09package := aPackage",
  31124. referencedClasses: [],
  31125. messageSends: []
  31126. }),
  31127. $globals.PackageTransport);
  31128. $core.addMethod(
  31129. $core.method({
  31130. selector: "setupFromJson:",
  31131. protocol: "initialization",
  31132. fn: function (anObject){
  31133. var self=this,$self=this;
  31134. return self;
  31135. },
  31136. args: ["anObject"],
  31137. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  31138. referencedClasses: [],
  31139. messageSends: []
  31140. }),
  31141. $globals.PackageTransport);
  31142. $core.addMethod(
  31143. $core.method({
  31144. selector: "type",
  31145. protocol: "accessing",
  31146. fn: function (){
  31147. var self=this,$self=this;
  31148. return $core.withContext(function($ctx1) {
  31149. return $recv($self._class())._type();
  31150. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  31151. },
  31152. args: [],
  31153. source: "type\x0a\x09^ self class type",
  31154. referencedClasses: [],
  31155. messageSends: ["type", "class"]
  31156. }),
  31157. $globals.PackageTransport);
  31158. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  31159. $core.addMethod(
  31160. $core.method({
  31161. selector: "classRegisteredFor:",
  31162. protocol: "accessing",
  31163. fn: function (aString){
  31164. var self=this,$self=this;
  31165. return $core.withContext(function($ctx1) {
  31166. return $recv($self["@registry"])._at_(aString);
  31167. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  31168. },
  31169. args: ["aString"],
  31170. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  31171. referencedClasses: [],
  31172. messageSends: ["at:"]
  31173. }),
  31174. $globals.PackageTransport.a$cls);
  31175. $core.addMethod(
  31176. $core.method({
  31177. selector: "defaultType",
  31178. protocol: "accessing",
  31179. fn: function (){
  31180. var self=this,$self=this;
  31181. return $core.withContext(function($ctx1) {
  31182. return $recv($globals.AmdPackageTransport)._type();
  31183. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  31184. },
  31185. args: [],
  31186. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  31187. referencedClasses: ["AmdPackageTransport"],
  31188. messageSends: ["type"]
  31189. }),
  31190. $globals.PackageTransport.a$cls);
  31191. $core.addMethod(
  31192. $core.method({
  31193. selector: "for:",
  31194. protocol: "instance creation",
  31195. fn: function (aString){
  31196. var self=this,$self=this;
  31197. return $core.withContext(function($ctx1) {
  31198. return $recv($self._classRegisteredFor_(aString))._new();
  31199. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  31200. },
  31201. args: ["aString"],
  31202. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  31203. referencedClasses: [],
  31204. messageSends: ["new", "classRegisteredFor:"]
  31205. }),
  31206. $globals.PackageTransport.a$cls);
  31207. $core.addMethod(
  31208. $core.method({
  31209. selector: "fromJson:",
  31210. protocol: "instance creation",
  31211. fn: function (anObject){
  31212. var self=this,$self=this;
  31213. return $core.withContext(function($ctx1) {
  31214. var $1,$2,$receiver;
  31215. if(($receiver = anObject) == null || $receiver.a$nil){
  31216. $1=$self._for_($self._defaultType());
  31217. $ctx1.sendIdx["for:"]=1;
  31218. return $1;
  31219. } else {
  31220. anObject;
  31221. }
  31222. $2=$self._for_($recv(anObject)._type());
  31223. $recv($2)._setupFromJson_(anObject);
  31224. return $recv($2)._yourself();
  31225. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  31226. },
  31227. args: ["anObject"],
  31228. source: "fromJson: anObject\x0a\x09anObject ifNil: [ ^ self for: self defaultType ].\x0a\x09\x0a\x09^ (self for: anObject type)\x0a\x09\x09setupFromJson: anObject;\x0a\x09\x09yourself",
  31229. referencedClasses: [],
  31230. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  31231. }),
  31232. $globals.PackageTransport.a$cls);
  31233. $core.addMethod(
  31234. $core.method({
  31235. selector: "initialize",
  31236. protocol: "initialization",
  31237. fn: function (){
  31238. var self=this,$self=this;
  31239. return $core.withContext(function($ctx1) {
  31240. var $1;
  31241. (
  31242. $ctx1.supercall = true,
  31243. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31244. $ctx1.supercall = false;
  31245. $1=$self.__eq_eq($globals.PackageTransport);
  31246. if($core.assert($1)){
  31247. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  31248. $self["@registry"];
  31249. } else {
  31250. $self._register();
  31251. }
  31252. return self;
  31253. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  31254. },
  31255. args: [],
  31256. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  31257. referencedClasses: ["PackageTransport"],
  31258. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  31259. }),
  31260. $globals.PackageTransport.a$cls);
  31261. $core.addMethod(
  31262. $core.method({
  31263. selector: "register",
  31264. protocol: "registration",
  31265. fn: function (){
  31266. var self=this,$self=this;
  31267. return $core.withContext(function($ctx1) {
  31268. $recv($globals.PackageTransport)._register_(self);
  31269. return self;
  31270. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  31271. },
  31272. args: [],
  31273. source: "register\x0a\x09PackageTransport register: self",
  31274. referencedClasses: ["PackageTransport"],
  31275. messageSends: ["register:"]
  31276. }),
  31277. $globals.PackageTransport.a$cls);
  31278. $core.addMethod(
  31279. $core.method({
  31280. selector: "register:",
  31281. protocol: "registration",
  31282. fn: function (aClass){
  31283. var self=this,$self=this;
  31284. return $core.withContext(function($ctx1) {
  31285. var $1,$receiver;
  31286. $1=$recv(aClass)._type();
  31287. $ctx1.sendIdx["type"]=1;
  31288. if(($receiver = $1) == null || $receiver.a$nil){
  31289. $1;
  31290. } else {
  31291. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  31292. }
  31293. return self;
  31294. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  31295. },
  31296. args: ["aClass"],
  31297. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  31298. referencedClasses: [],
  31299. messageSends: ["ifNotNil:", "type", "at:put:"]
  31300. }),
  31301. $globals.PackageTransport.a$cls);
  31302. $core.addMethod(
  31303. $core.method({
  31304. selector: "type",
  31305. protocol: "accessing",
  31306. fn: function (){
  31307. var self=this,$self=this;
  31308. return nil;
  31309. },
  31310. args: [],
  31311. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  31312. referencedClasses: [],
  31313. messageSends: []
  31314. }),
  31315. $globals.PackageTransport.a$cls);
  31316. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  31317. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  31318. $core.addMethod(
  31319. $core.method({
  31320. selector: "asJavaScriptObject",
  31321. protocol: "converting",
  31322. fn: function (){
  31323. var self=this,$self=this;
  31324. return $core.withContext(function($ctx1) {
  31325. var $1;
  31326. $1=(
  31327. $ctx1.supercall = true,
  31328. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  31329. $ctx1.supercall = false;
  31330. $recv($1)._at_put_("amdNamespace",$self._namespace());
  31331. return $recv($1)._yourself();
  31332. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  31333. },
  31334. args: [],
  31335. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  31336. referencedClasses: [],
  31337. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  31338. }),
  31339. $globals.AmdPackageTransport);
  31340. $core.addMethod(
  31341. $core.method({
  31342. selector: "commitHandlerClass",
  31343. protocol: "accessing",
  31344. fn: function (){
  31345. var self=this,$self=this;
  31346. return $globals.AmdPackageHandler;
  31347. },
  31348. args: [],
  31349. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  31350. referencedClasses: ["AmdPackageHandler"],
  31351. messageSends: []
  31352. }),
  31353. $globals.AmdPackageTransport);
  31354. $core.addMethod(
  31355. $core.method({
  31356. selector: "defaultNamespace",
  31357. protocol: "defaults",
  31358. fn: function (){
  31359. var self=this,$self=this;
  31360. return $core.withContext(function($ctx1) {
  31361. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  31362. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  31363. },
  31364. args: [],
  31365. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  31366. referencedClasses: ["Smalltalk"],
  31367. messageSends: ["defaultAmdNamespace"]
  31368. }),
  31369. $globals.AmdPackageTransport);
  31370. $core.addMethod(
  31371. $core.method({
  31372. selector: "definition",
  31373. protocol: "accessing",
  31374. fn: function (){
  31375. var self=this,$self=this;
  31376. return $core.withContext(function($ctx1) {
  31377. return $recv($globals.String)._streamContents_((function(stream){
  31378. return $core.withContext(function($ctx2) {
  31379. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  31380. return $recv(stream)._print_($self._namespace());
  31381. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  31382. }));
  31383. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  31384. },
  31385. args: [],
  31386. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  31387. referencedClasses: ["String"],
  31388. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  31389. }),
  31390. $globals.AmdPackageTransport);
  31391. $core.addMethod(
  31392. $core.method({
  31393. selector: "namespace",
  31394. protocol: "accessing",
  31395. fn: function (){
  31396. var self=this,$self=this;
  31397. return $core.withContext(function($ctx1) {
  31398. var $1,$receiver;
  31399. $1=$self["@namespace"];
  31400. if(($receiver = $1) == null || $receiver.a$nil){
  31401. return $self._defaultNamespace();
  31402. } else {
  31403. return $1;
  31404. }
  31405. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  31406. },
  31407. args: [],
  31408. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  31409. referencedClasses: [],
  31410. messageSends: ["ifNil:", "defaultNamespace"]
  31411. }),
  31412. $globals.AmdPackageTransport);
  31413. $core.addMethod(
  31414. $core.method({
  31415. selector: "namespace:",
  31416. protocol: "accessing",
  31417. fn: function (aString){
  31418. var self=this,$self=this;
  31419. $self["@namespace"]=aString;
  31420. return self;
  31421. },
  31422. args: ["aString"],
  31423. source: "namespace: aString\x0a\x09namespace := aString",
  31424. referencedClasses: [],
  31425. messageSends: []
  31426. }),
  31427. $globals.AmdPackageTransport);
  31428. $core.addMethod(
  31429. $core.method({
  31430. selector: "printOn:",
  31431. protocol: "printing",
  31432. fn: function (aStream){
  31433. var self=this,$self=this;
  31434. return $core.withContext(function($ctx1) {
  31435. (
  31436. $ctx1.supercall = true,
  31437. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  31438. $ctx1.supercall = false;
  31439. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  31440. $ctx1.sendIdx["nextPutAll:"]=1;
  31441. $recv(aStream)._nextPutAll_($self._namespace());
  31442. $ctx1.sendIdx["nextPutAll:"]=2;
  31443. $recv(aStream)._nextPutAll_(")");
  31444. return self;
  31445. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  31446. },
  31447. args: ["aStream"],
  31448. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  31449. referencedClasses: [],
  31450. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  31451. }),
  31452. $globals.AmdPackageTransport);
  31453. $core.addMethod(
  31454. $core.method({
  31455. selector: "setPath:",
  31456. protocol: "actions",
  31457. fn: function (aString){
  31458. var self=this,$self=this;
  31459. return $core.withContext(function($ctx1) {
  31460. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  31461. return self;
  31462. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  31463. },
  31464. args: ["aString"],
  31465. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  31466. referencedClasses: [],
  31467. messageSends: ["value:", "basicAt:", "namespace"]
  31468. }),
  31469. $globals.AmdPackageTransport);
  31470. $core.addMethod(
  31471. $core.method({
  31472. selector: "setupFromJson:",
  31473. protocol: "initialization",
  31474. fn: function (anObject){
  31475. var self=this,$self=this;
  31476. return $core.withContext(function($ctx1) {
  31477. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  31478. return self;
  31479. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  31480. },
  31481. args: ["anObject"],
  31482. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  31483. referencedClasses: [],
  31484. messageSends: ["namespace:", "at:"]
  31485. }),
  31486. $globals.AmdPackageTransport);
  31487. $core.addMethod(
  31488. $core.method({
  31489. selector: "namespace:",
  31490. protocol: "instance creation",
  31491. fn: function (aString){
  31492. var self=this,$self=this;
  31493. return $core.withContext(function($ctx1) {
  31494. var $1;
  31495. $1=$self._new();
  31496. $recv($1)._namespace_(aString);
  31497. return $recv($1)._yourself();
  31498. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  31499. },
  31500. args: ["aString"],
  31501. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  31502. referencedClasses: [],
  31503. messageSends: ["namespace:", "new", "yourself"]
  31504. }),
  31505. $globals.AmdPackageTransport.a$cls);
  31506. $core.addMethod(
  31507. $core.method({
  31508. selector: "type",
  31509. protocol: "accessing",
  31510. fn: function (){
  31511. var self=this,$self=this;
  31512. return "amd";
  31513. },
  31514. args: [],
  31515. source: "type\x0a\x09^ 'amd'",
  31516. referencedClasses: [],
  31517. messageSends: []
  31518. }),
  31519. $globals.AmdPackageTransport.a$cls);
  31520. $core.addMethod(
  31521. $core.method({
  31522. selector: "exportBehaviorDefinitionTo:using:",
  31523. protocol: "*Platform-ImportExport",
  31524. fn: function (aStream,anExporter){
  31525. var self=this,$self=this;
  31526. return $core.withContext(function($ctx1) {
  31527. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  31528. return self;
  31529. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  31530. },
  31531. args: ["aStream", "anExporter"],
  31532. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  31533. referencedClasses: [],
  31534. messageSends: ["exportDefinitionOf:on:"]
  31535. }),
  31536. $globals.Class);
  31537. $core.addMethod(
  31538. $core.method({
  31539. selector: "exportBehaviorDefinitionTo:using:",
  31540. protocol: "*Platform-ImportExport",
  31541. fn: function (aStream,anExporter){
  31542. var self=this,$self=this;
  31543. return $core.withContext(function($ctx1) {
  31544. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  31545. return self;
  31546. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  31547. },
  31548. args: ["aStream", "anExporter"],
  31549. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  31550. referencedClasses: [],
  31551. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  31552. }),
  31553. $globals.Metaclass);
  31554. $core.addMethod(
  31555. $core.method({
  31556. selector: "commit",
  31557. protocol: "*Platform-ImportExport",
  31558. fn: function (){
  31559. var self=this,$self=this;
  31560. return $core.withContext(function($ctx1) {
  31561. return $recv($self._transport())._commit();
  31562. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  31563. },
  31564. args: [],
  31565. source: "commit\x0a\x09^ self transport commit",
  31566. referencedClasses: [],
  31567. messageSends: ["commit", "transport"]
  31568. }),
  31569. $globals.Package);
  31570. $core.addMethod(
  31571. $core.method({
  31572. selector: "load",
  31573. protocol: "*Platform-ImportExport",
  31574. fn: function (){
  31575. var self=this,$self=this;
  31576. return $core.withContext(function($ctx1) {
  31577. return $recv($self._transport())._load();
  31578. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  31579. },
  31580. args: [],
  31581. source: "load\x0a\x09^ self transport load",
  31582. referencedClasses: [],
  31583. messageSends: ["load", "transport"]
  31584. }),
  31585. $globals.Package);
  31586. $core.addMethod(
  31587. $core.method({
  31588. selector: "loadFromNamespace:",
  31589. protocol: "*Platform-ImportExport",
  31590. fn: function (aString){
  31591. var self=this,$self=this;
  31592. return $core.withContext(function($ctx1) {
  31593. var $1;
  31594. $1=$self._transport();
  31595. $recv($1)._namespace_(aString);
  31596. return $recv($1)._load();
  31597. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  31598. },
  31599. args: ["aString"],
  31600. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  31601. referencedClasses: [],
  31602. messageSends: ["namespace:", "transport", "load"]
  31603. }),
  31604. $globals.Package);
  31605. $core.addMethod(
  31606. $core.method({
  31607. selector: "load:",
  31608. protocol: "*Platform-ImportExport",
  31609. fn: function (aPackageName){
  31610. var self=this,$self=this;
  31611. return $core.withContext(function($ctx1) {
  31612. $recv($self._named_(aPackageName))._load();
  31613. return self;
  31614. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  31615. },
  31616. args: ["aPackageName"],
  31617. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  31618. referencedClasses: [],
  31619. messageSends: ["load", "named:"]
  31620. }),
  31621. $globals.Package.a$cls);
  31622. $core.addMethod(
  31623. $core.method({
  31624. selector: "load:fromNamespace:",
  31625. protocol: "*Platform-ImportExport",
  31626. fn: function (aPackageName,aString){
  31627. var self=this,$self=this;
  31628. return $core.withContext(function($ctx1) {
  31629. $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  31630. return self;
  31631. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  31632. },
  31633. args: ["aPackageName", "aString"],
  31634. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  31635. referencedClasses: [],
  31636. messageSends: ["loadFromNamespace:", "named:"]
  31637. }),
  31638. $globals.Package.a$cls);
  31639. $core.addMethod(
  31640. $core.method({
  31641. selector: "methodsFor:",
  31642. protocol: "*Platform-ImportExport",
  31643. fn: function (aString){
  31644. var self=this,$self=this;
  31645. return $core.withContext(function($ctx1) {
  31646. var $1;
  31647. $1=$recv($globals.ClassProtocolReader)._new();
  31648. $recv($1)._class_category_(self,aString);
  31649. return $recv($1)._yourself();
  31650. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  31651. },
  31652. args: ["aString"],
  31653. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  31654. referencedClasses: ["ClassProtocolReader"],
  31655. messageSends: ["class:category:", "new", "yourself"]
  31656. }),
  31657. $globals.TBehaviorProvider);
  31658. $core.addMethod(
  31659. $core.method({
  31660. selector: "methodsFor:stamp:",
  31661. protocol: "*Platform-ImportExport",
  31662. fn: function (aString,aStamp){
  31663. var self=this,$self=this;
  31664. return $core.withContext(function($ctx1) {
  31665. return $self._methodsFor_(aString);
  31666. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  31667. },
  31668. args: ["aString", "aStamp"],
  31669. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  31670. referencedClasses: [],
  31671. messageSends: ["methodsFor:"]
  31672. }),
  31673. $globals.TBehaviorProvider);
  31674. $core.addMethod(
  31675. $core.method({
  31676. selector: "commentStamp",
  31677. protocol: "*Platform-ImportExport",
  31678. fn: function (){
  31679. var self=this,$self=this;
  31680. return $core.withContext(function($ctx1) {
  31681. var $1;
  31682. $1=$recv($globals.ClassCommentReader)._new();
  31683. $recv($1)._class_(self);
  31684. return $recv($1)._yourself();
  31685. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  31686. },
  31687. args: [],
  31688. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  31689. referencedClasses: ["ClassCommentReader"],
  31690. messageSends: ["class:", "new", "yourself"]
  31691. }),
  31692. $globals.TMasterBehavior);
  31693. $core.addMethod(
  31694. $core.method({
  31695. selector: "commentStamp:prior:",
  31696. protocol: "*Platform-ImportExport",
  31697. fn: function (aStamp,prior){
  31698. var self=this,$self=this;
  31699. return $core.withContext(function($ctx1) {
  31700. return $self._commentStamp();
  31701. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  31702. },
  31703. args: ["aStamp", "prior"],
  31704. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  31705. referencedClasses: [],
  31706. messageSends: ["commentStamp"]
  31707. }),
  31708. $globals.TMasterBehavior);
  31709. $core.addMethod(
  31710. $core.method({
  31711. selector: "exportBehaviorDefinitionTo:using:",
  31712. protocol: "*Platform-ImportExport",
  31713. fn: function (aStream,anExporter){
  31714. var self=this,$self=this;
  31715. return $core.withContext(function($ctx1) {
  31716. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  31717. return self;
  31718. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  31719. },
  31720. args: ["aStream", "anExporter"],
  31721. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  31722. referencedClasses: [],
  31723. messageSends: ["exportTraitDefinitionOf:on:"]
  31724. }),
  31725. $globals.Trait);
  31726. });
  31727. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  31728. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  31729. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  31730. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  31731. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  31732. $core.addPackage("Compiler-Core");
  31733. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  31734. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  31735. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  31736. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  31737. $core.addMethod(
  31738. $core.method({
  31739. selector: "compileNode:",
  31740. protocol: "compiling",
  31741. fn: function (aNode){
  31742. var self=this,$self=this;
  31743. return $core.withContext(function($ctx1) {
  31744. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  31745. return $core.withContext(function($ctx2) {
  31746. return $recv(transformer)._value_(input);
  31747. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  31748. }));
  31749. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  31750. },
  31751. args: ["aNode"],
  31752. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  31753. referencedClasses: [],
  31754. messageSends: ["inject:into:", "transformers", "value:"]
  31755. }),
  31756. $globals.AbstractCodeGenerator);
  31757. $core.addMethod(
  31758. $core.method({
  31759. selector: "currentClass",
  31760. protocol: "accessing",
  31761. fn: function (){
  31762. var self=this,$self=this;
  31763. return $self["@currentClass"];
  31764. },
  31765. args: [],
  31766. source: "currentClass\x0a\x09^ currentClass",
  31767. referencedClasses: [],
  31768. messageSends: []
  31769. }),
  31770. $globals.AbstractCodeGenerator);
  31771. $core.addMethod(
  31772. $core.method({
  31773. selector: "currentClass:",
  31774. protocol: "accessing",
  31775. fn: function (aClass){
  31776. var self=this,$self=this;
  31777. $self["@currentClass"]=aClass;
  31778. return self;
  31779. },
  31780. args: ["aClass"],
  31781. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  31782. referencedClasses: [],
  31783. messageSends: []
  31784. }),
  31785. $globals.AbstractCodeGenerator);
  31786. $core.addMethod(
  31787. $core.method({
  31788. selector: "currentPackage",
  31789. protocol: "accessing",
  31790. fn: function (){
  31791. var self=this,$self=this;
  31792. return $self["@currentPackage"];
  31793. },
  31794. args: [],
  31795. source: "currentPackage\x0a\x09^ currentPackage",
  31796. referencedClasses: [],
  31797. messageSends: []
  31798. }),
  31799. $globals.AbstractCodeGenerator);
  31800. $core.addMethod(
  31801. $core.method({
  31802. selector: "currentPackage:",
  31803. protocol: "accessing",
  31804. fn: function (anObject){
  31805. var self=this,$self=this;
  31806. $self["@currentPackage"]=anObject;
  31807. return self;
  31808. },
  31809. args: ["anObject"],
  31810. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  31811. referencedClasses: [],
  31812. messageSends: []
  31813. }),
  31814. $globals.AbstractCodeGenerator);
  31815. $core.addMethod(
  31816. $core.method({
  31817. selector: "pseudoVariables",
  31818. protocol: "accessing",
  31819. fn: function (){
  31820. var self=this,$self=this;
  31821. return $core.withContext(function($ctx1) {
  31822. return $recv($globals.Smalltalk)._pseudoVariableNames();
  31823. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  31824. },
  31825. args: [],
  31826. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  31827. referencedClasses: ["Smalltalk"],
  31828. messageSends: ["pseudoVariableNames"]
  31829. }),
  31830. $globals.AbstractCodeGenerator);
  31831. $core.addMethod(
  31832. $core.method({
  31833. selector: "source",
  31834. protocol: "accessing",
  31835. fn: function (){
  31836. var self=this,$self=this;
  31837. return $core.withContext(function($ctx1) {
  31838. var $1,$receiver;
  31839. $1=$self["@source"];
  31840. if(($receiver = $1) == null || $receiver.a$nil){
  31841. return "";
  31842. } else {
  31843. return $1;
  31844. }
  31845. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  31846. },
  31847. args: [],
  31848. source: "source\x0a\x09^ source ifNil: [ '' ]",
  31849. referencedClasses: [],
  31850. messageSends: ["ifNil:"]
  31851. }),
  31852. $globals.AbstractCodeGenerator);
  31853. $core.addMethod(
  31854. $core.method({
  31855. selector: "source:",
  31856. protocol: "accessing",
  31857. fn: function (aString){
  31858. var self=this,$self=this;
  31859. $self["@source"]=aString;
  31860. return self;
  31861. },
  31862. args: ["aString"],
  31863. source: "source: aString\x0a\x09source := aString",
  31864. referencedClasses: [],
  31865. messageSends: []
  31866. }),
  31867. $globals.AbstractCodeGenerator);
  31868. $core.addMethod(
  31869. $core.method({
  31870. selector: "transformers",
  31871. protocol: "compiling",
  31872. fn: function (){
  31873. var self=this,$self=this;
  31874. var dict;
  31875. return $core.withContext(function($ctx1) {
  31876. dict=$self._transformersDictionary();
  31877. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  31878. return $core.withContext(function($ctx2) {
  31879. return $recv(dict)._at_(each);
  31880. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31881. }));
  31882. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  31883. },
  31884. args: [],
  31885. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  31886. referencedClasses: [],
  31887. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  31888. }),
  31889. $globals.AbstractCodeGenerator);
  31890. $core.addMethod(
  31891. $core.method({
  31892. selector: "transformersDictionary",
  31893. protocol: "compiling",
  31894. fn: function (){
  31895. var self=this,$self=this;
  31896. return $core.withContext(function($ctx1) {
  31897. $self._subclassResponsibility();
  31898. return self;
  31899. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  31900. },
  31901. args: [],
  31902. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  31903. referencedClasses: [],
  31904. messageSends: ["subclassResponsibility"]
  31905. }),
  31906. $globals.AbstractCodeGenerator);
  31907. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  31908. $globals.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.";
  31909. $core.addMethod(
  31910. $core.method({
  31911. selector: "irTranslator",
  31912. protocol: "compiling",
  31913. fn: function (){
  31914. var self=this,$self=this;
  31915. return $core.withContext(function($ctx1) {
  31916. var $1;
  31917. $1=$recv($self._irTranslatorClass())._new();
  31918. $recv($1)._currentClass_($self._currentClass());
  31919. return $recv($1)._yourself();
  31920. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  31921. },
  31922. args: [],
  31923. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  31924. referencedClasses: [],
  31925. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  31926. }),
  31927. $globals.CodeGenerator);
  31928. $core.addMethod(
  31929. $core.method({
  31930. selector: "irTranslatorClass",
  31931. protocol: "compiling",
  31932. fn: function (){
  31933. var self=this,$self=this;
  31934. return $globals.IRJSTranslator;
  31935. },
  31936. args: [],
  31937. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  31938. referencedClasses: ["IRJSTranslator"],
  31939. messageSends: []
  31940. }),
  31941. $globals.CodeGenerator);
  31942. $core.addMethod(
  31943. $core.method({
  31944. selector: "semanticAnalyzer",
  31945. protocol: "compiling",
  31946. fn: function (){
  31947. var self=this,$self=this;
  31948. return $core.withContext(function($ctx1) {
  31949. var $1;
  31950. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  31951. $recv($1)._thePackage_($self._currentPackage());
  31952. return $recv($1)._yourself();
  31953. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  31954. },
  31955. args: [],
  31956. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  31957. referencedClasses: ["SemanticAnalyzer"],
  31958. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  31959. }),
  31960. $globals.CodeGenerator);
  31961. $core.addMethod(
  31962. $core.method({
  31963. selector: "transformersDictionary",
  31964. protocol: "compiling",
  31965. fn: function (){
  31966. var self=this,$self=this;
  31967. return $core.withContext(function($ctx1) {
  31968. var $1,$2,$receiver;
  31969. $1=$self["@transformersDictionary"];
  31970. if(($receiver = $1) == null || $receiver.a$nil){
  31971. $2=$recv($globals.Dictionary)._new();
  31972. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  31973. $ctx1.sendIdx["at:put:"]=1;
  31974. $recv($2)._at_put_("5000-astToIr",$self._translator());
  31975. $ctx1.sendIdx["at:put:"]=2;
  31976. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  31977. $self["@transformersDictionary"]=$recv($2)._yourself();
  31978. return $self["@transformersDictionary"];
  31979. } else {
  31980. return $1;
  31981. }
  31982. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  31983. },
  31984. args: [],
  31985. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  31986. referencedClasses: ["Dictionary"],
  31987. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  31988. }),
  31989. $globals.CodeGenerator);
  31990. $core.addMethod(
  31991. $core.method({
  31992. selector: "translator",
  31993. protocol: "compiling",
  31994. fn: function (){
  31995. var self=this,$self=this;
  31996. return $core.withContext(function($ctx1) {
  31997. var $1;
  31998. $1=$recv($globals.IRASTTranslator)._new();
  31999. $recv($1)._source_($self._source());
  32000. $recv($1)._theClass_($self._currentClass());
  32001. return $recv($1)._yourself();
  32002. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  32003. },
  32004. args: [],
  32005. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  32006. referencedClasses: ["IRASTTranslator"],
  32007. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  32008. }),
  32009. $globals.CodeGenerator);
  32010. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass"], "Compiler-Core");
  32011. $globals.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`";
  32012. $core.addMethod(
  32013. $core.method({
  32014. selector: "codeGeneratorClass",
  32015. protocol: "accessing",
  32016. fn: function (){
  32017. var self=this,$self=this;
  32018. return $core.withContext(function($ctx1) {
  32019. var $1,$receiver;
  32020. $1=$self["@codeGeneratorClass"];
  32021. if(($receiver = $1) == null || $receiver.a$nil){
  32022. return $globals.InliningCodeGenerator;
  32023. } else {
  32024. return $1;
  32025. }
  32026. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  32027. },
  32028. args: [],
  32029. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  32030. referencedClasses: ["InliningCodeGenerator"],
  32031. messageSends: ["ifNil:"]
  32032. }),
  32033. $globals.Compiler);
  32034. $core.addMethod(
  32035. $core.method({
  32036. selector: "codeGeneratorClass:",
  32037. protocol: "accessing",
  32038. fn: function (aClass){
  32039. var self=this,$self=this;
  32040. $self["@codeGeneratorClass"]=aClass;
  32041. return self;
  32042. },
  32043. args: ["aClass"],
  32044. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  32045. referencedClasses: [],
  32046. messageSends: []
  32047. }),
  32048. $globals.Compiler);
  32049. $core.addMethod(
  32050. $core.method({
  32051. selector: "compile:forClass:protocol:",
  32052. protocol: "compiling",
  32053. fn: function (aString,aClass,anotherString){
  32054. var self=this,$self=this;
  32055. return $core.withContext(function($ctx1) {
  32056. $self._source_(aString);
  32057. return $self._compileNode_forClass_package_($self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  32058. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  32059. },
  32060. args: ["aString", "aClass", "anotherString"],
  32061. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)",
  32062. referencedClasses: [],
  32063. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  32064. }),
  32065. $globals.Compiler);
  32066. $core.addMethod(
  32067. $core.method({
  32068. selector: "compileExpression:on:",
  32069. protocol: "compiling",
  32070. fn: function (aString,anObject){
  32071. var self=this,$self=this;
  32072. return $core.withContext(function($ctx1) {
  32073. var $1;
  32074. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  32075. $ctx1.sendIdx[","]=1;
  32076. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  32077. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  32078. },
  32079. args: ["aString", "anObject"],
  32080. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  32081. referencedClasses: [],
  32082. messageSends: ["compile:forClass:protocol:", ",", "class"]
  32083. }),
  32084. $globals.Compiler);
  32085. $core.addMethod(
  32086. $core.method({
  32087. selector: "compileNode:",
  32088. protocol: "compiling",
  32089. fn: function (aNode){
  32090. var self=this,$self=this;
  32091. var generator,result;
  32092. return $core.withContext(function($ctx1) {
  32093. var $1;
  32094. generator=$recv($self._codeGeneratorClass())._new();
  32095. $1=generator;
  32096. $recv($1)._source_($self._source());
  32097. $recv($1)._currentClass_($self._currentClass());
  32098. $recv($1)._currentPackage_($self._currentPackage());
  32099. result=$recv(generator)._compileNode_(aNode);
  32100. return result;
  32101. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  32102. },
  32103. args: ["aNode"],
  32104. 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\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09^ result",
  32105. referencedClasses: [],
  32106. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:"]
  32107. }),
  32108. $globals.Compiler);
  32109. $core.addMethod(
  32110. $core.method({
  32111. selector: "compileNode:forClass:package:",
  32112. protocol: "compiling",
  32113. fn: function (aNode,aClass,aPackage){
  32114. var self=this,$self=this;
  32115. return $core.withContext(function($ctx1) {
  32116. $self._currentClass_(aClass);
  32117. $self._currentPackage_(aPackage);
  32118. return $self._compileNode_(aNode);
  32119. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  32120. },
  32121. args: ["aNode", "aClass", "aPackage"],
  32122. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  32123. referencedClasses: [],
  32124. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  32125. }),
  32126. $globals.Compiler);
  32127. $core.addMethod(
  32128. $core.method({
  32129. selector: "currentClass",
  32130. protocol: "accessing",
  32131. fn: function (){
  32132. var self=this,$self=this;
  32133. return $self["@currentClass"];
  32134. },
  32135. args: [],
  32136. source: "currentClass\x0a\x09^ currentClass",
  32137. referencedClasses: [],
  32138. messageSends: []
  32139. }),
  32140. $globals.Compiler);
  32141. $core.addMethod(
  32142. $core.method({
  32143. selector: "currentClass:",
  32144. protocol: "accessing",
  32145. fn: function (aClass){
  32146. var self=this,$self=this;
  32147. $self["@currentClass"]=aClass;
  32148. return self;
  32149. },
  32150. args: ["aClass"],
  32151. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  32152. referencedClasses: [],
  32153. messageSends: []
  32154. }),
  32155. $globals.Compiler);
  32156. $core.addMethod(
  32157. $core.method({
  32158. selector: "currentPackage",
  32159. protocol: "accessing",
  32160. fn: function (){
  32161. var self=this,$self=this;
  32162. return $self["@currentPackage"];
  32163. },
  32164. args: [],
  32165. source: "currentPackage\x0a\x09^ currentPackage",
  32166. referencedClasses: [],
  32167. messageSends: []
  32168. }),
  32169. $globals.Compiler);
  32170. $core.addMethod(
  32171. $core.method({
  32172. selector: "currentPackage:",
  32173. protocol: "accessing",
  32174. fn: function (anObject){
  32175. var self=this,$self=this;
  32176. $self["@currentPackage"]=anObject;
  32177. return self;
  32178. },
  32179. args: ["anObject"],
  32180. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  32181. referencedClasses: [],
  32182. messageSends: []
  32183. }),
  32184. $globals.Compiler);
  32185. $core.addMethod(
  32186. $core.method({
  32187. selector: "eval:",
  32188. protocol: "compiling",
  32189. fn: function (aString){
  32190. var self=this,$self=this;
  32191. return $core.withContext(function($ctx1) {
  32192. return eval(aString);
  32193. return self;
  32194. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  32195. },
  32196. args: ["aString"],
  32197. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  32198. referencedClasses: [],
  32199. messageSends: []
  32200. }),
  32201. $globals.Compiler);
  32202. $core.addMethod(
  32203. $core.method({
  32204. selector: "eval:forPackage:",
  32205. protocol: "compiling",
  32206. fn: function (aString,aPackage){
  32207. var self=this,$self=this;
  32208. return $core.withContext(function($ctx1) {
  32209. return aPackage && aPackage.innerEval
  32210. ? aPackage.innerEval(aString)
  32211. : eval(aString);
  32212. return self;
  32213. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  32214. },
  32215. args: ["aString", "aPackage"],
  32216. source: "eval: aString forPackage: aPackage\x0a\x09<inlineJS: 'return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)'>",
  32217. referencedClasses: [],
  32218. messageSends: []
  32219. }),
  32220. $globals.Compiler);
  32221. $core.addMethod(
  32222. $core.method({
  32223. selector: "evaluateExpression:",
  32224. protocol: "compiling",
  32225. fn: function (aString){
  32226. var self=this,$self=this;
  32227. return $core.withContext(function($ctx1) {
  32228. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  32229. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  32230. },
  32231. args: ["aString"],
  32232. 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",
  32233. referencedClasses: ["DoIt"],
  32234. messageSends: ["evaluateExpression:on:", "new"]
  32235. }),
  32236. $globals.Compiler);
  32237. $core.addMethod(
  32238. $core.method({
  32239. selector: "evaluateExpression:on:",
  32240. protocol: "compiling",
  32241. fn: function (aString,anObject){
  32242. var self=this,$self=this;
  32243. var result,method;
  32244. return $core.withContext(function($ctx1) {
  32245. var $1;
  32246. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  32247. $recv(method)._protocol_("**xxxDoIt");
  32248. $1=$recv(anObject)._class();
  32249. $ctx1.sendIdx["class"]=1;
  32250. $recv($1)._addCompiledMethod_(method);
  32251. result=$recv(anObject)._xxxDoIt();
  32252. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  32253. return result;
  32254. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  32255. },
  32256. args: ["aString", "anObject"],
  32257. 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 protocol: '**xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  32258. referencedClasses: [],
  32259. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  32260. }),
  32261. $globals.Compiler);
  32262. $core.addMethod(
  32263. $core.method({
  32264. selector: "install:forClass:protocol:",
  32265. protocol: "compiling",
  32266. fn: function (aString,aBehavior,anotherString){
  32267. var self=this,$self=this;
  32268. var compiledMethod;
  32269. return $core.withContext(function($ctx1) {
  32270. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  32271. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  32272. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  32273. },
  32274. args: ["aString", "aBehavior", "anotherString"],
  32275. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09| compiledMethod |\x0a\x09compiledMethod := self\x0a\x09\x09eval: (self compile: aString forClass: aBehavior protocol: anotherString)\x0a\x09\x09forPackage: (aBehavior packageOfProtocol: anotherString).\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: compiledMethod\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString",
  32276. referencedClasses: ["ClassBuilder"],
  32277. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  32278. }),
  32279. $globals.Compiler);
  32280. $core.addMethod(
  32281. $core.method({
  32282. selector: "parse:",
  32283. protocol: "compiling",
  32284. fn: function (aString){
  32285. var self=this,$self=this;
  32286. return $core.withContext(function($ctx1) {
  32287. return $recv($globals.Smalltalk)._parse_(aString);
  32288. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  32289. },
  32290. args: ["aString"],
  32291. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  32292. referencedClasses: ["Smalltalk"],
  32293. messageSends: ["parse:"]
  32294. }),
  32295. $globals.Compiler);
  32296. $core.addMethod(
  32297. $core.method({
  32298. selector: "parseExpression:",
  32299. protocol: "compiling",
  32300. fn: function (aString){
  32301. var self=this,$self=this;
  32302. return $core.withContext(function($ctx1) {
  32303. var $1;
  32304. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  32305. $ctx1.sendIdx[","]=1;
  32306. return $self._parse_($1);
  32307. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  32308. },
  32309. args: ["aString"],
  32310. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  32311. referencedClasses: [],
  32312. messageSends: ["parse:", ","]
  32313. }),
  32314. $globals.Compiler);
  32315. $core.addMethod(
  32316. $core.method({
  32317. selector: "recompile:",
  32318. protocol: "compiling",
  32319. fn: function (aClass){
  32320. var self=this,$self=this;
  32321. return $core.withContext(function($ctx1) {
  32322. var $1,$2,$3,$receiver;
  32323. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  32324. return $core.withContext(function($ctx2) {
  32325. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  32326. $ctx2.sendIdx["="]=1;
  32327. if($core.assert($1)){
  32328. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  32329. }
  32330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32331. }),"Recompiling ".__comma($recv(aClass)._name()));
  32332. $2=$recv(aClass)._theMetaClass();
  32333. if(($receiver = $2) == null || $receiver.a$nil){
  32334. $2;
  32335. } else {
  32336. var meta;
  32337. meta=$receiver;
  32338. $3=$recv(meta).__eq(aClass);
  32339. if(!$core.assert($3)){
  32340. $self._recompile_(meta);
  32341. }
  32342. }
  32343. return self;
  32344. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  32345. },
  32346. args: ["aClass"],
  32347. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | each methodClass = aClass ifTrue: [ \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ] ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass theMetaClass ifNotNil: [ :meta |\x0a\x09\x09meta = aClass ifFalse: [ self recompile: meta ] ]",
  32348. referencedClasses: [],
  32349. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  32350. }),
  32351. $globals.Compiler);
  32352. $core.addMethod(
  32353. $core.method({
  32354. selector: "recompileAll",
  32355. protocol: "compiling",
  32356. fn: function (){
  32357. var self=this,$self=this;
  32358. return $core.withContext(function($ctx1) {
  32359. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  32360. return $core.withContext(function($ctx2) {
  32361. return $self._recompile_(each);
  32362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32363. }),"Compiling all classes...");
  32364. return self;
  32365. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  32366. },
  32367. args: [],
  32368. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  32369. referencedClasses: ["Smalltalk"],
  32370. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  32371. }),
  32372. $globals.Compiler);
  32373. $core.addMethod(
  32374. $core.method({
  32375. selector: "source",
  32376. protocol: "accessing",
  32377. fn: function (){
  32378. var self=this,$self=this;
  32379. return $core.withContext(function($ctx1) {
  32380. var $1,$receiver;
  32381. $1=$self["@source"];
  32382. if(($receiver = $1) == null || $receiver.a$nil){
  32383. return "";
  32384. } else {
  32385. return $1;
  32386. }
  32387. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  32388. },
  32389. args: [],
  32390. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32391. referencedClasses: [],
  32392. messageSends: ["ifNil:"]
  32393. }),
  32394. $globals.Compiler);
  32395. $core.addMethod(
  32396. $core.method({
  32397. selector: "source:",
  32398. protocol: "accessing",
  32399. fn: function (aString){
  32400. var self=this,$self=this;
  32401. $self["@source"]=aString;
  32402. return self;
  32403. },
  32404. args: ["aString"],
  32405. source: "source: aString\x0a\x09source := aString",
  32406. referencedClasses: [],
  32407. messageSends: []
  32408. }),
  32409. $globals.Compiler);
  32410. $core.addMethod(
  32411. $core.method({
  32412. selector: "recompile:",
  32413. protocol: "compiling",
  32414. fn: function (aClass){
  32415. var self=this,$self=this;
  32416. return $core.withContext(function($ctx1) {
  32417. $recv($self._new())._recompile_(aClass);
  32418. return self;
  32419. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  32420. },
  32421. args: ["aClass"],
  32422. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  32423. referencedClasses: [],
  32424. messageSends: ["recompile:", "new"]
  32425. }),
  32426. $globals.Compiler.a$cls);
  32427. $core.addMethod(
  32428. $core.method({
  32429. selector: "recompileAll",
  32430. protocol: "compiling",
  32431. fn: function (){
  32432. var self=this,$self=this;
  32433. return $core.withContext(function($ctx1) {
  32434. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  32435. return $core.withContext(function($ctx2) {
  32436. return $self._recompile_(each);
  32437. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32438. }));
  32439. return self;
  32440. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  32441. },
  32442. args: [],
  32443. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  32444. referencedClasses: ["Smalltalk"],
  32445. messageSends: ["do:", "classes", "recompile:"]
  32446. }),
  32447. $globals.Compiler.a$cls);
  32448. $core.addClass("CompilerError", $globals.Error, [], "Compiler-Core");
  32449. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  32450. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  32451. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  32452. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  32453. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  32454. $core.addMethod(
  32455. $core.method({
  32456. selector: "evaluate:context:",
  32457. protocol: "evaluating",
  32458. fn: function (aString,aContext){
  32459. var self=this,$self=this;
  32460. var compiler,ast;
  32461. return $core.withContext(function($ctx1) {
  32462. var $1;
  32463. var $early={};
  32464. try {
  32465. compiler=$recv($globals.Compiler)._new();
  32466. $recv((function(){
  32467. return $core.withContext(function($ctx2) {
  32468. ast=$recv(compiler)._parseExpression_(aString);
  32469. return ast;
  32470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32471. }))._on_do_($globals.Error,(function(ex){
  32472. return $core.withContext(function($ctx2) {
  32473. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  32474. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  32475. }));
  32476. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  32477. $recv($1)._context_(aContext);
  32478. $recv($1)._visit_(ast);
  32479. return $recv(aContext)._evaluateNode_(ast);
  32480. }
  32481. catch(e) {if(e===$early)return e[0]; throw e}
  32482. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  32483. },
  32484. args: ["aString", "aContext"],
  32485. source: "evaluate: aString context: aContext\x0a\x09\x22Similar to #evaluate:for:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `aContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ Terminal alert: ex messageText ].\x0a\x09\x09\x0a\x09(AISemanticAnalyzer on: aContext receiver class)\x0a\x09\x09context: aContext;\x0a\x09\x09visit: ast.\x0a\x0a\x09^ aContext evaluateNode: ast",
  32486. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  32487. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  32488. }),
  32489. $globals.Evaluator);
  32490. $core.addMethod(
  32491. $core.method({
  32492. selector: "evaluate:for:",
  32493. protocol: "evaluating",
  32494. fn: function (aString,anObject){
  32495. var self=this,$self=this;
  32496. return $core.withContext(function($ctx1) {
  32497. return $recv(anObject)._evaluate_on_(aString,self);
  32498. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  32499. },
  32500. args: ["aString", "anObject"],
  32501. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  32502. referencedClasses: [],
  32503. messageSends: ["evaluate:on:"]
  32504. }),
  32505. $globals.Evaluator);
  32506. $core.addMethod(
  32507. $core.method({
  32508. selector: "evaluate:receiver:",
  32509. protocol: "evaluating",
  32510. fn: function (aString,anObject){
  32511. var self=this,$self=this;
  32512. var compiler;
  32513. return $core.withContext(function($ctx1) {
  32514. var $early={};
  32515. try {
  32516. compiler=$recv($globals.Compiler)._new();
  32517. $recv((function(){
  32518. return $core.withContext(function($ctx2) {
  32519. return $recv(compiler)._parseExpression_(aString);
  32520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32521. }))._on_do_($globals.Error,(function(ex){
  32522. return $core.withContext(function($ctx2) {
  32523. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  32524. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  32525. }));
  32526. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  32527. }
  32528. catch(e) {if(e===$early)return e[0]; throw e}
  32529. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  32530. },
  32531. args: ["aString", "anObject"],
  32532. source: "evaluate: aString receiver: anObject\x0a\x09| compiler |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ Terminal alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject",
  32533. referencedClasses: ["Compiler", "Error", "Terminal"],
  32534. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  32535. }),
  32536. $globals.Evaluator);
  32537. $core.addMethod(
  32538. $core.method({
  32539. selector: "evaluate:for:",
  32540. protocol: "instance creation",
  32541. fn: function (aString,anObject){
  32542. var self=this,$self=this;
  32543. return $core.withContext(function($ctx1) {
  32544. return $recv($self._new())._evaluate_for_(aString,anObject);
  32545. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  32546. },
  32547. args: ["aString", "anObject"],
  32548. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  32549. referencedClasses: [],
  32550. messageSends: ["evaluate:for:", "new"]
  32551. }),
  32552. $globals.Evaluator.a$cls);
  32553. $core.addMethod(
  32554. $core.method({
  32555. selector: "asVariableName",
  32556. protocol: "*Compiler-Core",
  32557. fn: function (){
  32558. var self=this,$self=this;
  32559. return $core.withContext(function($ctx1) {
  32560. var $1;
  32561. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  32562. if($core.assert($1)){
  32563. return $self.__comma("_");
  32564. } else {
  32565. return self;
  32566. }
  32567. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  32568. },
  32569. args: [],
  32570. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  32571. referencedClasses: ["Smalltalk"],
  32572. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  32573. }),
  32574. $globals.String);
  32575. });
  32576. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods"], function($boot){"use strict";
  32577. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  32578. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  32579. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  32580. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  32581. $core.addPackage("Compiler-AST");
  32582. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  32583. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  32584. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  32585. $globals.ASTNode.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.";
  32586. $core.addMethod(
  32587. $core.method({
  32588. selector: "inPosition:",
  32589. protocol: "testing",
  32590. fn: function (aPoint){
  32591. var self=this,$self=this;
  32592. return $core.withContext(function($ctx1) {
  32593. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  32594. return $core.withContext(function($ctx2) {
  32595. return $recv($self._positionEnd()).__gt_eq(aPoint);
  32596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32597. }));
  32598. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  32599. },
  32600. args: ["aPoint"],
  32601. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  32602. referencedClasses: [],
  32603. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  32604. }),
  32605. $globals.ASTNode);
  32606. $core.addMethod(
  32607. $core.method({
  32608. selector: "isAssignmentNode",
  32609. protocol: "testing",
  32610. fn: function (){
  32611. var self=this,$self=this;
  32612. return false;
  32613. },
  32614. args: [],
  32615. source: "isAssignmentNode\x0a\x09^ false",
  32616. referencedClasses: [],
  32617. messageSends: []
  32618. }),
  32619. $globals.ASTNode);
  32620. $core.addMethod(
  32621. $core.method({
  32622. selector: "isBlockNode",
  32623. protocol: "testing",
  32624. fn: function (){
  32625. var self=this,$self=this;
  32626. return false;
  32627. },
  32628. args: [],
  32629. source: "isBlockNode\x0a\x09^ false",
  32630. referencedClasses: [],
  32631. messageSends: []
  32632. }),
  32633. $globals.ASTNode);
  32634. $core.addMethod(
  32635. $core.method({
  32636. selector: "isBlockSequenceNode",
  32637. protocol: "testing",
  32638. fn: function (){
  32639. var self=this,$self=this;
  32640. return false;
  32641. },
  32642. args: [],
  32643. source: "isBlockSequenceNode\x0a\x09^ false",
  32644. referencedClasses: [],
  32645. messageSends: []
  32646. }),
  32647. $globals.ASTNode);
  32648. $core.addMethod(
  32649. $core.method({
  32650. selector: "isCascadeNode",
  32651. protocol: "testing",
  32652. fn: function (){
  32653. var self=this,$self=this;
  32654. return false;
  32655. },
  32656. args: [],
  32657. source: "isCascadeNode\x0a\x09^ false",
  32658. referencedClasses: [],
  32659. messageSends: []
  32660. }),
  32661. $globals.ASTNode);
  32662. $core.addMethod(
  32663. $core.method({
  32664. selector: "isImmutable",
  32665. protocol: "testing",
  32666. fn: function (){
  32667. var self=this,$self=this;
  32668. return false;
  32669. },
  32670. args: [],
  32671. source: "isImmutable\x0a\x09^ false",
  32672. referencedClasses: [],
  32673. messageSends: []
  32674. }),
  32675. $globals.ASTNode);
  32676. $core.addMethod(
  32677. $core.method({
  32678. selector: "isJSStatementNode",
  32679. protocol: "testing",
  32680. fn: function (){
  32681. var self=this,$self=this;
  32682. return false;
  32683. },
  32684. args: [],
  32685. source: "isJSStatementNode\x0a\x09^ false",
  32686. referencedClasses: [],
  32687. messageSends: []
  32688. }),
  32689. $globals.ASTNode);
  32690. $core.addMethod(
  32691. $core.method({
  32692. selector: "isNavigationNode",
  32693. protocol: "testing",
  32694. fn: function (){
  32695. var self=this,$self=this;
  32696. return false;
  32697. },
  32698. args: [],
  32699. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  32700. referencedClasses: [],
  32701. messageSends: []
  32702. }),
  32703. $globals.ASTNode);
  32704. $core.addMethod(
  32705. $core.method({
  32706. selector: "isReturnNode",
  32707. protocol: "testing",
  32708. fn: function (){
  32709. var self=this,$self=this;
  32710. return false;
  32711. },
  32712. args: [],
  32713. source: "isReturnNode\x0a\x09^ false",
  32714. referencedClasses: [],
  32715. messageSends: []
  32716. }),
  32717. $globals.ASTNode);
  32718. $core.addMethod(
  32719. $core.method({
  32720. selector: "isSendNode",
  32721. protocol: "testing",
  32722. fn: function (){
  32723. var self=this,$self=this;
  32724. return false;
  32725. },
  32726. args: [],
  32727. source: "isSendNode\x0a\x09^ false",
  32728. referencedClasses: [],
  32729. messageSends: []
  32730. }),
  32731. $globals.ASTNode);
  32732. $core.addMethod(
  32733. $core.method({
  32734. selector: "isSequenceNode",
  32735. protocol: "testing",
  32736. fn: function (){
  32737. var self=this,$self=this;
  32738. return false;
  32739. },
  32740. args: [],
  32741. source: "isSequenceNode\x0a\x09^ false",
  32742. referencedClasses: [],
  32743. messageSends: []
  32744. }),
  32745. $globals.ASTNode);
  32746. $core.addMethod(
  32747. $core.method({
  32748. selector: "isSuperKeyword",
  32749. protocol: "testing",
  32750. fn: function (){
  32751. var self=this,$self=this;
  32752. return false;
  32753. },
  32754. args: [],
  32755. source: "isSuperKeyword\x0a\x09^ false",
  32756. referencedClasses: [],
  32757. messageSends: []
  32758. }),
  32759. $globals.ASTNode);
  32760. $core.addMethod(
  32761. $core.method({
  32762. selector: "isValueNode",
  32763. protocol: "testing",
  32764. fn: function (){
  32765. var self=this,$self=this;
  32766. return false;
  32767. },
  32768. args: [],
  32769. source: "isValueNode\x0a\x09^ false",
  32770. referencedClasses: [],
  32771. messageSends: []
  32772. }),
  32773. $globals.ASTNode);
  32774. $core.addMethod(
  32775. $core.method({
  32776. selector: "isVariableNode",
  32777. protocol: "testing",
  32778. fn: function (){
  32779. var self=this,$self=this;
  32780. return false;
  32781. },
  32782. args: [],
  32783. source: "isVariableNode\x0a\x09^ false",
  32784. referencedClasses: [],
  32785. messageSends: []
  32786. }),
  32787. $globals.ASTNode);
  32788. $core.addMethod(
  32789. $core.method({
  32790. selector: "location:",
  32791. protocol: "accessing",
  32792. fn: function (aLocation){
  32793. var self=this,$self=this;
  32794. return $core.withContext(function($ctx1) {
  32795. var $3,$2,$1;
  32796. $3=$recv(aLocation)._start();
  32797. $ctx1.sendIdx["start"]=1;
  32798. $2=$recv($3)._line();
  32799. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  32800. $self._position_($1);
  32801. return self;
  32802. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  32803. },
  32804. args: ["aLocation"],
  32805. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  32806. referencedClasses: [],
  32807. messageSends: ["position:", "@", "line", "start", "column"]
  32808. }),
  32809. $globals.ASTNode);
  32810. $core.addMethod(
  32811. $core.method({
  32812. selector: "method",
  32813. protocol: "accessing",
  32814. fn: function (){
  32815. var self=this,$self=this;
  32816. return $core.withContext(function($ctx1) {
  32817. var $1,$receiver;
  32818. $1=$self._parent();
  32819. if(($receiver = $1) == null || $receiver.a$nil){
  32820. return $1;
  32821. } else {
  32822. var node;
  32823. node=$receiver;
  32824. return $recv(node)._method();
  32825. }
  32826. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  32827. },
  32828. args: [],
  32829. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  32830. referencedClasses: [],
  32831. messageSends: ["ifNotNil:", "parent", "method"]
  32832. }),
  32833. $globals.ASTNode);
  32834. $core.addMethod(
  32835. $core.method({
  32836. selector: "navigationNodeAt:ifAbsent:",
  32837. protocol: "accessing",
  32838. fn: function (aPoint,aBlock){
  32839. var self=this,$self=this;
  32840. var children;
  32841. return $core.withContext(function($ctx1) {
  32842. var $2,$1;
  32843. var $early={};
  32844. try {
  32845. children=$recv($self._allDagChildren())._select_((function(each){
  32846. return $core.withContext(function($ctx2) {
  32847. return $recv($recv(each)._isNavigationNode())._and_((function(){
  32848. return $core.withContext(function($ctx3) {
  32849. return $recv(each)._inPosition_(aPoint);
  32850. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32851. }));
  32852. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32853. }));
  32854. $recv(children)._ifEmpty_((function(){
  32855. return $core.withContext(function($ctx2) {
  32856. throw $early=[$recv(aBlock)._value()];
  32857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  32858. }));
  32859. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  32860. return $core.withContext(function($ctx2) {
  32861. $2=$recv(a)._positionStart();
  32862. $ctx2.sendIdx["positionStart"]=1;
  32863. $1=$recv($2)._dist_(aPoint);
  32864. $ctx2.sendIdx["dist:"]=1;
  32865. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  32866. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  32867. })))._first();
  32868. }
  32869. catch(e) {if(e===$early)return e[0]; throw e}
  32870. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  32871. },
  32872. args: ["aPoint", "aBlock"],
  32873. source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allDagChildren select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first",
  32874. referencedClasses: [],
  32875. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  32876. }),
  32877. $globals.ASTNode);
  32878. $core.addMethod(
  32879. $core.method({
  32880. selector: "parent",
  32881. protocol: "accessing",
  32882. fn: function (){
  32883. var self=this,$self=this;
  32884. return $self["@parent"];
  32885. },
  32886. args: [],
  32887. source: "parent\x0a\x09^ parent",
  32888. referencedClasses: [],
  32889. messageSends: []
  32890. }),
  32891. $globals.ASTNode);
  32892. $core.addMethod(
  32893. $core.method({
  32894. selector: "parent:",
  32895. protocol: "accessing",
  32896. fn: function (aNode){
  32897. var self=this,$self=this;
  32898. $self["@parent"]=aNode;
  32899. return self;
  32900. },
  32901. args: ["aNode"],
  32902. source: "parent: aNode\x0a\x09parent := aNode",
  32903. referencedClasses: [],
  32904. messageSends: []
  32905. }),
  32906. $globals.ASTNode);
  32907. $core.addMethod(
  32908. $core.method({
  32909. selector: "position",
  32910. protocol: "accessing",
  32911. fn: function (){
  32912. var self=this,$self=this;
  32913. return $core.withContext(function($ctx1) {
  32914. var $1,$2,$receiver;
  32915. $1=$self["@position"];
  32916. if(($receiver = $1) == null || $receiver.a$nil){
  32917. $2=$self._parent();
  32918. if(($receiver = $2) == null || $receiver.a$nil){
  32919. return $2;
  32920. } else {
  32921. var node;
  32922. node=$receiver;
  32923. return $recv(node)._position();
  32924. }
  32925. } else {
  32926. return $1;
  32927. }
  32928. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  32929. },
  32930. args: [],
  32931. 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 ] ]",
  32932. referencedClasses: [],
  32933. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  32934. }),
  32935. $globals.ASTNode);
  32936. $core.addMethod(
  32937. $core.method({
  32938. selector: "position:",
  32939. protocol: "accessing",
  32940. fn: function (aPosition){
  32941. var self=this,$self=this;
  32942. $self["@position"]=aPosition;
  32943. return self;
  32944. },
  32945. args: ["aPosition"],
  32946. source: "position: aPosition\x0a\x09position := aPosition",
  32947. referencedClasses: [],
  32948. messageSends: []
  32949. }),
  32950. $globals.ASTNode);
  32951. $core.addMethod(
  32952. $core.method({
  32953. selector: "positionEnd",
  32954. protocol: "accessing",
  32955. fn: function (){
  32956. var self=this,$self=this;
  32957. return $core.withContext(function($ctx1) {
  32958. var $1,$6,$5,$4,$3,$2;
  32959. $1=$self._positionStart();
  32960. $6=$self._source();
  32961. $ctx1.sendIdx["source"]=1;
  32962. $5=$recv($6)._lines();
  32963. $ctx1.sendIdx["lines"]=1;
  32964. $4=$recv($5)._size();
  32965. $ctx1.sendIdx["size"]=1;
  32966. $3=$recv($4).__minus((1));
  32967. $ctx1.sendIdx["-"]=1;
  32968. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  32969. return $recv($1).__plus($2);
  32970. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  32971. },
  32972. args: [],
  32973. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  32974. referencedClasses: [],
  32975. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  32976. }),
  32977. $globals.ASTNode);
  32978. $core.addMethod(
  32979. $core.method({
  32980. selector: "positionStart",
  32981. protocol: "accessing",
  32982. fn: function (){
  32983. var self=this,$self=this;
  32984. return $core.withContext(function($ctx1) {
  32985. return $self._position();
  32986. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  32987. },
  32988. args: [],
  32989. source: "positionStart\x0a\x09^ self position",
  32990. referencedClasses: [],
  32991. messageSends: ["position"]
  32992. }),
  32993. $globals.ASTNode);
  32994. $core.addMethod(
  32995. $core.method({
  32996. selector: "requiresSmalltalkContext",
  32997. protocol: "testing",
  32998. fn: function (){
  32999. var self=this,$self=this;
  33000. return $core.withContext(function($ctx1) {
  33001. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  33002. return $core.withContext(function($ctx2) {
  33003. return $recv(each)._requiresSmalltalkContext();
  33004. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33005. }),(function(){
  33006. return nil;
  33007. })))._notNil();
  33008. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33009. },
  33010. args: [],
  33011. source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self dagChildren \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  33012. referencedClasses: [],
  33013. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33014. }),
  33015. $globals.ASTNode);
  33016. $core.addMethod(
  33017. $core.method({
  33018. selector: "shouldBeAliased",
  33019. protocol: "accessing",
  33020. fn: function (){
  33021. var self=this,$self=this;
  33022. return $core.withContext(function($ctx1) {
  33023. var $1,$receiver;
  33024. $1=$self["@shouldBeAliased"];
  33025. if(($receiver = $1) == null || $receiver.a$nil){
  33026. return false;
  33027. } else {
  33028. return $1;
  33029. }
  33030. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33031. },
  33032. args: [],
  33033. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33034. referencedClasses: [],
  33035. messageSends: ["ifNil:"]
  33036. }),
  33037. $globals.ASTNode);
  33038. $core.addMethod(
  33039. $core.method({
  33040. selector: "shouldBeAliased:",
  33041. protocol: "accessing",
  33042. fn: function (aBoolean){
  33043. var self=this,$self=this;
  33044. $self["@shouldBeAliased"]=aBoolean;
  33045. return self;
  33046. },
  33047. args: ["aBoolean"],
  33048. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33049. referencedClasses: [],
  33050. messageSends: []
  33051. }),
  33052. $globals.ASTNode);
  33053. $core.addMethod(
  33054. $core.method({
  33055. selector: "size",
  33056. protocol: "accessing",
  33057. fn: function (){
  33058. var self=this,$self=this;
  33059. return $core.withContext(function($ctx1) {
  33060. return $recv($self._source())._size();
  33061. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33062. },
  33063. args: [],
  33064. source: "size\x0a\x09^ self source size",
  33065. referencedClasses: [],
  33066. messageSends: ["size", "source"]
  33067. }),
  33068. $globals.ASTNode);
  33069. $core.addMethod(
  33070. $core.method({
  33071. selector: "source",
  33072. protocol: "accessing",
  33073. fn: function (){
  33074. var self=this,$self=this;
  33075. return $core.withContext(function($ctx1) {
  33076. var $1,$receiver;
  33077. $1=$self["@source"];
  33078. if(($receiver = $1) == null || $receiver.a$nil){
  33079. return "";
  33080. } else {
  33081. return $1;
  33082. }
  33083. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33084. },
  33085. args: [],
  33086. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33087. referencedClasses: [],
  33088. messageSends: ["ifNil:"]
  33089. }),
  33090. $globals.ASTNode);
  33091. $core.addMethod(
  33092. $core.method({
  33093. selector: "source:",
  33094. protocol: "accessing",
  33095. fn: function (aString){
  33096. var self=this,$self=this;
  33097. $self["@source"]=aString;
  33098. return self;
  33099. },
  33100. args: ["aString"],
  33101. source: "source: aString\x0a\x09source := aString",
  33102. referencedClasses: [],
  33103. messageSends: []
  33104. }),
  33105. $globals.ASTNode);
  33106. $core.addMethod(
  33107. $core.method({
  33108. selector: "withTail:",
  33109. protocol: "building",
  33110. fn: function (aCollection){
  33111. var self=this,$self=this;
  33112. return $core.withContext(function($ctx1) {
  33113. var $1;
  33114. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33115. return $core.withContext(function($ctx2) {
  33116. $1=$recv($globals.SendNode)._new();
  33117. $recv($1)._position_($recv(send)._position());
  33118. $recv($1)._source_($recv(send)._source());
  33119. $recv($1)._receiver_(receiver);
  33120. $recv($1)._selector_($recv(send)._selector());
  33121. $recv($1)._arguments_($recv(send)._arguments());
  33122. return $recv($1)._yourself();
  33123. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33124. }));
  33125. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33126. },
  33127. args: ["aCollection"],
  33128. source: "withTail: aCollection\x0a\x09^ aCollection inject: self into: [\x0a\x09\x09:receiver :send | SendNode new\x0a\x09\x09\x09position: send position;\x0a\x09\x09\x09source: send source;\x0a\x09\x09\x09receiver: receiver;\x0a\x09\x09\x09selector: send selector;\x0a\x09\x09\x09arguments: send arguments;\x0a\x09\x09\x09yourself ]",
  33129. referencedClasses: ["SendNode"],
  33130. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33131. }),
  33132. $globals.ASTNode);
  33133. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33134. $globals.AssignmentNode.comment="I represent an assignment node.";
  33135. $core.addMethod(
  33136. $core.method({
  33137. selector: "acceptDagVisitor:",
  33138. protocol: "visiting",
  33139. fn: function (aVisitor){
  33140. var self=this,$self=this;
  33141. return $core.withContext(function($ctx1) {
  33142. return $recv(aVisitor)._visitAssignmentNode_(self);
  33143. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33144. },
  33145. args: ["aVisitor"],
  33146. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33147. referencedClasses: [],
  33148. messageSends: ["visitAssignmentNode:"]
  33149. }),
  33150. $globals.AssignmentNode);
  33151. $core.addMethod(
  33152. $core.method({
  33153. selector: "dagChildren",
  33154. protocol: "accessing",
  33155. fn: function (){
  33156. var self=this,$self=this;
  33157. return $core.withContext(function($ctx1) {
  33158. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  33159. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  33160. },
  33161. args: [],
  33162. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  33163. referencedClasses: ["Array"],
  33164. messageSends: ["with:with:", "left", "right"]
  33165. }),
  33166. $globals.AssignmentNode);
  33167. $core.addMethod(
  33168. $core.method({
  33169. selector: "isAssignmentNode",
  33170. protocol: "testing",
  33171. fn: function (){
  33172. var self=this,$self=this;
  33173. return true;
  33174. },
  33175. args: [],
  33176. source: "isAssignmentNode\x0a\x09^ true",
  33177. referencedClasses: [],
  33178. messageSends: []
  33179. }),
  33180. $globals.AssignmentNode);
  33181. $core.addMethod(
  33182. $core.method({
  33183. selector: "left",
  33184. protocol: "accessing",
  33185. fn: function (){
  33186. var self=this,$self=this;
  33187. return $self["@left"];
  33188. },
  33189. args: [],
  33190. source: "left\x0a\x09^ left",
  33191. referencedClasses: [],
  33192. messageSends: []
  33193. }),
  33194. $globals.AssignmentNode);
  33195. $core.addMethod(
  33196. $core.method({
  33197. selector: "left:",
  33198. protocol: "accessing",
  33199. fn: function (aNode){
  33200. var self=this,$self=this;
  33201. $self["@left"]=aNode;
  33202. return self;
  33203. },
  33204. args: ["aNode"],
  33205. source: "left: aNode\x0a\x09left := aNode",
  33206. referencedClasses: [],
  33207. messageSends: []
  33208. }),
  33209. $globals.AssignmentNode);
  33210. $core.addMethod(
  33211. $core.method({
  33212. selector: "right",
  33213. protocol: "accessing",
  33214. fn: function (){
  33215. var self=this,$self=this;
  33216. return $self["@right"];
  33217. },
  33218. args: [],
  33219. source: "right\x0a\x09^ right",
  33220. referencedClasses: [],
  33221. messageSends: []
  33222. }),
  33223. $globals.AssignmentNode);
  33224. $core.addMethod(
  33225. $core.method({
  33226. selector: "right:",
  33227. protocol: "accessing",
  33228. fn: function (aNode){
  33229. var self=this,$self=this;
  33230. $self["@right"]=aNode;
  33231. return self;
  33232. },
  33233. args: ["aNode"],
  33234. source: "right: aNode\x0a\x09right := aNode",
  33235. referencedClasses: [],
  33236. messageSends: []
  33237. }),
  33238. $globals.AssignmentNode);
  33239. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  33240. $globals.BlockNode.comment="I represent an block closure node.";
  33241. $core.addMethod(
  33242. $core.method({
  33243. selector: "acceptDagVisitor:",
  33244. protocol: "visiting",
  33245. fn: function (aVisitor){
  33246. var self=this,$self=this;
  33247. return $core.withContext(function($ctx1) {
  33248. return $recv(aVisitor)._visitBlockNode_(self);
  33249. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  33250. },
  33251. args: ["aVisitor"],
  33252. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  33253. referencedClasses: [],
  33254. messageSends: ["visitBlockNode:"]
  33255. }),
  33256. $globals.BlockNode);
  33257. $core.addMethod(
  33258. $core.method({
  33259. selector: "isBlockNode",
  33260. protocol: "testing",
  33261. fn: function (){
  33262. var self=this,$self=this;
  33263. return true;
  33264. },
  33265. args: [],
  33266. source: "isBlockNode\x0a\x09^ true",
  33267. referencedClasses: [],
  33268. messageSends: []
  33269. }),
  33270. $globals.BlockNode);
  33271. $core.addMethod(
  33272. $core.method({
  33273. selector: "parameters",
  33274. protocol: "accessing",
  33275. fn: function (){
  33276. var self=this,$self=this;
  33277. return $core.withContext(function($ctx1) {
  33278. var $1,$receiver;
  33279. $1=$self["@parameters"];
  33280. if(($receiver = $1) == null || $receiver.a$nil){
  33281. $self["@parameters"]=$recv($globals.Array)._new();
  33282. return $self["@parameters"];
  33283. } else {
  33284. return $1;
  33285. }
  33286. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  33287. },
  33288. args: [],
  33289. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  33290. referencedClasses: ["Array"],
  33291. messageSends: ["ifNil:", "new"]
  33292. }),
  33293. $globals.BlockNode);
  33294. $core.addMethod(
  33295. $core.method({
  33296. selector: "parameters:",
  33297. protocol: "accessing",
  33298. fn: function (aCollection){
  33299. var self=this,$self=this;
  33300. $self["@parameters"]=aCollection;
  33301. return self;
  33302. },
  33303. args: ["aCollection"],
  33304. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  33305. referencedClasses: [],
  33306. messageSends: []
  33307. }),
  33308. $globals.BlockNode);
  33309. $core.addMethod(
  33310. $core.method({
  33311. selector: "scope",
  33312. protocol: "accessing",
  33313. fn: function (){
  33314. var self=this,$self=this;
  33315. return $self["@scope"];
  33316. },
  33317. args: [],
  33318. source: "scope\x0a\x09^ scope",
  33319. referencedClasses: [],
  33320. messageSends: []
  33321. }),
  33322. $globals.BlockNode);
  33323. $core.addMethod(
  33324. $core.method({
  33325. selector: "scope:",
  33326. protocol: "accessing",
  33327. fn: function (aLexicalScope){
  33328. var self=this,$self=this;
  33329. $self["@scope"]=aLexicalScope;
  33330. return self;
  33331. },
  33332. args: ["aLexicalScope"],
  33333. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33334. referencedClasses: [],
  33335. messageSends: []
  33336. }),
  33337. $globals.BlockNode);
  33338. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  33339. $globals.CascadeNode.comment="I represent an cascade node.";
  33340. $core.addMethod(
  33341. $core.method({
  33342. selector: "acceptDagVisitor:",
  33343. protocol: "visiting",
  33344. fn: function (aVisitor){
  33345. var self=this,$self=this;
  33346. return $core.withContext(function($ctx1) {
  33347. return $recv(aVisitor)._visitCascadeNode_(self);
  33348. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  33349. },
  33350. args: ["aVisitor"],
  33351. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  33352. referencedClasses: [],
  33353. messageSends: ["visitCascadeNode:"]
  33354. }),
  33355. $globals.CascadeNode);
  33356. $core.addMethod(
  33357. $core.method({
  33358. selector: "isCascadeNode",
  33359. protocol: "testing",
  33360. fn: function (){
  33361. var self=this,$self=this;
  33362. return true;
  33363. },
  33364. args: [],
  33365. source: "isCascadeNode\x0a\x09^ true",
  33366. referencedClasses: [],
  33367. messageSends: []
  33368. }),
  33369. $globals.CascadeNode);
  33370. $core.addMethod(
  33371. $core.method({
  33372. selector: "receiver",
  33373. protocol: "accessing",
  33374. fn: function (){
  33375. var self=this,$self=this;
  33376. return $self["@receiver"];
  33377. },
  33378. args: [],
  33379. source: "receiver\x0a\x09^ receiver",
  33380. referencedClasses: [],
  33381. messageSends: []
  33382. }),
  33383. $globals.CascadeNode);
  33384. $core.addMethod(
  33385. $core.method({
  33386. selector: "receiver:",
  33387. protocol: "accessing",
  33388. fn: function (aNode){
  33389. var self=this,$self=this;
  33390. $self["@receiver"]=aNode;
  33391. return self;
  33392. },
  33393. args: ["aNode"],
  33394. source: "receiver: aNode\x0a\x09receiver := aNode",
  33395. referencedClasses: [],
  33396. messageSends: []
  33397. }),
  33398. $globals.CascadeNode);
  33399. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  33400. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  33401. $core.addMethod(
  33402. $core.method({
  33403. selector: "acceptDagVisitor:",
  33404. protocol: "visiting",
  33405. fn: function (aVisitor){
  33406. var self=this,$self=this;
  33407. return $core.withContext(function($ctx1) {
  33408. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  33409. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  33410. },
  33411. args: ["aVisitor"],
  33412. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  33413. referencedClasses: [],
  33414. messageSends: ["visitDynamicArrayNode:"]
  33415. }),
  33416. $globals.DynamicArrayNode);
  33417. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  33418. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  33419. $core.addMethod(
  33420. $core.method({
  33421. selector: "acceptDagVisitor:",
  33422. protocol: "visiting",
  33423. fn: function (aVisitor){
  33424. var self=this,$self=this;
  33425. return $core.withContext(function($ctx1) {
  33426. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  33427. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  33428. },
  33429. args: ["aVisitor"],
  33430. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  33431. referencedClasses: [],
  33432. messageSends: ["visitDynamicDictionaryNode:"]
  33433. }),
  33434. $globals.DynamicDictionaryNode);
  33435. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  33436. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  33437. $core.addMethod(
  33438. $core.method({
  33439. selector: "acceptDagVisitor:",
  33440. protocol: "visiting",
  33441. fn: function (aVisitor){
  33442. var self=this,$self=this;
  33443. return $core.withContext(function($ctx1) {
  33444. return $recv(aVisitor)._visitJSStatementNode_(self);
  33445. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  33446. },
  33447. args: ["aVisitor"],
  33448. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  33449. referencedClasses: [],
  33450. messageSends: ["visitJSStatementNode:"]
  33451. }),
  33452. $globals.JSStatementNode);
  33453. $core.addMethod(
  33454. $core.method({
  33455. selector: "isJSStatementNode",
  33456. protocol: "testing",
  33457. fn: function (){
  33458. var self=this,$self=this;
  33459. return true;
  33460. },
  33461. args: [],
  33462. source: "isJSStatementNode\x0a\x09^ true",
  33463. referencedClasses: [],
  33464. messageSends: []
  33465. }),
  33466. $globals.JSStatementNode);
  33467. $core.addMethod(
  33468. $core.method({
  33469. selector: "requiresSmalltalkContext",
  33470. protocol: "testing",
  33471. fn: function (){
  33472. var self=this,$self=this;
  33473. return true;
  33474. },
  33475. args: [],
  33476. source: "requiresSmalltalkContext\x0a\x09^ true",
  33477. referencedClasses: [],
  33478. messageSends: []
  33479. }),
  33480. $globals.JSStatementNode);
  33481. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  33482. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  33483. $core.addMethod(
  33484. $core.method({
  33485. selector: "acceptDagVisitor:",
  33486. protocol: "visiting",
  33487. fn: function (aVisitor){
  33488. var self=this,$self=this;
  33489. return $core.withContext(function($ctx1) {
  33490. return $recv(aVisitor)._visitMethodNode_(self);
  33491. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  33492. },
  33493. args: ["aVisitor"],
  33494. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  33495. referencedClasses: [],
  33496. messageSends: ["visitMethodNode:"]
  33497. }),
  33498. $globals.MethodNode);
  33499. $core.addMethod(
  33500. $core.method({
  33501. selector: "arguments",
  33502. protocol: "accessing",
  33503. fn: function (){
  33504. var self=this,$self=this;
  33505. return $core.withContext(function($ctx1) {
  33506. var $1,$receiver;
  33507. $1=$self["@arguments"];
  33508. if(($receiver = $1) == null || $receiver.a$nil){
  33509. return [];
  33510. } else {
  33511. return $1;
  33512. }
  33513. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  33514. },
  33515. args: [],
  33516. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  33517. referencedClasses: [],
  33518. messageSends: ["ifNil:"]
  33519. }),
  33520. $globals.MethodNode);
  33521. $core.addMethod(
  33522. $core.method({
  33523. selector: "arguments:",
  33524. protocol: "accessing",
  33525. fn: function (aCollection){
  33526. var self=this,$self=this;
  33527. $self["@arguments"]=aCollection;
  33528. return self;
  33529. },
  33530. args: ["aCollection"],
  33531. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  33532. referencedClasses: [],
  33533. messageSends: []
  33534. }),
  33535. $globals.MethodNode);
  33536. $core.addMethod(
  33537. $core.method({
  33538. selector: "classReferences",
  33539. protocol: "accessing",
  33540. fn: function (){
  33541. var self=this,$self=this;
  33542. return $self["@classReferences"];
  33543. },
  33544. args: [],
  33545. source: "classReferences\x0a\x09^ classReferences",
  33546. referencedClasses: [],
  33547. messageSends: []
  33548. }),
  33549. $globals.MethodNode);
  33550. $core.addMethod(
  33551. $core.method({
  33552. selector: "classReferences:",
  33553. protocol: "accessing",
  33554. fn: function (aCollection){
  33555. var self=this,$self=this;
  33556. $self["@classReferences"]=aCollection;
  33557. return self;
  33558. },
  33559. args: ["aCollection"],
  33560. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  33561. referencedClasses: [],
  33562. messageSends: []
  33563. }),
  33564. $globals.MethodNode);
  33565. $core.addMethod(
  33566. $core.method({
  33567. selector: "messageSends",
  33568. protocol: "accessing",
  33569. fn: function (){
  33570. var self=this,$self=this;
  33571. return $core.withContext(function($ctx1) {
  33572. return $recv($self._sendIndexes())._keys();
  33573. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  33574. },
  33575. args: [],
  33576. source: "messageSends\x0a\x09^ self sendIndexes keys",
  33577. referencedClasses: [],
  33578. messageSends: ["keys", "sendIndexes"]
  33579. }),
  33580. $globals.MethodNode);
  33581. $core.addMethod(
  33582. $core.method({
  33583. selector: "method",
  33584. protocol: "accessing",
  33585. fn: function (){
  33586. var self=this,$self=this;
  33587. return self;
  33588. },
  33589. args: [],
  33590. source: "method\x0a\x09^ self",
  33591. referencedClasses: [],
  33592. messageSends: []
  33593. }),
  33594. $globals.MethodNode);
  33595. $core.addMethod(
  33596. $core.method({
  33597. selector: "scope",
  33598. protocol: "accessing",
  33599. fn: function (){
  33600. var self=this,$self=this;
  33601. return $self["@scope"];
  33602. },
  33603. args: [],
  33604. source: "scope\x0a\x09^ scope",
  33605. referencedClasses: [],
  33606. messageSends: []
  33607. }),
  33608. $globals.MethodNode);
  33609. $core.addMethod(
  33610. $core.method({
  33611. selector: "scope:",
  33612. protocol: "accessing",
  33613. fn: function (aMethodScope){
  33614. var self=this,$self=this;
  33615. $self["@scope"]=aMethodScope;
  33616. return self;
  33617. },
  33618. args: ["aMethodScope"],
  33619. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  33620. referencedClasses: [],
  33621. messageSends: []
  33622. }),
  33623. $globals.MethodNode);
  33624. $core.addMethod(
  33625. $core.method({
  33626. selector: "selector",
  33627. protocol: "accessing",
  33628. fn: function (){
  33629. var self=this,$self=this;
  33630. return $self["@selector"];
  33631. },
  33632. args: [],
  33633. source: "selector\x0a\x09^ selector",
  33634. referencedClasses: [],
  33635. messageSends: []
  33636. }),
  33637. $globals.MethodNode);
  33638. $core.addMethod(
  33639. $core.method({
  33640. selector: "selector:",
  33641. protocol: "accessing",
  33642. fn: function (aString){
  33643. var self=this,$self=this;
  33644. $self["@selector"]=aString;
  33645. return self;
  33646. },
  33647. args: ["aString"],
  33648. source: "selector: aString\x0a\x09selector := aString",
  33649. referencedClasses: [],
  33650. messageSends: []
  33651. }),
  33652. $globals.MethodNode);
  33653. $core.addMethod(
  33654. $core.method({
  33655. selector: "sendIndexes",
  33656. protocol: "accessing",
  33657. fn: function (){
  33658. var self=this,$self=this;
  33659. return $self["@sendIndexes"];
  33660. },
  33661. args: [],
  33662. source: "sendIndexes\x0a\x09^ sendIndexes",
  33663. referencedClasses: [],
  33664. messageSends: []
  33665. }),
  33666. $globals.MethodNode);
  33667. $core.addMethod(
  33668. $core.method({
  33669. selector: "sendIndexes:",
  33670. protocol: "accessing",
  33671. fn: function (aDictionary){
  33672. var self=this,$self=this;
  33673. $self["@sendIndexes"]=aDictionary;
  33674. return self;
  33675. },
  33676. args: ["aDictionary"],
  33677. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  33678. referencedClasses: [],
  33679. messageSends: []
  33680. }),
  33681. $globals.MethodNode);
  33682. $core.addMethod(
  33683. $core.method({
  33684. selector: "sequenceNode",
  33685. protocol: "accessing",
  33686. fn: function (){
  33687. var self=this,$self=this;
  33688. return $core.withContext(function($ctx1) {
  33689. var $1;
  33690. var $early={};
  33691. try {
  33692. $recv($self._dagChildren())._do_((function(each){
  33693. return $core.withContext(function($ctx2) {
  33694. $1=$recv(each)._isSequenceNode();
  33695. if($core.assert($1)){
  33696. throw $early=[each];
  33697. }
  33698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33699. }));
  33700. return nil;
  33701. }
  33702. catch(e) {if(e===$early)return e[0]; throw e}
  33703. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  33704. },
  33705. args: [],
  33706. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  33707. referencedClasses: [],
  33708. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  33709. }),
  33710. $globals.MethodNode);
  33711. $core.addMethod(
  33712. $core.method({
  33713. selector: "source",
  33714. protocol: "accessing",
  33715. fn: function (){
  33716. var self=this,$self=this;
  33717. return $self["@source"];
  33718. },
  33719. args: [],
  33720. source: "source\x0a\x09^ source",
  33721. referencedClasses: [],
  33722. messageSends: []
  33723. }),
  33724. $globals.MethodNode);
  33725. $core.addMethod(
  33726. $core.method({
  33727. selector: "source:",
  33728. protocol: "accessing",
  33729. fn: function (aString){
  33730. var self=this,$self=this;
  33731. $self["@source"]=aString;
  33732. return self;
  33733. },
  33734. args: ["aString"],
  33735. source: "source: aString\x0a\x09source := aString",
  33736. referencedClasses: [],
  33737. messageSends: []
  33738. }),
  33739. $globals.MethodNode);
  33740. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  33741. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  33742. $core.addMethod(
  33743. $core.method({
  33744. selector: "acceptDagVisitor:",
  33745. protocol: "visiting",
  33746. fn: function (aVisitor){
  33747. var self=this,$self=this;
  33748. return $core.withContext(function($ctx1) {
  33749. return $recv(aVisitor)._visitReturnNode_(self);
  33750. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  33751. },
  33752. args: ["aVisitor"],
  33753. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  33754. referencedClasses: [],
  33755. messageSends: ["visitReturnNode:"]
  33756. }),
  33757. $globals.ReturnNode);
  33758. $core.addMethod(
  33759. $core.method({
  33760. selector: "isReturnNode",
  33761. protocol: "testing",
  33762. fn: function (){
  33763. var self=this,$self=this;
  33764. return true;
  33765. },
  33766. args: [],
  33767. source: "isReturnNode\x0a\x09^ true",
  33768. referencedClasses: [],
  33769. messageSends: []
  33770. }),
  33771. $globals.ReturnNode);
  33772. $core.addMethod(
  33773. $core.method({
  33774. selector: "nonLocalReturn",
  33775. protocol: "testing",
  33776. fn: function (){
  33777. var self=this,$self=this;
  33778. return $core.withContext(function($ctx1) {
  33779. return $recv($recv($self._scope())._isMethodScope())._not();
  33780. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  33781. },
  33782. args: [],
  33783. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  33784. referencedClasses: [],
  33785. messageSends: ["not", "isMethodScope", "scope"]
  33786. }),
  33787. $globals.ReturnNode);
  33788. $core.addMethod(
  33789. $core.method({
  33790. selector: "scope",
  33791. protocol: "accessing",
  33792. fn: function (){
  33793. var self=this,$self=this;
  33794. return $self["@scope"];
  33795. },
  33796. args: [],
  33797. source: "scope\x0a\x09^ scope",
  33798. referencedClasses: [],
  33799. messageSends: []
  33800. }),
  33801. $globals.ReturnNode);
  33802. $core.addMethod(
  33803. $core.method({
  33804. selector: "scope:",
  33805. protocol: "accessing",
  33806. fn: function (aLexicalScope){
  33807. var self=this,$self=this;
  33808. $self["@scope"]=aLexicalScope;
  33809. return self;
  33810. },
  33811. args: ["aLexicalScope"],
  33812. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33813. referencedClasses: [],
  33814. messageSends: []
  33815. }),
  33816. $globals.ReturnNode);
  33817. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  33818. $globals.SendNode.comment="I represent an message send node.";
  33819. $core.addMethod(
  33820. $core.method({
  33821. selector: "acceptDagVisitor:",
  33822. protocol: "visiting",
  33823. fn: function (aVisitor){
  33824. var self=this,$self=this;
  33825. return $core.withContext(function($ctx1) {
  33826. return $recv(aVisitor)._visitSendNode_(self);
  33827. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  33828. },
  33829. args: ["aVisitor"],
  33830. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  33831. referencedClasses: [],
  33832. messageSends: ["visitSendNode:"]
  33833. }),
  33834. $globals.SendNode);
  33835. $core.addMethod(
  33836. $core.method({
  33837. selector: "arguments",
  33838. protocol: "accessing",
  33839. fn: function (){
  33840. var self=this,$self=this;
  33841. return $core.withContext(function($ctx1) {
  33842. var $1,$receiver;
  33843. $1=$self["@arguments"];
  33844. if(($receiver = $1) == null || $receiver.a$nil){
  33845. $self["@arguments"]=[];
  33846. return $self["@arguments"];
  33847. } else {
  33848. return $1;
  33849. }
  33850. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  33851. },
  33852. args: [],
  33853. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  33854. referencedClasses: [],
  33855. messageSends: ["ifNil:"]
  33856. }),
  33857. $globals.SendNode);
  33858. $core.addMethod(
  33859. $core.method({
  33860. selector: "arguments:",
  33861. protocol: "accessing",
  33862. fn: function (aCollection){
  33863. var self=this,$self=this;
  33864. $self["@arguments"]=aCollection;
  33865. return self;
  33866. },
  33867. args: ["aCollection"],
  33868. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  33869. referencedClasses: [],
  33870. messageSends: []
  33871. }),
  33872. $globals.SendNode);
  33873. $core.addMethod(
  33874. $core.method({
  33875. selector: "dagChildren",
  33876. protocol: "accessing",
  33877. fn: function (){
  33878. var self=this,$self=this;
  33879. return $core.withContext(function($ctx1) {
  33880. var $1,$2,$3,$receiver;
  33881. $1=$self._receiver();
  33882. $ctx1.sendIdx["receiver"]=1;
  33883. if(($receiver = $1) == null || $receiver.a$nil){
  33884. $2=$self._arguments();
  33885. $ctx1.sendIdx["arguments"]=1;
  33886. return $recv($2)._copy();
  33887. } else {
  33888. $1;
  33889. }
  33890. $3=$recv($globals.Array)._with_($self._receiver());
  33891. $recv($3)._addAll_($self._arguments());
  33892. return $recv($3)._yourself();
  33893. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  33894. },
  33895. args: [],
  33896. source: "dagChildren\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  33897. referencedClasses: ["Array"],
  33898. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  33899. }),
  33900. $globals.SendNode);
  33901. $core.addMethod(
  33902. $core.method({
  33903. selector: "index",
  33904. protocol: "accessing",
  33905. fn: function (){
  33906. var self=this,$self=this;
  33907. return $self["@index"];
  33908. },
  33909. args: [],
  33910. source: "index\x0a\x09^ index",
  33911. referencedClasses: [],
  33912. messageSends: []
  33913. }),
  33914. $globals.SendNode);
  33915. $core.addMethod(
  33916. $core.method({
  33917. selector: "index:",
  33918. protocol: "accessing",
  33919. fn: function (anInteger){
  33920. var self=this,$self=this;
  33921. $self["@index"]=anInteger;
  33922. return self;
  33923. },
  33924. args: ["anInteger"],
  33925. source: "index: anInteger\x0a\x09index := anInteger",
  33926. referencedClasses: [],
  33927. messageSends: []
  33928. }),
  33929. $globals.SendNode);
  33930. $core.addMethod(
  33931. $core.method({
  33932. selector: "isNavigationNode",
  33933. protocol: "testing",
  33934. fn: function (){
  33935. var self=this,$self=this;
  33936. return true;
  33937. },
  33938. args: [],
  33939. source: "isNavigationNode\x0a\x09^ true",
  33940. referencedClasses: [],
  33941. messageSends: []
  33942. }),
  33943. $globals.SendNode);
  33944. $core.addMethod(
  33945. $core.method({
  33946. selector: "isSendNode",
  33947. protocol: "testing",
  33948. fn: function (){
  33949. var self=this,$self=this;
  33950. return true;
  33951. },
  33952. args: [],
  33953. source: "isSendNode\x0a\x09^ true",
  33954. referencedClasses: [],
  33955. messageSends: []
  33956. }),
  33957. $globals.SendNode);
  33958. $core.addMethod(
  33959. $core.method({
  33960. selector: "navigationLink",
  33961. protocol: "accessing",
  33962. fn: function (){
  33963. var self=this,$self=this;
  33964. return $core.withContext(function($ctx1) {
  33965. return $self._selector();
  33966. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  33967. },
  33968. args: [],
  33969. source: "navigationLink\x0a\x09^ self selector",
  33970. referencedClasses: [],
  33971. messageSends: ["selector"]
  33972. }),
  33973. $globals.SendNode);
  33974. $core.addMethod(
  33975. $core.method({
  33976. selector: "receiver",
  33977. protocol: "accessing",
  33978. fn: function (){
  33979. var self=this,$self=this;
  33980. return $self["@receiver"];
  33981. },
  33982. args: [],
  33983. source: "receiver\x0a\x09^ receiver",
  33984. referencedClasses: [],
  33985. messageSends: []
  33986. }),
  33987. $globals.SendNode);
  33988. $core.addMethod(
  33989. $core.method({
  33990. selector: "receiver:",
  33991. protocol: "accessing",
  33992. fn: function (aNode){
  33993. var self=this,$self=this;
  33994. $self["@receiver"]=aNode;
  33995. return self;
  33996. },
  33997. args: ["aNode"],
  33998. source: "receiver: aNode\x0a\x09receiver := aNode",
  33999. referencedClasses: [],
  34000. messageSends: []
  34001. }),
  34002. $globals.SendNode);
  34003. $core.addMethod(
  34004. $core.method({
  34005. selector: "requiresSmalltalkContext",
  34006. protocol: "testing",
  34007. fn: function (){
  34008. var self=this,$self=this;
  34009. return true;
  34010. },
  34011. args: [],
  34012. source: "requiresSmalltalkContext\x0a\x09^ true",
  34013. referencedClasses: [],
  34014. messageSends: []
  34015. }),
  34016. $globals.SendNode);
  34017. $core.addMethod(
  34018. $core.method({
  34019. selector: "selector",
  34020. protocol: "accessing",
  34021. fn: function (){
  34022. var self=this,$self=this;
  34023. return $self["@selector"];
  34024. },
  34025. args: [],
  34026. source: "selector\x0a\x09^ selector",
  34027. referencedClasses: [],
  34028. messageSends: []
  34029. }),
  34030. $globals.SendNode);
  34031. $core.addMethod(
  34032. $core.method({
  34033. selector: "selector:",
  34034. protocol: "accessing",
  34035. fn: function (aString){
  34036. var self=this,$self=this;
  34037. $self["@selector"]=aString;
  34038. return self;
  34039. },
  34040. args: ["aString"],
  34041. source: "selector: aString\x0a\x09selector := aString",
  34042. referencedClasses: [],
  34043. messageSends: []
  34044. }),
  34045. $globals.SendNode);
  34046. $core.addMethod(
  34047. $core.method({
  34048. selector: "shouldBeInlined",
  34049. protocol: "accessing",
  34050. fn: function (){
  34051. var self=this,$self=this;
  34052. return $core.withContext(function($ctx1) {
  34053. var $1,$receiver;
  34054. $1=$self["@shouldBeInlined"];
  34055. if(($receiver = $1) == null || $receiver.a$nil){
  34056. return false;
  34057. } else {
  34058. return $1;
  34059. }
  34060. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34061. },
  34062. args: [],
  34063. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34064. referencedClasses: [],
  34065. messageSends: ["ifNil:"]
  34066. }),
  34067. $globals.SendNode);
  34068. $core.addMethod(
  34069. $core.method({
  34070. selector: "shouldBeInlined:",
  34071. protocol: "accessing",
  34072. fn: function (aBoolean){
  34073. var self=this,$self=this;
  34074. $self["@shouldBeInlined"]=aBoolean;
  34075. return self;
  34076. },
  34077. args: ["aBoolean"],
  34078. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34079. referencedClasses: [],
  34080. messageSends: []
  34081. }),
  34082. $globals.SendNode);
  34083. $core.addMethod(
  34084. $core.method({
  34085. selector: "superSend",
  34086. protocol: "accessing",
  34087. fn: function (){
  34088. var self=this,$self=this;
  34089. return $core.withContext(function($ctx1) {
  34090. var $2,$1;
  34091. $2=$self._receiver();
  34092. $ctx1.sendIdx["receiver"]=1;
  34093. $1=$recv($2)._notNil();
  34094. return $recv($1)._and_((function(){
  34095. return $core.withContext(function($ctx2) {
  34096. return $recv($self._receiver())._isSuperKeyword();
  34097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34098. }));
  34099. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34100. },
  34101. args: [],
  34102. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34103. referencedClasses: [],
  34104. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34105. }),
  34106. $globals.SendNode);
  34107. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "scope"], "Compiler-AST");
  34108. $globals.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).";
  34109. $core.addMethod(
  34110. $core.method({
  34111. selector: "acceptDagVisitor:",
  34112. protocol: "visiting",
  34113. fn: function (aVisitor){
  34114. var self=this,$self=this;
  34115. return $core.withContext(function($ctx1) {
  34116. return $recv(aVisitor)._visitSequenceNode_(self);
  34117. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34118. },
  34119. args: ["aVisitor"],
  34120. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34121. referencedClasses: [],
  34122. messageSends: ["visitSequenceNode:"]
  34123. }),
  34124. $globals.SequenceNode);
  34125. $core.addMethod(
  34126. $core.method({
  34127. selector: "asBlockSequenceNode",
  34128. protocol: "building",
  34129. fn: function (){
  34130. var self=this,$self=this;
  34131. return $core.withContext(function($ctx1) {
  34132. var $1;
  34133. $1=$recv($globals.BlockSequenceNode)._new();
  34134. $recv($1)._position_($self._position());
  34135. $recv($1)._source_($self._source());
  34136. $recv($1)._dagChildren_($self._dagChildren());
  34137. $recv($1)._temps_($self._temps());
  34138. return $recv($1)._yourself();
  34139. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34140. },
  34141. args: [],
  34142. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  34143. referencedClasses: ["BlockSequenceNode"],
  34144. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "yourself"]
  34145. }),
  34146. $globals.SequenceNode);
  34147. $core.addMethod(
  34148. $core.method({
  34149. selector: "isSequenceNode",
  34150. protocol: "testing",
  34151. fn: function (){
  34152. var self=this,$self=this;
  34153. return true;
  34154. },
  34155. args: [],
  34156. source: "isSequenceNode\x0a\x09^ true",
  34157. referencedClasses: [],
  34158. messageSends: []
  34159. }),
  34160. $globals.SequenceNode);
  34161. $core.addMethod(
  34162. $core.method({
  34163. selector: "scope",
  34164. protocol: "accessing",
  34165. fn: function (){
  34166. var self=this,$self=this;
  34167. return $self["@scope"];
  34168. },
  34169. args: [],
  34170. source: "scope\x0a\x09^ scope",
  34171. referencedClasses: [],
  34172. messageSends: []
  34173. }),
  34174. $globals.SequenceNode);
  34175. $core.addMethod(
  34176. $core.method({
  34177. selector: "scope:",
  34178. protocol: "accessing",
  34179. fn: function (aLexicalScope){
  34180. var self=this,$self=this;
  34181. $self["@scope"]=aLexicalScope;
  34182. return self;
  34183. },
  34184. args: ["aLexicalScope"],
  34185. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34186. referencedClasses: [],
  34187. messageSends: []
  34188. }),
  34189. $globals.SequenceNode);
  34190. $core.addMethod(
  34191. $core.method({
  34192. selector: "temps",
  34193. protocol: "accessing",
  34194. fn: function (){
  34195. var self=this,$self=this;
  34196. return $core.withContext(function($ctx1) {
  34197. var $1,$receiver;
  34198. $1=$self["@temps"];
  34199. if(($receiver = $1) == null || $receiver.a$nil){
  34200. return [];
  34201. } else {
  34202. return $1;
  34203. }
  34204. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  34205. },
  34206. args: [],
  34207. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  34208. referencedClasses: [],
  34209. messageSends: ["ifNil:"]
  34210. }),
  34211. $globals.SequenceNode);
  34212. $core.addMethod(
  34213. $core.method({
  34214. selector: "temps:",
  34215. protocol: "accessing",
  34216. fn: function (aCollection){
  34217. var self=this,$self=this;
  34218. $self["@temps"]=aCollection;
  34219. return self;
  34220. },
  34221. args: ["aCollection"],
  34222. source: "temps: aCollection\x0a\x09temps := aCollection",
  34223. referencedClasses: [],
  34224. messageSends: []
  34225. }),
  34226. $globals.SequenceNode);
  34227. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  34228. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  34229. $core.addMethod(
  34230. $core.method({
  34231. selector: "acceptDagVisitor:",
  34232. protocol: "visiting",
  34233. fn: function (aVisitor){
  34234. var self=this,$self=this;
  34235. return $core.withContext(function($ctx1) {
  34236. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  34237. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  34238. },
  34239. args: ["aVisitor"],
  34240. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  34241. referencedClasses: [],
  34242. messageSends: ["visitBlockSequenceNode:"]
  34243. }),
  34244. $globals.BlockSequenceNode);
  34245. $core.addMethod(
  34246. $core.method({
  34247. selector: "isBlockSequenceNode",
  34248. protocol: "testing",
  34249. fn: function (){
  34250. var self=this,$self=this;
  34251. return true;
  34252. },
  34253. args: [],
  34254. source: "isBlockSequenceNode\x0a\x09^ true",
  34255. referencedClasses: [],
  34256. messageSends: []
  34257. }),
  34258. $globals.BlockSequenceNode);
  34259. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  34260. $globals.ValueNode.comment="I represent a value node.";
  34261. $core.addMethod(
  34262. $core.method({
  34263. selector: "acceptDagVisitor:",
  34264. protocol: "visiting",
  34265. fn: function (aVisitor){
  34266. var self=this,$self=this;
  34267. return $core.withContext(function($ctx1) {
  34268. return $recv(aVisitor)._visitValueNode_(self);
  34269. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  34270. },
  34271. args: ["aVisitor"],
  34272. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  34273. referencedClasses: [],
  34274. messageSends: ["visitValueNode:"]
  34275. }),
  34276. $globals.ValueNode);
  34277. $core.addMethod(
  34278. $core.method({
  34279. selector: "isImmutable",
  34280. protocol: "testing",
  34281. fn: function (){
  34282. var self=this,$self=this;
  34283. return $core.withContext(function($ctx1) {
  34284. return $recv($self._value())._isImmutable();
  34285. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  34286. },
  34287. args: [],
  34288. source: "isImmutable\x0a\x09^ self value isImmutable",
  34289. referencedClasses: [],
  34290. messageSends: ["isImmutable", "value"]
  34291. }),
  34292. $globals.ValueNode);
  34293. $core.addMethod(
  34294. $core.method({
  34295. selector: "isValueNode",
  34296. protocol: "testing",
  34297. fn: function (){
  34298. var self=this,$self=this;
  34299. return true;
  34300. },
  34301. args: [],
  34302. source: "isValueNode\x0a\x09^ true",
  34303. referencedClasses: [],
  34304. messageSends: []
  34305. }),
  34306. $globals.ValueNode);
  34307. $core.addMethod(
  34308. $core.method({
  34309. selector: "value",
  34310. protocol: "accessing",
  34311. fn: function (){
  34312. var self=this,$self=this;
  34313. return $self["@value"];
  34314. },
  34315. args: [],
  34316. source: "value\x0a\x09^ value",
  34317. referencedClasses: [],
  34318. messageSends: []
  34319. }),
  34320. $globals.ValueNode);
  34321. $core.addMethod(
  34322. $core.method({
  34323. selector: "value:",
  34324. protocol: "accessing",
  34325. fn: function (anObject){
  34326. var self=this,$self=this;
  34327. $self["@value"]=anObject;
  34328. return self;
  34329. },
  34330. args: ["anObject"],
  34331. source: "value: anObject\x0a\x09value := anObject",
  34332. referencedClasses: [],
  34333. messageSends: []
  34334. }),
  34335. $globals.ValueNode);
  34336. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  34337. $globals.VariableNode.comment="I represent an variable node.";
  34338. $core.addMethod(
  34339. $core.method({
  34340. selector: "acceptDagVisitor:",
  34341. protocol: "visiting",
  34342. fn: function (aVisitor){
  34343. var self=this,$self=this;
  34344. return $core.withContext(function($ctx1) {
  34345. return $recv(aVisitor)._visitVariableNode_(self);
  34346. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  34347. },
  34348. args: ["aVisitor"],
  34349. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  34350. referencedClasses: [],
  34351. messageSends: ["visitVariableNode:"]
  34352. }),
  34353. $globals.VariableNode);
  34354. $core.addMethod(
  34355. $core.method({
  34356. selector: "alias",
  34357. protocol: "accessing",
  34358. fn: function (){
  34359. var self=this,$self=this;
  34360. return $core.withContext(function($ctx1) {
  34361. return $recv($self._binding())._alias();
  34362. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  34363. },
  34364. args: [],
  34365. source: "alias\x0a\x09^ self binding alias",
  34366. referencedClasses: [],
  34367. messageSends: ["alias", "binding"]
  34368. }),
  34369. $globals.VariableNode);
  34370. $core.addMethod(
  34371. $core.method({
  34372. selector: "assigned",
  34373. protocol: "accessing",
  34374. fn: function (){
  34375. var self=this,$self=this;
  34376. return $core.withContext(function($ctx1) {
  34377. var $1,$receiver;
  34378. $1=$self["@assigned"];
  34379. if(($receiver = $1) == null || $receiver.a$nil){
  34380. return false;
  34381. } else {
  34382. return $1;
  34383. }
  34384. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  34385. },
  34386. args: [],
  34387. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  34388. referencedClasses: [],
  34389. messageSends: ["ifNil:"]
  34390. }),
  34391. $globals.VariableNode);
  34392. $core.addMethod(
  34393. $core.method({
  34394. selector: "assigned:",
  34395. protocol: "accessing",
  34396. fn: function (aBoolean){
  34397. var self=this,$self=this;
  34398. $self["@assigned"]=aBoolean;
  34399. return self;
  34400. },
  34401. args: ["aBoolean"],
  34402. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  34403. referencedClasses: [],
  34404. messageSends: []
  34405. }),
  34406. $globals.VariableNode);
  34407. $core.addMethod(
  34408. $core.method({
  34409. selector: "beAssigned",
  34410. protocol: "accessing",
  34411. fn: function (){
  34412. var self=this,$self=this;
  34413. return $core.withContext(function($ctx1) {
  34414. $recv($self._binding())._validateAssignment();
  34415. $self["@assigned"]=true;
  34416. return self;
  34417. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  34418. },
  34419. args: [],
  34420. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  34421. referencedClasses: [],
  34422. messageSends: ["validateAssignment", "binding"]
  34423. }),
  34424. $globals.VariableNode);
  34425. $core.addMethod(
  34426. $core.method({
  34427. selector: "binding",
  34428. protocol: "accessing",
  34429. fn: function (){
  34430. var self=this,$self=this;
  34431. return $self["@binding"];
  34432. },
  34433. args: [],
  34434. source: "binding\x0a\x09^ binding",
  34435. referencedClasses: [],
  34436. messageSends: []
  34437. }),
  34438. $globals.VariableNode);
  34439. $core.addMethod(
  34440. $core.method({
  34441. selector: "binding:",
  34442. protocol: "accessing",
  34443. fn: function (aScopeVar){
  34444. var self=this,$self=this;
  34445. $self["@binding"]=aScopeVar;
  34446. return self;
  34447. },
  34448. args: ["aScopeVar"],
  34449. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  34450. referencedClasses: [],
  34451. messageSends: []
  34452. }),
  34453. $globals.VariableNode);
  34454. $core.addMethod(
  34455. $core.method({
  34456. selector: "isArgument",
  34457. protocol: "testing",
  34458. fn: function (){
  34459. var self=this,$self=this;
  34460. return $core.withContext(function($ctx1) {
  34461. return $recv($self._binding())._isArgVar();
  34462. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  34463. },
  34464. args: [],
  34465. source: "isArgument\x0a\x09^ self binding isArgVar",
  34466. referencedClasses: [],
  34467. messageSends: ["isArgVar", "binding"]
  34468. }),
  34469. $globals.VariableNode);
  34470. $core.addMethod(
  34471. $core.method({
  34472. selector: "isImmutable",
  34473. protocol: "testing",
  34474. fn: function (){
  34475. var self=this,$self=this;
  34476. return $core.withContext(function($ctx1) {
  34477. return $recv($self._binding())._isImmutable();
  34478. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  34479. },
  34480. args: [],
  34481. source: "isImmutable\x0a\x09^ self binding isImmutable",
  34482. referencedClasses: [],
  34483. messageSends: ["isImmutable", "binding"]
  34484. }),
  34485. $globals.VariableNode);
  34486. $core.addMethod(
  34487. $core.method({
  34488. selector: "isNavigationNode",
  34489. protocol: "testing",
  34490. fn: function (){
  34491. var self=this,$self=this;
  34492. return true;
  34493. },
  34494. args: [],
  34495. source: "isNavigationNode\x0a\x09^ true",
  34496. referencedClasses: [],
  34497. messageSends: []
  34498. }),
  34499. $globals.VariableNode);
  34500. $core.addMethod(
  34501. $core.method({
  34502. selector: "isSuperKeyword",
  34503. protocol: "testing",
  34504. fn: function (){
  34505. var self=this,$self=this;
  34506. return $core.withContext(function($ctx1) {
  34507. return $recv($self._value()).__eq("super");
  34508. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  34509. },
  34510. args: [],
  34511. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  34512. referencedClasses: [],
  34513. messageSends: ["=", "value"]
  34514. }),
  34515. $globals.VariableNode);
  34516. $core.addMethod(
  34517. $core.method({
  34518. selector: "isVariableNode",
  34519. protocol: "testing",
  34520. fn: function (){
  34521. var self=this,$self=this;
  34522. return true;
  34523. },
  34524. args: [],
  34525. source: "isVariableNode\x0a\x09^ true",
  34526. referencedClasses: [],
  34527. messageSends: []
  34528. }),
  34529. $globals.VariableNode);
  34530. $core.addMethod(
  34531. $core.method({
  34532. selector: "navigationLink",
  34533. protocol: "accessing",
  34534. fn: function (){
  34535. var self=this,$self=this;
  34536. return $core.withContext(function($ctx1) {
  34537. return $self._value();
  34538. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  34539. },
  34540. args: [],
  34541. source: "navigationLink\x0a\x09^ self value",
  34542. referencedClasses: [],
  34543. messageSends: ["value"]
  34544. }),
  34545. $globals.VariableNode);
  34546. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  34547. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  34548. $core.addMethod(
  34549. $core.method({
  34550. selector: "visit:",
  34551. protocol: "visiting",
  34552. fn: function (aNode){
  34553. var self=this,$self=this;
  34554. return $core.withContext(function($ctx1) {
  34555. var $1;
  34556. $recv($self._path())._ifNotEmpty_((function(p){
  34557. return $core.withContext(function($ctx2) {
  34558. return $recv(aNode)._parent_($recv(p)._last());
  34559. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  34560. }));
  34561. $1=(
  34562. $ctx1.supercall = true,
  34563. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  34564. $ctx1.supercall = false;
  34565. return $1;
  34566. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  34567. },
  34568. args: ["aNode"],
  34569. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  34570. referencedClasses: [],
  34571. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  34572. }),
  34573. $globals.ParentFakingPathDagVisitor);
  34574. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  34575. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  34576. $core.addMethod(
  34577. $core.method({
  34578. selector: "visitAssignmentNode:",
  34579. protocol: "visiting",
  34580. fn: function (aNode){
  34581. var self=this,$self=this;
  34582. return $core.withContext(function($ctx1) {
  34583. return $self._visitDagNode_(aNode);
  34584. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  34585. },
  34586. args: ["aNode"],
  34587. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34588. referencedClasses: [],
  34589. messageSends: ["visitDagNode:"]
  34590. }),
  34591. $globals.NodeVisitor);
  34592. $core.addMethod(
  34593. $core.method({
  34594. selector: "visitBlockNode:",
  34595. protocol: "visiting",
  34596. fn: function (aNode){
  34597. var self=this,$self=this;
  34598. return $core.withContext(function($ctx1) {
  34599. return $self._visitDagNode_(aNode);
  34600. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  34601. },
  34602. args: ["aNode"],
  34603. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34604. referencedClasses: [],
  34605. messageSends: ["visitDagNode:"]
  34606. }),
  34607. $globals.NodeVisitor);
  34608. $core.addMethod(
  34609. $core.method({
  34610. selector: "visitBlockSequenceNode:",
  34611. protocol: "visiting",
  34612. fn: function (aNode){
  34613. var self=this,$self=this;
  34614. return $core.withContext(function($ctx1) {
  34615. return $self._visitSequenceNode_(aNode);
  34616. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  34617. },
  34618. args: ["aNode"],
  34619. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  34620. referencedClasses: [],
  34621. messageSends: ["visitSequenceNode:"]
  34622. }),
  34623. $globals.NodeVisitor);
  34624. $core.addMethod(
  34625. $core.method({
  34626. selector: "visitCascadeNode:",
  34627. protocol: "visiting",
  34628. fn: function (aNode){
  34629. var self=this,$self=this;
  34630. return $core.withContext(function($ctx1) {
  34631. return $self._visitDagNode_(aNode);
  34632. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  34633. },
  34634. args: ["aNode"],
  34635. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34636. referencedClasses: [],
  34637. messageSends: ["visitDagNode:"]
  34638. }),
  34639. $globals.NodeVisitor);
  34640. $core.addMethod(
  34641. $core.method({
  34642. selector: "visitDagNode:",
  34643. protocol: "visiting",
  34644. fn: function (aNode){
  34645. var self=this,$self=this;
  34646. return $core.withContext(function($ctx1) {
  34647. return $self._visitDagNodeVariantSimple_(aNode);
  34648. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  34649. },
  34650. args: ["aNode"],
  34651. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  34652. referencedClasses: [],
  34653. messageSends: ["visitDagNodeVariantSimple:"]
  34654. }),
  34655. $globals.NodeVisitor);
  34656. $core.addMethod(
  34657. $core.method({
  34658. selector: "visitDynamicArrayNode:",
  34659. protocol: "visiting",
  34660. fn: function (aNode){
  34661. var self=this,$self=this;
  34662. return $core.withContext(function($ctx1) {
  34663. return $self._visitDagNode_(aNode);
  34664. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  34665. },
  34666. args: ["aNode"],
  34667. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34668. referencedClasses: [],
  34669. messageSends: ["visitDagNode:"]
  34670. }),
  34671. $globals.NodeVisitor);
  34672. $core.addMethod(
  34673. $core.method({
  34674. selector: "visitDynamicDictionaryNode:",
  34675. protocol: "visiting",
  34676. fn: function (aNode){
  34677. var self=this,$self=this;
  34678. return $core.withContext(function($ctx1) {
  34679. return $self._visitDagNode_(aNode);
  34680. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  34681. },
  34682. args: ["aNode"],
  34683. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34684. referencedClasses: [],
  34685. messageSends: ["visitDagNode:"]
  34686. }),
  34687. $globals.NodeVisitor);
  34688. $core.addMethod(
  34689. $core.method({
  34690. selector: "visitJSStatementNode:",
  34691. protocol: "visiting",
  34692. fn: function (aNode){
  34693. var self=this,$self=this;
  34694. return $core.withContext(function($ctx1) {
  34695. return $self._visitDagNode_(aNode);
  34696. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  34697. },
  34698. args: ["aNode"],
  34699. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34700. referencedClasses: [],
  34701. messageSends: ["visitDagNode:"]
  34702. }),
  34703. $globals.NodeVisitor);
  34704. $core.addMethod(
  34705. $core.method({
  34706. selector: "visitMethodNode:",
  34707. protocol: "visiting",
  34708. fn: function (aNode){
  34709. var self=this,$self=this;
  34710. return $core.withContext(function($ctx1) {
  34711. return $self._visitDagNode_(aNode);
  34712. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  34713. },
  34714. args: ["aNode"],
  34715. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34716. referencedClasses: [],
  34717. messageSends: ["visitDagNode:"]
  34718. }),
  34719. $globals.NodeVisitor);
  34720. $core.addMethod(
  34721. $core.method({
  34722. selector: "visitReturnNode:",
  34723. protocol: "visiting",
  34724. fn: function (aNode){
  34725. var self=this,$self=this;
  34726. return $core.withContext(function($ctx1) {
  34727. return $self._visitDagNode_(aNode);
  34728. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  34729. },
  34730. args: ["aNode"],
  34731. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34732. referencedClasses: [],
  34733. messageSends: ["visitDagNode:"]
  34734. }),
  34735. $globals.NodeVisitor);
  34736. $core.addMethod(
  34737. $core.method({
  34738. selector: "visitSendNode:",
  34739. protocol: "visiting",
  34740. fn: function (aNode){
  34741. var self=this,$self=this;
  34742. return $core.withContext(function($ctx1) {
  34743. return $self._visitDagNode_(aNode);
  34744. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  34745. },
  34746. args: ["aNode"],
  34747. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34748. referencedClasses: [],
  34749. messageSends: ["visitDagNode:"]
  34750. }),
  34751. $globals.NodeVisitor);
  34752. $core.addMethod(
  34753. $core.method({
  34754. selector: "visitSequenceNode:",
  34755. protocol: "visiting",
  34756. fn: function (aNode){
  34757. var self=this,$self=this;
  34758. return $core.withContext(function($ctx1) {
  34759. return $self._visitDagNode_(aNode);
  34760. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  34761. },
  34762. args: ["aNode"],
  34763. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34764. referencedClasses: [],
  34765. messageSends: ["visitDagNode:"]
  34766. }),
  34767. $globals.NodeVisitor);
  34768. $core.addMethod(
  34769. $core.method({
  34770. selector: "visitValueNode:",
  34771. protocol: "visiting",
  34772. fn: function (aNode){
  34773. var self=this,$self=this;
  34774. return $core.withContext(function($ctx1) {
  34775. return $self._visitDagNode_(aNode);
  34776. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  34777. },
  34778. args: ["aNode"],
  34779. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34780. referencedClasses: [],
  34781. messageSends: ["visitDagNode:"]
  34782. }),
  34783. $globals.NodeVisitor);
  34784. $core.addMethod(
  34785. $core.method({
  34786. selector: "visitVariableNode:",
  34787. protocol: "visiting",
  34788. fn: function (aNode){
  34789. var self=this,$self=this;
  34790. return $core.withContext(function($ctx1) {
  34791. return $self._visitDagNode_(aNode);
  34792. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  34793. },
  34794. args: ["aNode"],
  34795. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34796. referencedClasses: [],
  34797. messageSends: ["visitDagNode:"]
  34798. }),
  34799. $globals.NodeVisitor);
  34800. $core.addMethod(
  34801. $core.method({
  34802. selector: "ast",
  34803. protocol: "*Compiler-AST",
  34804. fn: function (){
  34805. var self=this,$self=this;
  34806. return $core.withContext(function($ctx1) {
  34807. var $1;
  34808. $1=$self._source();
  34809. $ctx1.sendIdx["source"]=1;
  34810. $recv($1)._ifEmpty_((function(){
  34811. return $core.withContext(function($ctx2) {
  34812. return $self._error_("Method source is empty");
  34813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34814. }));
  34815. return $recv($globals.Smalltalk)._parse_($self._source());
  34816. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  34817. },
  34818. args: [],
  34819. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  34820. referencedClasses: ["Smalltalk"],
  34821. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  34822. }),
  34823. $globals.CompiledMethod);
  34824. });
  34825. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  34826. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  34827. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  34828. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  34829. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  34830. $core.addPackage("Compiler-Semantic");
  34831. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  34832. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  34833. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  34834. $globals.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.";
  34835. $core.addMethod(
  34836. $core.method({
  34837. selector: "addArg:",
  34838. protocol: "adding",
  34839. fn: function (aString){
  34840. var self=this,$self=this;
  34841. return $core.withContext(function($ctx1) {
  34842. var $1;
  34843. $1=$self._args();
  34844. $ctx1.sendIdx["args"]=1;
  34845. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  34846. $recv($recv($self._args())._at_(aString))._scope_(self);
  34847. return self;
  34848. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  34849. },
  34850. args: ["aString"],
  34851. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  34852. referencedClasses: ["ArgVar"],
  34853. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  34854. }),
  34855. $globals.LexicalScope);
  34856. $core.addMethod(
  34857. $core.method({
  34858. selector: "addTemp:",
  34859. protocol: "adding",
  34860. fn: function (aString){
  34861. var self=this,$self=this;
  34862. return $core.withContext(function($ctx1) {
  34863. var $1;
  34864. $1=$self._temps();
  34865. $ctx1.sendIdx["temps"]=1;
  34866. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  34867. $recv($recv($self._temps())._at_(aString))._scope_(self);
  34868. return self;
  34869. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  34870. },
  34871. args: ["aString"],
  34872. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  34873. referencedClasses: ["TempVar"],
  34874. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  34875. }),
  34876. $globals.LexicalScope);
  34877. $core.addMethod(
  34878. $core.method({
  34879. selector: "alias",
  34880. protocol: "accessing",
  34881. fn: function (){
  34882. var self=this,$self=this;
  34883. return $core.withContext(function($ctx1) {
  34884. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  34885. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  34886. },
  34887. args: [],
  34888. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  34889. referencedClasses: [],
  34890. messageSends: [",", "asString", "scopeLevel"]
  34891. }),
  34892. $globals.LexicalScope);
  34893. $core.addMethod(
  34894. $core.method({
  34895. selector: "allVariableNames",
  34896. protocol: "accessing",
  34897. fn: function (){
  34898. var self=this,$self=this;
  34899. return $core.withContext(function($ctx1) {
  34900. var $1;
  34901. $1=$recv($self._args())._keys();
  34902. $ctx1.sendIdx["keys"]=1;
  34903. return $recv($1).__comma($recv($self._temps())._keys());
  34904. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  34905. },
  34906. args: [],
  34907. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  34908. referencedClasses: [],
  34909. messageSends: [",", "keys", "args", "temps"]
  34910. }),
  34911. $globals.LexicalScope);
  34912. $core.addMethod(
  34913. $core.method({
  34914. selector: "args",
  34915. protocol: "accessing",
  34916. fn: function (){
  34917. var self=this,$self=this;
  34918. return $core.withContext(function($ctx1) {
  34919. var $1,$receiver;
  34920. $1=$self["@args"];
  34921. if(($receiver = $1) == null || $receiver.a$nil){
  34922. $self["@args"]=$recv($globals.Dictionary)._new();
  34923. return $self["@args"];
  34924. } else {
  34925. return $1;
  34926. }
  34927. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  34928. },
  34929. args: [],
  34930. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  34931. referencedClasses: ["Dictionary"],
  34932. messageSends: ["ifNil:", "new"]
  34933. }),
  34934. $globals.LexicalScope);
  34935. $core.addMethod(
  34936. $core.method({
  34937. selector: "bindingFor:",
  34938. protocol: "accessing",
  34939. fn: function (aStringOrNode){
  34940. var self=this,$self=this;
  34941. return $core.withContext(function($ctx1) {
  34942. var $2,$3,$4,$5,$1;
  34943. $2=$self._pseudoVars();
  34944. $3=$recv(aStringOrNode)._value();
  34945. $ctx1.sendIdx["value"]=1;
  34946. $1=$recv($2)._at_ifAbsent_($3,(function(){
  34947. return $core.withContext(function($ctx2) {
  34948. $4=$self._args();
  34949. $5=$recv(aStringOrNode)._value();
  34950. $ctx2.sendIdx["value"]=2;
  34951. return $recv($4)._at_ifAbsent_($5,(function(){
  34952. return $core.withContext(function($ctx3) {
  34953. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  34954. return nil;
  34955. }));
  34956. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34957. }));
  34958. $ctx2.sendIdx["at:ifAbsent:"]=2;
  34959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34960. }));
  34961. $ctx1.sendIdx["at:ifAbsent:"]=1;
  34962. return $1;
  34963. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  34964. },
  34965. args: ["aStringOrNode"],
  34966. 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 ]]]",
  34967. referencedClasses: [],
  34968. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  34969. }),
  34970. $globals.LexicalScope);
  34971. $core.addMethod(
  34972. $core.method({
  34973. selector: "blockIndex",
  34974. protocol: "accessing",
  34975. fn: function (){
  34976. var self=this,$self=this;
  34977. return $core.withContext(function($ctx1) {
  34978. var $1,$receiver;
  34979. $1=$self["@blockIndex"];
  34980. if(($receiver = $1) == null || $receiver.a$nil){
  34981. return (0);
  34982. } else {
  34983. return $1;
  34984. }
  34985. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  34986. },
  34987. args: [],
  34988. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  34989. referencedClasses: [],
  34990. messageSends: ["ifNil:"]
  34991. }),
  34992. $globals.LexicalScope);
  34993. $core.addMethod(
  34994. $core.method({
  34995. selector: "blockIndex:",
  34996. protocol: "accessing",
  34997. fn: function (anInteger){
  34998. var self=this,$self=this;
  34999. $self["@blockIndex"]=anInteger;
  35000. return self;
  35001. },
  35002. args: ["anInteger"],
  35003. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  35004. referencedClasses: [],
  35005. messageSends: []
  35006. }),
  35007. $globals.LexicalScope);
  35008. $core.addMethod(
  35009. $core.method({
  35010. selector: "canInlineNonLocalReturns",
  35011. protocol: "testing",
  35012. fn: function (){
  35013. var self=this,$self=this;
  35014. return $core.withContext(function($ctx1) {
  35015. return $recv($self._isInlined())._and_((function(){
  35016. return $core.withContext(function($ctx2) {
  35017. return $recv($self._outerScope())._canInlineNonLocalReturns();
  35018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35019. }));
  35020. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  35021. },
  35022. args: [],
  35023. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  35024. referencedClasses: [],
  35025. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  35026. }),
  35027. $globals.LexicalScope);
  35028. $core.addMethod(
  35029. $core.method({
  35030. selector: "instruction",
  35031. protocol: "accessing",
  35032. fn: function (){
  35033. var self=this,$self=this;
  35034. return $self["@instruction"];
  35035. },
  35036. args: [],
  35037. source: "instruction\x0a\x09^ instruction",
  35038. referencedClasses: [],
  35039. messageSends: []
  35040. }),
  35041. $globals.LexicalScope);
  35042. $core.addMethod(
  35043. $core.method({
  35044. selector: "instruction:",
  35045. protocol: "accessing",
  35046. fn: function (anIRInstruction){
  35047. var self=this,$self=this;
  35048. $self["@instruction"]=anIRInstruction;
  35049. return self;
  35050. },
  35051. args: ["anIRInstruction"],
  35052. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  35053. referencedClasses: [],
  35054. messageSends: []
  35055. }),
  35056. $globals.LexicalScope);
  35057. $core.addMethod(
  35058. $core.method({
  35059. selector: "isBlockScope",
  35060. protocol: "testing",
  35061. fn: function (){
  35062. var self=this,$self=this;
  35063. return $core.withContext(function($ctx1) {
  35064. return $recv($self._isMethodScope())._not();
  35065. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  35066. },
  35067. args: [],
  35068. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  35069. referencedClasses: [],
  35070. messageSends: ["not", "isMethodScope"]
  35071. }),
  35072. $globals.LexicalScope);
  35073. $core.addMethod(
  35074. $core.method({
  35075. selector: "isInlined",
  35076. protocol: "testing",
  35077. fn: function (){
  35078. var self=this,$self=this;
  35079. return $core.withContext(function($ctx1) {
  35080. var $2,$1;
  35081. $2=$self._instruction();
  35082. $ctx1.sendIdx["instruction"]=1;
  35083. $1=$recv($2)._notNil();
  35084. return $recv($1)._and_((function(){
  35085. return $core.withContext(function($ctx2) {
  35086. return $recv($self._instruction())._isInlined();
  35087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35088. }));
  35089. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  35090. },
  35091. args: [],
  35092. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  35093. referencedClasses: [],
  35094. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  35095. }),
  35096. $globals.LexicalScope);
  35097. $core.addMethod(
  35098. $core.method({
  35099. selector: "isMethodScope",
  35100. protocol: "testing",
  35101. fn: function (){
  35102. var self=this,$self=this;
  35103. return false;
  35104. },
  35105. args: [],
  35106. source: "isMethodScope\x0a\x09^ false",
  35107. referencedClasses: [],
  35108. messageSends: []
  35109. }),
  35110. $globals.LexicalScope);
  35111. $core.addMethod(
  35112. $core.method({
  35113. selector: "lookupVariable:",
  35114. protocol: "accessing",
  35115. fn: function (aNode){
  35116. var self=this,$self=this;
  35117. var lookup;
  35118. return $core.withContext(function($ctx1) {
  35119. var $1,$2,$receiver;
  35120. lookup=$self._bindingFor_(aNode);
  35121. $1=lookup;
  35122. if(($receiver = $1) == null || $receiver.a$nil){
  35123. $2=$self._outerScope();
  35124. $ctx1.sendIdx["outerScope"]=1;
  35125. if(($receiver = $2) == null || $receiver.a$nil){
  35126. lookup=$2;
  35127. } else {
  35128. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  35129. }
  35130. lookup;
  35131. } else {
  35132. $1;
  35133. }
  35134. return lookup;
  35135. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  35136. },
  35137. args: ["aNode"],
  35138. 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",
  35139. referencedClasses: [],
  35140. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  35141. }),
  35142. $globals.LexicalScope);
  35143. $core.addMethod(
  35144. $core.method({
  35145. selector: "methodScope",
  35146. protocol: "accessing",
  35147. fn: function (){
  35148. var self=this,$self=this;
  35149. return $core.withContext(function($ctx1) {
  35150. var $1,$receiver;
  35151. $1=$self._outerScope();
  35152. $ctx1.sendIdx["outerScope"]=1;
  35153. if(($receiver = $1) == null || $receiver.a$nil){
  35154. return $1;
  35155. } else {
  35156. return $recv($self._outerScope())._methodScope();
  35157. }
  35158. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  35159. },
  35160. args: [],
  35161. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  35162. referencedClasses: [],
  35163. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  35164. }),
  35165. $globals.LexicalScope);
  35166. $core.addMethod(
  35167. $core.method({
  35168. selector: "node",
  35169. protocol: "accessing",
  35170. fn: function (){
  35171. var self=this,$self=this;
  35172. return $self["@node"];
  35173. },
  35174. args: [],
  35175. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  35176. referencedClasses: [],
  35177. messageSends: []
  35178. }),
  35179. $globals.LexicalScope);
  35180. $core.addMethod(
  35181. $core.method({
  35182. selector: "node:",
  35183. protocol: "accessing",
  35184. fn: function (aNode){
  35185. var self=this,$self=this;
  35186. $self["@node"]=aNode;
  35187. return self;
  35188. },
  35189. args: ["aNode"],
  35190. source: "node: aNode\x0a\x09node := aNode",
  35191. referencedClasses: [],
  35192. messageSends: []
  35193. }),
  35194. $globals.LexicalScope);
  35195. $core.addMethod(
  35196. $core.method({
  35197. selector: "outerScope",
  35198. protocol: "accessing",
  35199. fn: function (){
  35200. var self=this,$self=this;
  35201. return $self["@outerScope"];
  35202. },
  35203. args: [],
  35204. source: "outerScope\x0a\x09^ outerScope",
  35205. referencedClasses: [],
  35206. messageSends: []
  35207. }),
  35208. $globals.LexicalScope);
  35209. $core.addMethod(
  35210. $core.method({
  35211. selector: "outerScope:",
  35212. protocol: "accessing",
  35213. fn: function (aLexicalScope){
  35214. var self=this,$self=this;
  35215. $self["@outerScope"]=aLexicalScope;
  35216. return self;
  35217. },
  35218. args: ["aLexicalScope"],
  35219. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  35220. referencedClasses: [],
  35221. messageSends: []
  35222. }),
  35223. $globals.LexicalScope);
  35224. $core.addMethod(
  35225. $core.method({
  35226. selector: "pseudoVars",
  35227. protocol: "accessing",
  35228. fn: function (){
  35229. var self=this,$self=this;
  35230. return $core.withContext(function($ctx1) {
  35231. return $recv($self._methodScope())._pseudoVars();
  35232. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  35233. },
  35234. args: [],
  35235. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  35236. referencedClasses: [],
  35237. messageSends: ["pseudoVars", "methodScope"]
  35238. }),
  35239. $globals.LexicalScope);
  35240. $core.addMethod(
  35241. $core.method({
  35242. selector: "scopeLevel",
  35243. protocol: "accessing",
  35244. fn: function (){
  35245. var self=this,$self=this;
  35246. return $core.withContext(function($ctx1) {
  35247. var $1,$2,$4,$3,$receiver;
  35248. $1=$self._outerScope();
  35249. $ctx1.sendIdx["outerScope"]=1;
  35250. if(($receiver = $1) == null || $receiver.a$nil){
  35251. return (1);
  35252. } else {
  35253. $1;
  35254. }
  35255. $2=$self._isInlined();
  35256. if($core.assert($2)){
  35257. $4=$self._outerScope();
  35258. $ctx1.sendIdx["outerScope"]=2;
  35259. $3=$recv($4)._scopeLevel();
  35260. $ctx1.sendIdx["scopeLevel"]=1;
  35261. return $3;
  35262. }
  35263. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  35264. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  35265. },
  35266. args: [],
  35267. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  35268. referencedClasses: [],
  35269. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  35270. }),
  35271. $globals.LexicalScope);
  35272. $core.addMethod(
  35273. $core.method({
  35274. selector: "temps",
  35275. protocol: "accessing",
  35276. fn: function (){
  35277. var self=this,$self=this;
  35278. return $core.withContext(function($ctx1) {
  35279. var $1,$receiver;
  35280. $1=$self["@temps"];
  35281. if(($receiver = $1) == null || $receiver.a$nil){
  35282. $self["@temps"]=$recv($globals.Dictionary)._new();
  35283. return $self["@temps"];
  35284. } else {
  35285. return $1;
  35286. }
  35287. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  35288. },
  35289. args: [],
  35290. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  35291. referencedClasses: ["Dictionary"],
  35292. messageSends: ["ifNil:", "new"]
  35293. }),
  35294. $globals.LexicalScope);
  35295. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  35296. $globals.MethodLexicalScope.comment="I represent a method scope.";
  35297. $core.addMethod(
  35298. $core.method({
  35299. selector: "addIVar:",
  35300. protocol: "adding",
  35301. fn: function (aString){
  35302. var self=this,$self=this;
  35303. return $core.withContext(function($ctx1) {
  35304. var $1;
  35305. $1=$self._iVars();
  35306. $ctx1.sendIdx["iVars"]=1;
  35307. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  35308. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  35309. return self;
  35310. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  35311. },
  35312. args: ["aString"],
  35313. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  35314. referencedClasses: ["InstanceVar"],
  35315. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  35316. }),
  35317. $globals.MethodLexicalScope);
  35318. $core.addMethod(
  35319. $core.method({
  35320. selector: "addNonLocalReturn:",
  35321. protocol: "adding",
  35322. fn: function (aScope){
  35323. var self=this,$self=this;
  35324. return $core.withContext(function($ctx1) {
  35325. $recv($self._nonLocalReturns())._add_(aScope);
  35326. return self;
  35327. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  35328. },
  35329. args: ["aScope"],
  35330. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  35331. referencedClasses: [],
  35332. messageSends: ["add:", "nonLocalReturns"]
  35333. }),
  35334. $globals.MethodLexicalScope);
  35335. $core.addMethod(
  35336. $core.method({
  35337. selector: "allVariableNames",
  35338. protocol: "accessing",
  35339. fn: function (){
  35340. var self=this,$self=this;
  35341. return $core.withContext(function($ctx1) {
  35342. var $1;
  35343. $1=(
  35344. $ctx1.supercall = true,
  35345. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  35346. $ctx1.supercall = false;
  35347. return $recv($1).__comma($recv($self._iVars())._keys());
  35348. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  35349. },
  35350. args: [],
  35351. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  35352. referencedClasses: [],
  35353. messageSends: [",", "allVariableNames", "keys", "iVars"]
  35354. }),
  35355. $globals.MethodLexicalScope);
  35356. $core.addMethod(
  35357. $core.method({
  35358. selector: "bindingFor:",
  35359. protocol: "accessing",
  35360. fn: function (aNode){
  35361. var self=this,$self=this;
  35362. return $core.withContext(function($ctx1) {
  35363. var $1,$receiver;
  35364. $1=(
  35365. $ctx1.supercall = true,
  35366. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  35367. $ctx1.supercall = false;
  35368. if(($receiver = $1) == null || $receiver.a$nil){
  35369. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  35370. return nil;
  35371. }));
  35372. } else {
  35373. return $1;
  35374. }
  35375. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  35376. },
  35377. args: ["aNode"],
  35378. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  35379. referencedClasses: [],
  35380. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  35381. }),
  35382. $globals.MethodLexicalScope);
  35383. $core.addMethod(
  35384. $core.method({
  35385. selector: "canInlineNonLocalReturns",
  35386. protocol: "testing",
  35387. fn: function (){
  35388. var self=this,$self=this;
  35389. return true;
  35390. },
  35391. args: [],
  35392. source: "canInlineNonLocalReturns\x0a\x09^ true",
  35393. referencedClasses: [],
  35394. messageSends: []
  35395. }),
  35396. $globals.MethodLexicalScope);
  35397. $core.addMethod(
  35398. $core.method({
  35399. selector: "hasLocalReturn",
  35400. protocol: "testing",
  35401. fn: function (){
  35402. var self=this,$self=this;
  35403. return $core.withContext(function($ctx1) {
  35404. return $self._localReturn();
  35405. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  35406. },
  35407. args: [],
  35408. source: "hasLocalReturn\x0a\x09^ self localReturn",
  35409. referencedClasses: [],
  35410. messageSends: ["localReturn"]
  35411. }),
  35412. $globals.MethodLexicalScope);
  35413. $core.addMethod(
  35414. $core.method({
  35415. selector: "hasNonLocalReturn",
  35416. protocol: "testing",
  35417. fn: function (){
  35418. var self=this,$self=this;
  35419. return $core.withContext(function($ctx1) {
  35420. return $recv($self._nonLocalReturns())._notEmpty();
  35421. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  35422. },
  35423. args: [],
  35424. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  35425. referencedClasses: [],
  35426. messageSends: ["notEmpty", "nonLocalReturns"]
  35427. }),
  35428. $globals.MethodLexicalScope);
  35429. $core.addMethod(
  35430. $core.method({
  35431. selector: "iVars",
  35432. protocol: "accessing",
  35433. fn: function (){
  35434. var self=this,$self=this;
  35435. return $core.withContext(function($ctx1) {
  35436. var $1,$receiver;
  35437. $1=$self["@iVars"];
  35438. if(($receiver = $1) == null || $receiver.a$nil){
  35439. $self["@iVars"]=$recv($globals.Dictionary)._new();
  35440. return $self["@iVars"];
  35441. } else {
  35442. return $1;
  35443. }
  35444. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  35445. },
  35446. args: [],
  35447. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  35448. referencedClasses: ["Dictionary"],
  35449. messageSends: ["ifNil:", "new"]
  35450. }),
  35451. $globals.MethodLexicalScope);
  35452. $core.addMethod(
  35453. $core.method({
  35454. selector: "isMethodScope",
  35455. protocol: "testing",
  35456. fn: function (){
  35457. var self=this,$self=this;
  35458. return true;
  35459. },
  35460. args: [],
  35461. source: "isMethodScope\x0a\x09^ true",
  35462. referencedClasses: [],
  35463. messageSends: []
  35464. }),
  35465. $globals.MethodLexicalScope);
  35466. $core.addMethod(
  35467. $core.method({
  35468. selector: "localReturn",
  35469. protocol: "accessing",
  35470. fn: function (){
  35471. var self=this,$self=this;
  35472. return $core.withContext(function($ctx1) {
  35473. var $1,$receiver;
  35474. $1=$self["@localReturn"];
  35475. if(($receiver = $1) == null || $receiver.a$nil){
  35476. return false;
  35477. } else {
  35478. return $1;
  35479. }
  35480. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  35481. },
  35482. args: [],
  35483. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  35484. referencedClasses: [],
  35485. messageSends: ["ifNil:"]
  35486. }),
  35487. $globals.MethodLexicalScope);
  35488. $core.addMethod(
  35489. $core.method({
  35490. selector: "localReturn:",
  35491. protocol: "accessing",
  35492. fn: function (aBoolean){
  35493. var self=this,$self=this;
  35494. $self["@localReturn"]=aBoolean;
  35495. return self;
  35496. },
  35497. args: ["aBoolean"],
  35498. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  35499. referencedClasses: [],
  35500. messageSends: []
  35501. }),
  35502. $globals.MethodLexicalScope);
  35503. $core.addMethod(
  35504. $core.method({
  35505. selector: "methodScope",
  35506. protocol: "accessing",
  35507. fn: function (){
  35508. var self=this,$self=this;
  35509. return self;
  35510. },
  35511. args: [],
  35512. source: "methodScope\x0a\x09^ self",
  35513. referencedClasses: [],
  35514. messageSends: []
  35515. }),
  35516. $globals.MethodLexicalScope);
  35517. $core.addMethod(
  35518. $core.method({
  35519. selector: "nonLocalReturns",
  35520. protocol: "accessing",
  35521. fn: function (){
  35522. var self=this,$self=this;
  35523. return $core.withContext(function($ctx1) {
  35524. var $1,$receiver;
  35525. $1=$self["@nonLocalReturns"];
  35526. if(($receiver = $1) == null || $receiver.a$nil){
  35527. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  35528. return $self["@nonLocalReturns"];
  35529. } else {
  35530. return $1;
  35531. }
  35532. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  35533. },
  35534. args: [],
  35535. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  35536. referencedClasses: ["OrderedCollection"],
  35537. messageSends: ["ifNil:", "new"]
  35538. }),
  35539. $globals.MethodLexicalScope);
  35540. $core.addMethod(
  35541. $core.method({
  35542. selector: "pseudoVars",
  35543. protocol: "accessing",
  35544. fn: function (){
  35545. var self=this,$self=this;
  35546. return $core.withContext(function($ctx1) {
  35547. var $1,$2,$4,$3,$receiver;
  35548. $1=$self["@pseudoVars"];
  35549. if(($receiver = $1) == null || $receiver.a$nil){
  35550. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  35551. $self["@pseudoVars"];
  35552. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  35553. return $core.withContext(function($ctx2) {
  35554. $2=$self["@pseudoVars"];
  35555. $4=$recv($globals.PseudoVar)._on_(each);
  35556. $recv($4)._scope_($self._methodScope());
  35557. $3=$recv($4)._yourself();
  35558. return $recv($2)._at_put_(each,$3);
  35559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35560. }));
  35561. } else {
  35562. $1;
  35563. }
  35564. return $self["@pseudoVars"];
  35565. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  35566. },
  35567. args: [],
  35568. source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk 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",
  35569. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  35570. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  35571. }),
  35572. $globals.MethodLexicalScope);
  35573. $core.addMethod(
  35574. $core.method({
  35575. selector: "removeNonLocalReturn:",
  35576. protocol: "adding",
  35577. fn: function (aScope){
  35578. var self=this,$self=this;
  35579. return $core.withContext(function($ctx1) {
  35580. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  35581. }));
  35582. return self;
  35583. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  35584. },
  35585. args: ["aScope"],
  35586. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  35587. referencedClasses: [],
  35588. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  35589. }),
  35590. $globals.MethodLexicalScope);
  35591. $core.addMethod(
  35592. $core.method({
  35593. selector: "unknownVariables",
  35594. protocol: "accessing",
  35595. fn: function (){
  35596. var self=this,$self=this;
  35597. return $core.withContext(function($ctx1) {
  35598. var $1,$receiver;
  35599. $1=$self["@unknownVariables"];
  35600. if(($receiver = $1) == null || $receiver.a$nil){
  35601. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  35602. return $self["@unknownVariables"];
  35603. } else {
  35604. return $1;
  35605. }
  35606. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  35607. },
  35608. args: [],
  35609. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  35610. referencedClasses: ["OrderedCollection"],
  35611. messageSends: ["ifNil:", "new"]
  35612. }),
  35613. $globals.MethodLexicalScope);
  35614. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  35615. $globals.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.";
  35616. $core.addMethod(
  35617. $core.method({
  35618. selector: "alias",
  35619. protocol: "accessing",
  35620. fn: function (){
  35621. var self=this,$self=this;
  35622. return $core.withContext(function($ctx1) {
  35623. return $recv($self._name())._asVariableName();
  35624. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  35625. },
  35626. args: [],
  35627. source: "alias\x0a\x09^ self name asVariableName",
  35628. referencedClasses: [],
  35629. messageSends: ["asVariableName", "name"]
  35630. }),
  35631. $globals.ScopeVar);
  35632. $core.addMethod(
  35633. $core.method({
  35634. selector: "isArgVar",
  35635. protocol: "testing",
  35636. fn: function (){
  35637. var self=this,$self=this;
  35638. return false;
  35639. },
  35640. args: [],
  35641. source: "isArgVar\x0a\x09^ false",
  35642. referencedClasses: [],
  35643. messageSends: []
  35644. }),
  35645. $globals.ScopeVar);
  35646. $core.addMethod(
  35647. $core.method({
  35648. selector: "isClassRefVar",
  35649. protocol: "testing",
  35650. fn: function (){
  35651. var self=this,$self=this;
  35652. return false;
  35653. },
  35654. args: [],
  35655. source: "isClassRefVar\x0a\x09^ false",
  35656. referencedClasses: [],
  35657. messageSends: []
  35658. }),
  35659. $globals.ScopeVar);
  35660. $core.addMethod(
  35661. $core.method({
  35662. selector: "isImmutable",
  35663. protocol: "testing",
  35664. fn: function (){
  35665. var self=this,$self=this;
  35666. return false;
  35667. },
  35668. args: [],
  35669. source: "isImmutable\x0a\x09^ false",
  35670. referencedClasses: [],
  35671. messageSends: []
  35672. }),
  35673. $globals.ScopeVar);
  35674. $core.addMethod(
  35675. $core.method({
  35676. selector: "isInstanceVar",
  35677. protocol: "testing",
  35678. fn: function (){
  35679. var self=this,$self=this;
  35680. return false;
  35681. },
  35682. args: [],
  35683. source: "isInstanceVar\x0a\x09^ false",
  35684. referencedClasses: [],
  35685. messageSends: []
  35686. }),
  35687. $globals.ScopeVar);
  35688. $core.addMethod(
  35689. $core.method({
  35690. selector: "isPseudoVar",
  35691. protocol: "testing",
  35692. fn: function (){
  35693. var self=this,$self=this;
  35694. return false;
  35695. },
  35696. args: [],
  35697. source: "isPseudoVar\x0a\x09^ false",
  35698. referencedClasses: [],
  35699. messageSends: []
  35700. }),
  35701. $globals.ScopeVar);
  35702. $core.addMethod(
  35703. $core.method({
  35704. selector: "isSelf",
  35705. protocol: "testing",
  35706. fn: function (){
  35707. var self=this,$self=this;
  35708. return false;
  35709. },
  35710. args: [],
  35711. source: "isSelf\x0a\x09^ false",
  35712. referencedClasses: [],
  35713. messageSends: []
  35714. }),
  35715. $globals.ScopeVar);
  35716. $core.addMethod(
  35717. $core.method({
  35718. selector: "isSuper",
  35719. protocol: "testing",
  35720. fn: function (){
  35721. var self=this,$self=this;
  35722. return false;
  35723. },
  35724. args: [],
  35725. source: "isSuper\x0a\x09^ false",
  35726. referencedClasses: [],
  35727. messageSends: []
  35728. }),
  35729. $globals.ScopeVar);
  35730. $core.addMethod(
  35731. $core.method({
  35732. selector: "isTempVar",
  35733. protocol: "testing",
  35734. fn: function (){
  35735. var self=this,$self=this;
  35736. return false;
  35737. },
  35738. args: [],
  35739. source: "isTempVar\x0a\x09^ false",
  35740. referencedClasses: [],
  35741. messageSends: []
  35742. }),
  35743. $globals.ScopeVar);
  35744. $core.addMethod(
  35745. $core.method({
  35746. selector: "isUnknownVar",
  35747. protocol: "testing",
  35748. fn: function (){
  35749. var self=this,$self=this;
  35750. return false;
  35751. },
  35752. args: [],
  35753. source: "isUnknownVar\x0a\x09^ false",
  35754. referencedClasses: [],
  35755. messageSends: []
  35756. }),
  35757. $globals.ScopeVar);
  35758. $core.addMethod(
  35759. $core.method({
  35760. selector: "name",
  35761. protocol: "accessing",
  35762. fn: function (){
  35763. var self=this,$self=this;
  35764. return $self["@name"];
  35765. },
  35766. args: [],
  35767. source: "name\x0a\x09^ name",
  35768. referencedClasses: [],
  35769. messageSends: []
  35770. }),
  35771. $globals.ScopeVar);
  35772. $core.addMethod(
  35773. $core.method({
  35774. selector: "name:",
  35775. protocol: "accessing",
  35776. fn: function (aString){
  35777. var self=this,$self=this;
  35778. $self["@name"]=aString;
  35779. return self;
  35780. },
  35781. args: ["aString"],
  35782. source: "name: aString\x0a\x09name := aString",
  35783. referencedClasses: [],
  35784. messageSends: []
  35785. }),
  35786. $globals.ScopeVar);
  35787. $core.addMethod(
  35788. $core.method({
  35789. selector: "scope",
  35790. protocol: "accessing",
  35791. fn: function (){
  35792. var self=this,$self=this;
  35793. return $self["@scope"];
  35794. },
  35795. args: [],
  35796. source: "scope\x0a\x09^ scope",
  35797. referencedClasses: [],
  35798. messageSends: []
  35799. }),
  35800. $globals.ScopeVar);
  35801. $core.addMethod(
  35802. $core.method({
  35803. selector: "scope:",
  35804. protocol: "accessing",
  35805. fn: function (aScope){
  35806. var self=this,$self=this;
  35807. $self["@scope"]=aScope;
  35808. return self;
  35809. },
  35810. args: ["aScope"],
  35811. source: "scope: aScope\x0a\x09scope := aScope",
  35812. referencedClasses: [],
  35813. messageSends: []
  35814. }),
  35815. $globals.ScopeVar);
  35816. $core.addMethod(
  35817. $core.method({
  35818. selector: "validateAssignment",
  35819. protocol: "testing",
  35820. fn: function (){
  35821. var self=this,$self=this;
  35822. return $core.withContext(function($ctx1) {
  35823. var $1,$2;
  35824. $1=$recv($self._isArgVar())._or_((function(){
  35825. return $core.withContext(function($ctx2) {
  35826. return $self._isPseudoVar();
  35827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35828. }));
  35829. if($core.assert($1)){
  35830. $2=$recv($globals.InvalidAssignmentError)._new();
  35831. $recv($2)._variableName_($self._name());
  35832. $recv($2)._signal();
  35833. }
  35834. return self;
  35835. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  35836. },
  35837. args: [],
  35838. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  35839. referencedClasses: ["InvalidAssignmentError"],
  35840. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  35841. }),
  35842. $globals.ScopeVar);
  35843. $core.addMethod(
  35844. $core.method({
  35845. selector: "on:",
  35846. protocol: "instance creation",
  35847. fn: function (aString){
  35848. var self=this,$self=this;
  35849. return $core.withContext(function($ctx1) {
  35850. var $1;
  35851. $1=$self._new();
  35852. $recv($1)._name_(aString);
  35853. return $recv($1)._yourself();
  35854. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  35855. },
  35856. args: ["aString"],
  35857. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  35858. referencedClasses: [],
  35859. messageSends: ["name:", "new", "yourself"]
  35860. }),
  35861. $globals.ScopeVar.a$cls);
  35862. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  35863. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  35864. $core.addMethod(
  35865. $core.method({
  35866. selector: "isImmutable",
  35867. protocol: "testing",
  35868. fn: function (){
  35869. var self=this,$self=this;
  35870. return true;
  35871. },
  35872. args: [],
  35873. source: "isImmutable\x0a\x09^ true",
  35874. referencedClasses: [],
  35875. messageSends: []
  35876. }),
  35877. $globals.AliasVar);
  35878. $core.addMethod(
  35879. $core.method({
  35880. selector: "node",
  35881. protocol: "accessing",
  35882. fn: function (){
  35883. var self=this,$self=this;
  35884. return $self["@node"];
  35885. },
  35886. args: [],
  35887. source: "node\x0a\x09^ node",
  35888. referencedClasses: [],
  35889. messageSends: []
  35890. }),
  35891. $globals.AliasVar);
  35892. $core.addMethod(
  35893. $core.method({
  35894. selector: "node:",
  35895. protocol: "accessing",
  35896. fn: function (aNode){
  35897. var self=this,$self=this;
  35898. $self["@node"]=aNode;
  35899. return self;
  35900. },
  35901. args: ["aNode"],
  35902. source: "node: aNode\x0a\x09node := aNode",
  35903. referencedClasses: [],
  35904. messageSends: []
  35905. }),
  35906. $globals.AliasVar);
  35907. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  35908. $globals.ArgVar.comment="I am an argument of a method or block.";
  35909. $core.addMethod(
  35910. $core.method({
  35911. selector: "isArgVar",
  35912. protocol: "testing",
  35913. fn: function (){
  35914. var self=this,$self=this;
  35915. return true;
  35916. },
  35917. args: [],
  35918. source: "isArgVar\x0a\x09^ true",
  35919. referencedClasses: [],
  35920. messageSends: []
  35921. }),
  35922. $globals.ArgVar);
  35923. $core.addMethod(
  35924. $core.method({
  35925. selector: "isImmutable",
  35926. protocol: "testing",
  35927. fn: function (){
  35928. var self=this,$self=this;
  35929. return true;
  35930. },
  35931. args: [],
  35932. source: "isImmutable\x0a\x09^ true",
  35933. referencedClasses: [],
  35934. messageSends: []
  35935. }),
  35936. $globals.ArgVar);
  35937. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  35938. $globals.ClassRefVar.comment="I am an class reference variable";
  35939. $core.addMethod(
  35940. $core.method({
  35941. selector: "alias",
  35942. protocol: "accessing",
  35943. fn: function (){
  35944. var self=this,$self=this;
  35945. return $core.withContext(function($ctx1) {
  35946. return "$globals.".__comma($self._name());
  35947. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  35948. },
  35949. args: [],
  35950. 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^ '$globals.', self name",
  35951. referencedClasses: [],
  35952. messageSends: [",", "name"]
  35953. }),
  35954. $globals.ClassRefVar);
  35955. $core.addMethod(
  35956. $core.method({
  35957. selector: "isClassRefVar",
  35958. protocol: "testing",
  35959. fn: function (){
  35960. var self=this,$self=this;
  35961. return true;
  35962. },
  35963. args: [],
  35964. source: "isClassRefVar\x0a\x09^ true",
  35965. referencedClasses: [],
  35966. messageSends: []
  35967. }),
  35968. $globals.ClassRefVar);
  35969. $core.addMethod(
  35970. $core.method({
  35971. selector: "isImmutable",
  35972. protocol: "testing",
  35973. fn: function (){
  35974. var self=this,$self=this;
  35975. return true;
  35976. },
  35977. args: [],
  35978. source: "isImmutable\x0a\x09^ true",
  35979. referencedClasses: [],
  35980. messageSends: []
  35981. }),
  35982. $globals.ClassRefVar);
  35983. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  35984. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  35985. $core.addMethod(
  35986. $core.method({
  35987. selector: "alias",
  35988. protocol: "testing",
  35989. fn: function (){
  35990. var self=this,$self=this;
  35991. return $core.withContext(function($ctx1) {
  35992. var $1;
  35993. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  35994. $ctx1.sendIdx[","]=1;
  35995. return $1;
  35996. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  35997. },
  35998. args: [],
  35999. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  36000. referencedClasses: [],
  36001. messageSends: [",", "name"]
  36002. }),
  36003. $globals.InstanceVar);
  36004. $core.addMethod(
  36005. $core.method({
  36006. selector: "isInstanceVar",
  36007. protocol: "testing",
  36008. fn: function (){
  36009. var self=this,$self=this;
  36010. return true;
  36011. },
  36012. args: [],
  36013. source: "isInstanceVar\x0a\x09^ true",
  36014. referencedClasses: [],
  36015. messageSends: []
  36016. }),
  36017. $globals.InstanceVar);
  36018. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36019. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  36020. $core.addMethod(
  36021. $core.method({
  36022. selector: "alias",
  36023. protocol: "accessing",
  36024. fn: function (){
  36025. var self=this,$self=this;
  36026. return $core.withContext(function($ctx1) {
  36027. return $self._name();
  36028. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  36029. },
  36030. args: [],
  36031. source: "alias\x0a\x09^ self name",
  36032. referencedClasses: [],
  36033. messageSends: ["name"]
  36034. }),
  36035. $globals.PseudoVar);
  36036. $core.addMethod(
  36037. $core.method({
  36038. selector: "isImmutable",
  36039. protocol: "testing",
  36040. fn: function (){
  36041. var self=this,$self=this;
  36042. return true;
  36043. },
  36044. args: [],
  36045. source: "isImmutable\x0a\x09^ true",
  36046. referencedClasses: [],
  36047. messageSends: []
  36048. }),
  36049. $globals.PseudoVar);
  36050. $core.addMethod(
  36051. $core.method({
  36052. selector: "isPseudoVar",
  36053. protocol: "testing",
  36054. fn: function (){
  36055. var self=this,$self=this;
  36056. return true;
  36057. },
  36058. args: [],
  36059. source: "isPseudoVar\x0a\x09^ true",
  36060. referencedClasses: [],
  36061. messageSends: []
  36062. }),
  36063. $globals.PseudoVar);
  36064. $core.addMethod(
  36065. $core.method({
  36066. selector: "isSelf",
  36067. protocol: "testing",
  36068. fn: function (){
  36069. var self=this,$self=this;
  36070. return $core.withContext(function($ctx1) {
  36071. return $recv($self["@name"]).__eq("self");
  36072. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  36073. },
  36074. args: [],
  36075. source: "isSelf\x0a\x09^ name = 'self'",
  36076. referencedClasses: [],
  36077. messageSends: ["="]
  36078. }),
  36079. $globals.PseudoVar);
  36080. $core.addMethod(
  36081. $core.method({
  36082. selector: "isSuper",
  36083. protocol: "testing",
  36084. fn: function (){
  36085. var self=this,$self=this;
  36086. return $core.withContext(function($ctx1) {
  36087. return $recv($self["@name"]).__eq("super");
  36088. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  36089. },
  36090. args: [],
  36091. source: "isSuper\x0a\x09^ name = 'super'",
  36092. referencedClasses: [],
  36093. messageSends: ["="]
  36094. }),
  36095. $globals.PseudoVar);
  36096. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36097. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  36098. $core.addMethod(
  36099. $core.method({
  36100. selector: "isTempVar",
  36101. protocol: "testing",
  36102. fn: function (){
  36103. var self=this,$self=this;
  36104. return true;
  36105. },
  36106. args: [],
  36107. source: "isTempVar\x0a\x09^ true",
  36108. referencedClasses: [],
  36109. messageSends: []
  36110. }),
  36111. $globals.TempVar);
  36112. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36113. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  36114. $core.addMethod(
  36115. $core.method({
  36116. selector: "isUnknownVar",
  36117. protocol: "testing",
  36118. fn: function (){
  36119. var self=this,$self=this;
  36120. return true;
  36121. },
  36122. args: [],
  36123. source: "isUnknownVar\x0a\x09^ true",
  36124. referencedClasses: [],
  36125. messageSends: []
  36126. }),
  36127. $globals.UnknownVar);
  36128. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  36129. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  36130. $core.addMethod(
  36131. $core.method({
  36132. selector: "classReferences",
  36133. protocol: "accessing",
  36134. fn: function (){
  36135. var self=this,$self=this;
  36136. return $core.withContext(function($ctx1) {
  36137. var $1,$receiver;
  36138. $1=$self["@classReferences"];
  36139. if(($receiver = $1) == null || $receiver.a$nil){
  36140. $self["@classReferences"]=$recv($globals.Set)._new();
  36141. return $self["@classReferences"];
  36142. } else {
  36143. return $1;
  36144. }
  36145. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  36146. },
  36147. args: [],
  36148. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  36149. referencedClasses: ["Set"],
  36150. messageSends: ["ifNil:", "new"]
  36151. }),
  36152. $globals.SemanticAnalyzer);
  36153. $core.addMethod(
  36154. $core.method({
  36155. selector: "errorShadowingVariable:",
  36156. protocol: "error handling",
  36157. fn: function (aString){
  36158. var self=this,$self=this;
  36159. return $core.withContext(function($ctx1) {
  36160. var $1;
  36161. $1=$recv($globals.ShadowingVariableError)._new();
  36162. $recv($1)._variableName_(aString);
  36163. $recv($1)._signal();
  36164. return self;
  36165. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  36166. },
  36167. args: ["aString"],
  36168. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  36169. referencedClasses: ["ShadowingVariableError"],
  36170. messageSends: ["variableName:", "new", "signal"]
  36171. }),
  36172. $globals.SemanticAnalyzer);
  36173. $core.addMethod(
  36174. $core.method({
  36175. selector: "errorUnknownVariable:",
  36176. protocol: "error handling",
  36177. fn: function (aNode){
  36178. var self=this,$self=this;
  36179. var identifier;
  36180. return $core.withContext(function($ctx1) {
  36181. var $1,$2,$3;
  36182. identifier=$recv(aNode)._value();
  36183. $ctx1.sendIdx["value"]=1;
  36184. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  36185. return $core.withContext(function($ctx2) {
  36186. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  36187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36188. }));
  36189. if($core.assert($1)){
  36190. $2=$recv($globals.UnknownVariableError)._new();
  36191. $3=$recv(aNode)._value();
  36192. $ctx1.sendIdx["value"]=2;
  36193. $recv($2)._variableName_($3);
  36194. $recv($2)._signal();
  36195. } else {
  36196. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  36197. }
  36198. return self;
  36199. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  36200. },
  36201. args: ["aNode"],
  36202. 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: `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 globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableUndefined: identifier inPackage: self thePackage ])\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 ]",
  36203. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  36204. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  36205. }),
  36206. $globals.SemanticAnalyzer);
  36207. $core.addMethod(
  36208. $core.method({
  36209. selector: "isVariableUndefined:inPackage:",
  36210. protocol: "testing",
  36211. fn: function (aString,aPackage){
  36212. var self=this,$self=this;
  36213. return $core.withContext(function($ctx1) {
  36214. var $1,$2,$3,$receiver;
  36215. if(($receiver = aPackage) == null || $receiver.a$nil){
  36216. aPackage;
  36217. } else {
  36218. var packageKnownVars;
  36219. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  36220. packageKnownVars;
  36221. $1=$recv(packageKnownVars)._includes_(aString);
  36222. if($core.assert($1)){
  36223. return false;
  36224. }
  36225. }
  36226. $2=$recv($globals.Compiler)._new();
  36227. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  36228. $ctx1.sendIdx[","]=1;
  36229. return $recv($2)._eval_($3);
  36230. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  36231. },
  36232. args: ["aString", "aPackage"],
  36233. source: "isVariableUndefined: aString inPackage: aPackage\x0a\x09aPackage ifNotNil: [\x0a\x09\x09| packageKnownVars |\x0a\x09\x09packageKnownVars := (aPackage imports\x0a\x09\x09\x09reject: #isString)\x0a\x09\x09\x09collect: #key.\x0a\x09\x09(packageKnownVars includes: aString) ifTrue: [ ^ false ]].\x0a\x09^ Compiler new\x0a\x09\x09eval: 'typeof ', aString, ' == \x22undefined\x22'",
  36234. referencedClasses: ["Compiler"],
  36235. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  36236. }),
  36237. $globals.SemanticAnalyzer);
  36238. $core.addMethod(
  36239. $core.method({
  36240. selector: "messageSends",
  36241. protocol: "accessing",
  36242. fn: function (){
  36243. var self=this,$self=this;
  36244. return $core.withContext(function($ctx1) {
  36245. var $1,$receiver;
  36246. $1=$self["@messageSends"];
  36247. if(($receiver = $1) == null || $receiver.a$nil){
  36248. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  36249. return $self["@messageSends"];
  36250. } else {
  36251. return $1;
  36252. }
  36253. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  36254. },
  36255. args: [],
  36256. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  36257. referencedClasses: ["Dictionary"],
  36258. messageSends: ["ifNil:", "new"]
  36259. }),
  36260. $globals.SemanticAnalyzer);
  36261. $core.addMethod(
  36262. $core.method({
  36263. selector: "newBlockScope",
  36264. protocol: "factory",
  36265. fn: function (){
  36266. var self=this,$self=this;
  36267. return $core.withContext(function($ctx1) {
  36268. return $self._newScopeOfClass_($globals.LexicalScope);
  36269. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  36270. },
  36271. args: [],
  36272. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  36273. referencedClasses: ["LexicalScope"],
  36274. messageSends: ["newScopeOfClass:"]
  36275. }),
  36276. $globals.SemanticAnalyzer);
  36277. $core.addMethod(
  36278. $core.method({
  36279. selector: "newMethodScope",
  36280. protocol: "factory",
  36281. fn: function (){
  36282. var self=this,$self=this;
  36283. return $core.withContext(function($ctx1) {
  36284. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  36285. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  36286. },
  36287. args: [],
  36288. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  36289. referencedClasses: ["MethodLexicalScope"],
  36290. messageSends: ["newScopeOfClass:"]
  36291. }),
  36292. $globals.SemanticAnalyzer);
  36293. $core.addMethod(
  36294. $core.method({
  36295. selector: "newScopeOfClass:",
  36296. protocol: "factory",
  36297. fn: function (aLexicalScopeClass){
  36298. var self=this,$self=this;
  36299. return $core.withContext(function($ctx1) {
  36300. var $1;
  36301. $1=$recv(aLexicalScopeClass)._new();
  36302. $recv($1)._outerScope_($self["@currentScope"]);
  36303. return $recv($1)._yourself();
  36304. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  36305. },
  36306. args: ["aLexicalScopeClass"],
  36307. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  36308. referencedClasses: [],
  36309. messageSends: ["outerScope:", "new", "yourself"]
  36310. }),
  36311. $globals.SemanticAnalyzer);
  36312. $core.addMethod(
  36313. $core.method({
  36314. selector: "nextBlockIndex",
  36315. protocol: "private",
  36316. fn: function (){
  36317. var self=this,$self=this;
  36318. return $core.withContext(function($ctx1) {
  36319. var $1,$receiver;
  36320. $1=$self["@blockIndex"];
  36321. if(($receiver = $1) == null || $receiver.a$nil){
  36322. $self["@blockIndex"]=(0);
  36323. $self["@blockIndex"];
  36324. } else {
  36325. $1;
  36326. }
  36327. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  36328. return $self["@blockIndex"];
  36329. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  36330. },
  36331. args: [],
  36332. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  36333. referencedClasses: [],
  36334. messageSends: ["ifNil:", "+"]
  36335. }),
  36336. $globals.SemanticAnalyzer);
  36337. $core.addMethod(
  36338. $core.method({
  36339. selector: "popScope",
  36340. protocol: "scope",
  36341. fn: function (){
  36342. var self=this,$self=this;
  36343. return $core.withContext(function($ctx1) {
  36344. var $1,$receiver;
  36345. $1=$self["@currentScope"];
  36346. if(($receiver = $1) == null || $receiver.a$nil){
  36347. $1;
  36348. } else {
  36349. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  36350. $self["@currentScope"];
  36351. }
  36352. return self;
  36353. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  36354. },
  36355. args: [],
  36356. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  36357. referencedClasses: [],
  36358. messageSends: ["ifNotNil:", "outerScope"]
  36359. }),
  36360. $globals.SemanticAnalyzer);
  36361. $core.addMethod(
  36362. $core.method({
  36363. selector: "pushScope:",
  36364. protocol: "scope",
  36365. fn: function (aScope){
  36366. var self=this,$self=this;
  36367. return $core.withContext(function($ctx1) {
  36368. $recv(aScope)._outerScope_($self["@currentScope"]);
  36369. $self["@currentScope"]=aScope;
  36370. return self;
  36371. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  36372. },
  36373. args: ["aScope"],
  36374. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  36375. referencedClasses: [],
  36376. messageSends: ["outerScope:"]
  36377. }),
  36378. $globals.SemanticAnalyzer);
  36379. $core.addMethod(
  36380. $core.method({
  36381. selector: "theClass",
  36382. protocol: "accessing",
  36383. fn: function (){
  36384. var self=this,$self=this;
  36385. return $self["@theClass"];
  36386. },
  36387. args: [],
  36388. source: "theClass\x0a\x09^ theClass",
  36389. referencedClasses: [],
  36390. messageSends: []
  36391. }),
  36392. $globals.SemanticAnalyzer);
  36393. $core.addMethod(
  36394. $core.method({
  36395. selector: "theClass:",
  36396. protocol: "accessing",
  36397. fn: function (aClass){
  36398. var self=this,$self=this;
  36399. $self["@theClass"]=aClass;
  36400. return self;
  36401. },
  36402. args: ["aClass"],
  36403. source: "theClass: aClass\x0a\x09theClass := aClass",
  36404. referencedClasses: [],
  36405. messageSends: []
  36406. }),
  36407. $globals.SemanticAnalyzer);
  36408. $core.addMethod(
  36409. $core.method({
  36410. selector: "thePackage",
  36411. protocol: "accessing",
  36412. fn: function (){
  36413. var self=this,$self=this;
  36414. return $self["@thePackage"];
  36415. },
  36416. args: [],
  36417. source: "thePackage\x0a\x09^ thePackage",
  36418. referencedClasses: [],
  36419. messageSends: []
  36420. }),
  36421. $globals.SemanticAnalyzer);
  36422. $core.addMethod(
  36423. $core.method({
  36424. selector: "thePackage:",
  36425. protocol: "accessing",
  36426. fn: function (aPackage){
  36427. var self=this,$self=this;
  36428. $self["@thePackage"]=aPackage;
  36429. return self;
  36430. },
  36431. args: ["aPackage"],
  36432. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  36433. referencedClasses: [],
  36434. messageSends: []
  36435. }),
  36436. $globals.SemanticAnalyzer);
  36437. $core.addMethod(
  36438. $core.method({
  36439. selector: "validateVariableScope:",
  36440. protocol: "scope",
  36441. fn: function (aString){
  36442. var self=this,$self=this;
  36443. return $core.withContext(function($ctx1) {
  36444. var $1,$receiver;
  36445. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  36446. if(($receiver = $1) == null || $receiver.a$nil){
  36447. $1;
  36448. } else {
  36449. $self._errorShadowingVariable_(aString);
  36450. }
  36451. return self;
  36452. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  36453. },
  36454. args: ["aString"],
  36455. 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 ]",
  36456. referencedClasses: [],
  36457. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  36458. }),
  36459. $globals.SemanticAnalyzer);
  36460. $core.addMethod(
  36461. $core.method({
  36462. selector: "visitAssignmentNode:",
  36463. protocol: "visiting",
  36464. fn: function (aNode){
  36465. var self=this,$self=this;
  36466. return $core.withContext(function($ctx1) {
  36467. (
  36468. $ctx1.supercall = true,
  36469. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  36470. $ctx1.supercall = false;
  36471. $recv($recv(aNode)._left())._beAssigned();
  36472. return self;
  36473. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36474. },
  36475. args: ["aNode"],
  36476. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  36477. referencedClasses: [],
  36478. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  36479. }),
  36480. $globals.SemanticAnalyzer);
  36481. $core.addMethod(
  36482. $core.method({
  36483. selector: "visitBlockNode:",
  36484. protocol: "visiting",
  36485. fn: function (aNode){
  36486. var self=this,$self=this;
  36487. return $core.withContext(function($ctx1) {
  36488. $self._pushScope_($self._newBlockScope());
  36489. $recv(aNode)._scope_($self["@currentScope"]);
  36490. $recv($self["@currentScope"])._node_(aNode);
  36491. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  36492. $recv($recv(aNode)._parameters())._do_((function(each){
  36493. return $core.withContext(function($ctx2) {
  36494. $self._validateVariableScope_(each);
  36495. return $recv($self["@currentScope"])._addArg_(each);
  36496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36497. }));
  36498. (
  36499. $ctx1.supercall = true,
  36500. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  36501. $ctx1.supercall = false;
  36502. $self._popScope();
  36503. return self;
  36504. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36505. },
  36506. args: ["aNode"],
  36507. source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09currentScope blockIndex: self nextBlockIndex.\x0a\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
  36508. referencedClasses: [],
  36509. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  36510. }),
  36511. $globals.SemanticAnalyzer);
  36512. $core.addMethod(
  36513. $core.method({
  36514. selector: "visitCascadeNode:",
  36515. protocol: "visiting",
  36516. fn: function (aNode){
  36517. var self=this,$self=this;
  36518. return $core.withContext(function($ctx1) {
  36519. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  36520. (
  36521. $ctx1.supercall = true,
  36522. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  36523. $ctx1.supercall = false;
  36524. return self;
  36525. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36526. },
  36527. args: ["aNode"],
  36528. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  36529. referencedClasses: [],
  36530. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  36531. }),
  36532. $globals.SemanticAnalyzer);
  36533. $core.addMethod(
  36534. $core.method({
  36535. selector: "visitMethodNode:",
  36536. protocol: "visiting",
  36537. fn: function (aNode){
  36538. var self=this,$self=this;
  36539. return $core.withContext(function($ctx1) {
  36540. $self._pushScope_($self._newMethodScope());
  36541. $recv(aNode)._scope_($self["@currentScope"]);
  36542. $recv($self["@currentScope"])._node_(aNode);
  36543. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  36544. return $core.withContext(function($ctx2) {
  36545. return $recv($self["@currentScope"])._addIVar_(each);
  36546. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36547. }));
  36548. $ctx1.sendIdx["do:"]=1;
  36549. $recv($recv(aNode)._arguments())._do_((function(each){
  36550. return $core.withContext(function($ctx2) {
  36551. $self._validateVariableScope_(each);
  36552. return $recv($self["@currentScope"])._addArg_(each);
  36553. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36554. }));
  36555. (
  36556. $ctx1.supercall = true,
  36557. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  36558. $ctx1.supercall = false;
  36559. $recv(aNode)._classReferences_($self._classReferences());
  36560. $recv(aNode)._sendIndexes_($self._messageSends());
  36561. $self._popScope();
  36562. return aNode;
  36563. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36564. },
  36565. args: ["aNode"],
  36566. 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\x09sendIndexes: self messageSends.\x0a\x09self popScope.\x0a\x09^ aNode",
  36567. referencedClasses: [],
  36568. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  36569. }),
  36570. $globals.SemanticAnalyzer);
  36571. $core.addMethod(
  36572. $core.method({
  36573. selector: "visitReturnNode:",
  36574. protocol: "visiting",
  36575. fn: function (aNode){
  36576. var self=this,$self=this;
  36577. return $core.withContext(function($ctx1) {
  36578. var $1;
  36579. $recv(aNode)._scope_($self["@currentScope"]);
  36580. $1=$recv($self["@currentScope"])._isMethodScope();
  36581. if($core.assert($1)){
  36582. $recv($self["@currentScope"])._localReturn_(true);
  36583. } else {
  36584. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  36585. }
  36586. (
  36587. $ctx1.supercall = true,
  36588. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  36589. $ctx1.supercall = false;
  36590. return self;
  36591. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36592. },
  36593. args: ["aNode"],
  36594. 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",
  36595. referencedClasses: [],
  36596. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  36597. }),
  36598. $globals.SemanticAnalyzer);
  36599. $core.addMethod(
  36600. $core.method({
  36601. selector: "visitSendNode:",
  36602. protocol: "visiting",
  36603. fn: function (aNode){
  36604. var self=this,$self=this;
  36605. var sends;
  36606. return $core.withContext(function($ctx1) {
  36607. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  36608. return $core.withContext(function($ctx2) {
  36609. return $recv($globals.OrderedCollection)._new();
  36610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36611. }));
  36612. $recv(sends)._add_(aNode);
  36613. $recv(aNode)._index_($recv(sends)._size());
  36614. (
  36615. $ctx1.supercall = true,
  36616. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  36617. $ctx1.supercall = false;
  36618. return self;
  36619. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  36620. },
  36621. args: ["aNode"],
  36622. source: "visitSendNode: aNode\x0a\x0a\x09| sends |\x0a\x09sends := self messageSends at: aNode selector ifAbsentPut: [ OrderedCollection new ].\x0a\x09sends add: aNode.\x0a\x0a\x09aNode index: sends size.\x0a\x0a\x09super visitSendNode: aNode",
  36623. referencedClasses: ["OrderedCollection"],
  36624. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  36625. }),
  36626. $globals.SemanticAnalyzer);
  36627. $core.addMethod(
  36628. $core.method({
  36629. selector: "visitSequenceNode:",
  36630. protocol: "visiting",
  36631. fn: function (aNode){
  36632. var self=this,$self=this;
  36633. return $core.withContext(function($ctx1) {
  36634. $recv($recv(aNode)._temps())._do_((function(each){
  36635. return $core.withContext(function($ctx2) {
  36636. $self._validateVariableScope_(each);
  36637. return $recv($self["@currentScope"])._addTemp_(each);
  36638. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36639. }));
  36640. (
  36641. $ctx1.supercall = true,
  36642. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  36643. $ctx1.supercall = false;
  36644. return self;
  36645. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36646. },
  36647. args: ["aNode"],
  36648. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  36649. referencedClasses: [],
  36650. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  36651. }),
  36652. $globals.SemanticAnalyzer);
  36653. $core.addMethod(
  36654. $core.method({
  36655. selector: "visitVariableNode:",
  36656. protocol: "visiting",
  36657. fn: function (aNode){
  36658. var self=this,$self=this;
  36659. var binding;
  36660. return $core.withContext(function($ctx1) {
  36661. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  36662. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  36663. $1=binding;
  36664. if(($receiver = $1) == null || $receiver.a$nil){
  36665. $3=$recv(aNode)._value();
  36666. $ctx1.sendIdx["value"]=1;
  36667. $2=$recv($3)._isCapitalized();
  36668. if($core.assert($2)){
  36669. $4=$recv($globals.ClassRefVar)._new();
  36670. $ctx1.sendIdx["new"]=1;
  36671. $5=$recv(aNode)._value();
  36672. $ctx1.sendIdx["value"]=2;
  36673. $recv($4)._name_($5);
  36674. $ctx1.sendIdx["name:"]=1;
  36675. $6=$recv($4)._yourself();
  36676. $ctx1.sendIdx["yourself"]=1;
  36677. binding=$6;
  36678. binding;
  36679. $7=$self._classReferences();
  36680. $8=$recv(aNode)._value();
  36681. $ctx1.sendIdx["value"]=3;
  36682. $recv($7)._add_($8);
  36683. } else {
  36684. $self._errorUnknownVariable_(aNode);
  36685. $9=$recv($globals.UnknownVar)._new();
  36686. $recv($9)._name_($recv(aNode)._value());
  36687. binding=$recv($9)._yourself();
  36688. binding;
  36689. }
  36690. } else {
  36691. $1;
  36692. }
  36693. $recv(aNode)._binding_(binding);
  36694. return self;
  36695. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  36696. },
  36697. args: ["aNode"],
  36698. source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value isCapitalized\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.",
  36699. referencedClasses: ["ClassRefVar", "UnknownVar"],
  36700. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  36701. }),
  36702. $globals.SemanticAnalyzer);
  36703. $core.addMethod(
  36704. $core.method({
  36705. selector: "on:",
  36706. protocol: "instance creation",
  36707. fn: function (aClass){
  36708. var self=this,$self=this;
  36709. return $core.withContext(function($ctx1) {
  36710. var $1;
  36711. $1=$self._new();
  36712. $recv($1)._theClass_(aClass);
  36713. return $recv($1)._yourself();
  36714. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  36715. },
  36716. args: ["aClass"],
  36717. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  36718. referencedClasses: [],
  36719. messageSends: ["theClass:", "new", "yourself"]
  36720. }),
  36721. $globals.SemanticAnalyzer.a$cls);
  36722. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  36723. $globals.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";
  36724. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  36725. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  36726. $core.addMethod(
  36727. $core.method({
  36728. selector: "messageText",
  36729. protocol: "accessing",
  36730. fn: function (){
  36731. var self=this,$self=this;
  36732. return $core.withContext(function($ctx1) {
  36733. return " Invalid assignment to variable: ".__comma($self._variableName());
  36734. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  36735. },
  36736. args: [],
  36737. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  36738. referencedClasses: [],
  36739. messageSends: [",", "variableName"]
  36740. }),
  36741. $globals.InvalidAssignmentError);
  36742. $core.addMethod(
  36743. $core.method({
  36744. selector: "variableName",
  36745. protocol: "accessing",
  36746. fn: function (){
  36747. var self=this,$self=this;
  36748. return $self["@variableName"];
  36749. },
  36750. args: [],
  36751. source: "variableName\x0a\x09^ variableName",
  36752. referencedClasses: [],
  36753. messageSends: []
  36754. }),
  36755. $globals.InvalidAssignmentError);
  36756. $core.addMethod(
  36757. $core.method({
  36758. selector: "variableName:",
  36759. protocol: "accessing",
  36760. fn: function (aString){
  36761. var self=this,$self=this;
  36762. $self["@variableName"]=aString;
  36763. return self;
  36764. },
  36765. args: ["aString"],
  36766. source: "variableName: aString\x0a\x09variableName := aString",
  36767. referencedClasses: [],
  36768. messageSends: []
  36769. }),
  36770. $globals.InvalidAssignmentError);
  36771. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  36772. $globals.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.";
  36773. $core.addMethod(
  36774. $core.method({
  36775. selector: "messageText",
  36776. protocol: "accessing",
  36777. fn: function (){
  36778. var self=this,$self=this;
  36779. return $core.withContext(function($ctx1) {
  36780. var $1;
  36781. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  36782. $ctx1.sendIdx[","]=1;
  36783. return $1;
  36784. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  36785. },
  36786. args: [],
  36787. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  36788. referencedClasses: [],
  36789. messageSends: [",", "variableName"]
  36790. }),
  36791. $globals.ShadowingVariableError);
  36792. $core.addMethod(
  36793. $core.method({
  36794. selector: "variableName",
  36795. protocol: "accessing",
  36796. fn: function (){
  36797. var self=this,$self=this;
  36798. return $self["@variableName"];
  36799. },
  36800. args: [],
  36801. source: "variableName\x0a\x09^ variableName",
  36802. referencedClasses: [],
  36803. messageSends: []
  36804. }),
  36805. $globals.ShadowingVariableError);
  36806. $core.addMethod(
  36807. $core.method({
  36808. selector: "variableName:",
  36809. protocol: "accessing",
  36810. fn: function (aString){
  36811. var self=this,$self=this;
  36812. $self["@variableName"]=aString;
  36813. return self;
  36814. },
  36815. args: ["aString"],
  36816. source: "variableName: aString\x0a\x09variableName := aString",
  36817. referencedClasses: [],
  36818. messageSends: []
  36819. }),
  36820. $globals.ShadowingVariableError);
  36821. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  36822. $globals.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.";
  36823. $core.addMethod(
  36824. $core.method({
  36825. selector: "messageText",
  36826. protocol: "accessing",
  36827. fn: function (){
  36828. var self=this,$self=this;
  36829. return $core.withContext(function($ctx1) {
  36830. var $1;
  36831. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  36832. $ctx1.sendIdx[","]=1;
  36833. return $1;
  36834. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  36835. },
  36836. args: [],
  36837. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  36838. referencedClasses: [],
  36839. messageSends: [",", "variableName"]
  36840. }),
  36841. $globals.UnknownVariableError);
  36842. $core.addMethod(
  36843. $core.method({
  36844. selector: "variableName",
  36845. protocol: "accessing",
  36846. fn: function (){
  36847. var self=this,$self=this;
  36848. return $self["@variableName"];
  36849. },
  36850. args: [],
  36851. source: "variableName\x0a\x09^ variableName",
  36852. referencedClasses: [],
  36853. messageSends: []
  36854. }),
  36855. $globals.UnknownVariableError);
  36856. $core.addMethod(
  36857. $core.method({
  36858. selector: "variableName:",
  36859. protocol: "accessing",
  36860. fn: function (aString){
  36861. var self=this,$self=this;
  36862. $self["@variableName"]=aString;
  36863. return self;
  36864. },
  36865. args: ["aString"],
  36866. source: "variableName: aString\x0a\x09variableName := aString",
  36867. referencedClasses: [],
  36868. messageSends: []
  36869. }),
  36870. $globals.UnknownVariableError);
  36871. });
  36872. define('amber_core/Compiler-IR',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36873. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  36874. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36875. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36876. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  36877. $core.addPackage("Compiler-IR");
  36878. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  36879. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36880. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  36881. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  36882. $core.addMethod(
  36883. $core.method({
  36884. selector: "alias:",
  36885. protocol: "visiting",
  36886. fn: function (aNode){
  36887. var self=this,$self=this;
  36888. var variable;
  36889. return $core.withContext(function($ctx1) {
  36890. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  36891. $1=$recv(aNode)._isImmutable();
  36892. if($core.assert($1)){
  36893. $2=$self._visit_(aNode);
  36894. $ctx1.sendIdx["visit:"]=1;
  36895. return $2;
  36896. }
  36897. $3=$recv($globals.IRVariable)._new();
  36898. $ctx1.sendIdx["new"]=1;
  36899. $5=$recv($globals.AliasVar)._new();
  36900. $ctx1.sendIdx["new"]=2;
  36901. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  36902. $recv($3)._variable_($4);
  36903. $6=$recv($3)._yourself();
  36904. $ctx1.sendIdx["yourself"]=1;
  36905. variable=$6;
  36906. $7=$self._sequence();
  36907. $9=$recv($globals.IRAssignment)._new();
  36908. $recv($9)._add_(variable);
  36909. $ctx1.sendIdx["add:"]=2;
  36910. $recv($9)._add_($self._visit_(aNode));
  36911. $ctx1.sendIdx["add:"]=3;
  36912. $8=$recv($9)._yourself();
  36913. $recv($7)._add_($8);
  36914. $ctx1.sendIdx["add:"]=1;
  36915. $recv($recv($self._method())._internalVariables())._add_(variable);
  36916. return variable;
  36917. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  36918. },
  36919. args: ["aNode"],
  36920. 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",
  36921. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  36922. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  36923. }),
  36924. $globals.IRASTTranslator);
  36925. $core.addMethod(
  36926. $core.method({
  36927. selector: "aliasTemporally:",
  36928. protocol: "visiting",
  36929. fn: function (aCollection){
  36930. var self=this,$self=this;
  36931. var threshold,result;
  36932. return $core.withContext(function($ctx1) {
  36933. var $1,$2,$4,$3;
  36934. threshold=(0);
  36935. $recv(aCollection)._withIndexDo_((function(each,i){
  36936. return $core.withContext(function($ctx2) {
  36937. $1=$recv(each)._subtreeNeedsAliasing();
  36938. if($core.assert($1)){
  36939. threshold=i;
  36940. return threshold;
  36941. }
  36942. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  36943. }));
  36944. $ctx1.sendIdx["withIndexDo:"]=1;
  36945. result=$recv($globals.OrderedCollection)._new();
  36946. $recv(aCollection)._withIndexDo_((function(each,i){
  36947. return $core.withContext(function($ctx2) {
  36948. $2=result;
  36949. $4=$recv(i).__lt_eq(threshold);
  36950. if($core.assert($4)){
  36951. $3=$self._alias_(each);
  36952. } else {
  36953. $3=$self._visit_(each);
  36954. }
  36955. return $recv($2)._add_($3);
  36956. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  36957. }));
  36958. return result;
  36959. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  36960. },
  36961. args: ["aCollection"],
  36962. source: "aliasTemporally: aCollection\x0a\x09\x22https://lolg.it/amber/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",
  36963. referencedClasses: ["OrderedCollection"],
  36964. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  36965. }),
  36966. $globals.IRASTTranslator);
  36967. $core.addMethod(
  36968. $core.method({
  36969. selector: "method",
  36970. protocol: "accessing",
  36971. fn: function (){
  36972. var self=this,$self=this;
  36973. return $self["@method"];
  36974. },
  36975. args: [],
  36976. source: "method\x0a\x09^ method",
  36977. referencedClasses: [],
  36978. messageSends: []
  36979. }),
  36980. $globals.IRASTTranslator);
  36981. $core.addMethod(
  36982. $core.method({
  36983. selector: "method:",
  36984. protocol: "accessing",
  36985. fn: function (anIRMethod){
  36986. var self=this,$self=this;
  36987. $self["@method"]=anIRMethod;
  36988. return self;
  36989. },
  36990. args: ["anIRMethod"],
  36991. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  36992. referencedClasses: [],
  36993. messageSends: []
  36994. }),
  36995. $globals.IRASTTranslator);
  36996. $core.addMethod(
  36997. $core.method({
  36998. selector: "nextAlias",
  36999. protocol: "accessing",
  37000. fn: function (){
  37001. var self=this,$self=this;
  37002. return $core.withContext(function($ctx1) {
  37003. var $1,$receiver;
  37004. $1=$self["@nextAlias"];
  37005. if(($receiver = $1) == null || $receiver.a$nil){
  37006. $self["@nextAlias"]=(0);
  37007. $self["@nextAlias"];
  37008. } else {
  37009. $1;
  37010. }
  37011. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  37012. return $recv($self["@nextAlias"])._asString();
  37013. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  37014. },
  37015. args: [],
  37016. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  37017. referencedClasses: [],
  37018. messageSends: ["ifNil:", "+", "asString"]
  37019. }),
  37020. $globals.IRASTTranslator);
  37021. $core.addMethod(
  37022. $core.method({
  37023. selector: "sequence",
  37024. protocol: "accessing",
  37025. fn: function (){
  37026. var self=this,$self=this;
  37027. return $self["@sequence"];
  37028. },
  37029. args: [],
  37030. source: "sequence\x0a\x09^ sequence",
  37031. referencedClasses: [],
  37032. messageSends: []
  37033. }),
  37034. $globals.IRASTTranslator);
  37035. $core.addMethod(
  37036. $core.method({
  37037. selector: "sequence:",
  37038. protocol: "accessing",
  37039. fn: function (anIRSequence){
  37040. var self=this,$self=this;
  37041. $self["@sequence"]=anIRSequence;
  37042. return self;
  37043. },
  37044. args: ["anIRSequence"],
  37045. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  37046. referencedClasses: [],
  37047. messageSends: []
  37048. }),
  37049. $globals.IRASTTranslator);
  37050. $core.addMethod(
  37051. $core.method({
  37052. selector: "source",
  37053. protocol: "accessing",
  37054. fn: function (){
  37055. var self=this,$self=this;
  37056. return $self["@source"];
  37057. },
  37058. args: [],
  37059. source: "source\x0a\x09^ source",
  37060. referencedClasses: [],
  37061. messageSends: []
  37062. }),
  37063. $globals.IRASTTranslator);
  37064. $core.addMethod(
  37065. $core.method({
  37066. selector: "source:",
  37067. protocol: "accessing",
  37068. fn: function (aString){
  37069. var self=this,$self=this;
  37070. $self["@source"]=aString;
  37071. return self;
  37072. },
  37073. args: ["aString"],
  37074. source: "source: aString\x0a\x09source := aString",
  37075. referencedClasses: [],
  37076. messageSends: []
  37077. }),
  37078. $globals.IRASTTranslator);
  37079. $core.addMethod(
  37080. $core.method({
  37081. selector: "theClass",
  37082. protocol: "accessing",
  37083. fn: function (){
  37084. var self=this,$self=this;
  37085. return $self["@theClass"];
  37086. },
  37087. args: [],
  37088. source: "theClass\x0a\x09^ theClass",
  37089. referencedClasses: [],
  37090. messageSends: []
  37091. }),
  37092. $globals.IRASTTranslator);
  37093. $core.addMethod(
  37094. $core.method({
  37095. selector: "theClass:",
  37096. protocol: "accessing",
  37097. fn: function (aClass){
  37098. var self=this,$self=this;
  37099. $self["@theClass"]=aClass;
  37100. return self;
  37101. },
  37102. args: ["aClass"],
  37103. source: "theClass: aClass\x0a\x09theClass := aClass",
  37104. referencedClasses: [],
  37105. messageSends: []
  37106. }),
  37107. $globals.IRASTTranslator);
  37108. $core.addMethod(
  37109. $core.method({
  37110. selector: "visitAssignmentNode:",
  37111. protocol: "visiting",
  37112. fn: function (aNode){
  37113. var self=this,$self=this;
  37114. var left,right,assignment;
  37115. return $core.withContext(function($ctx1) {
  37116. var $1,$3,$2;
  37117. right=$self._visit_($recv(aNode)._right());
  37118. $ctx1.sendIdx["visit:"]=1;
  37119. left=$self._visit_($recv(aNode)._left());
  37120. $1=$self._sequence();
  37121. $3=$recv($globals.IRAssignment)._new();
  37122. $recv($3)._add_(left);
  37123. $ctx1.sendIdx["add:"]=2;
  37124. $recv($3)._add_(right);
  37125. $2=$recv($3)._yourself();
  37126. $recv($1)._add_($2);
  37127. $ctx1.sendIdx["add:"]=1;
  37128. return left;
  37129. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  37130. },
  37131. args: ["aNode"],
  37132. 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",
  37133. referencedClasses: ["IRAssignment"],
  37134. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  37135. }),
  37136. $globals.IRASTTranslator);
  37137. $core.addMethod(
  37138. $core.method({
  37139. selector: "visitBlockNode:",
  37140. protocol: "visiting",
  37141. fn: function (aNode){
  37142. var self=this,$self=this;
  37143. var closure;
  37144. return $core.withContext(function($ctx1) {
  37145. var $1,$2,$3,$5,$4,$6,$8,$7;
  37146. $1=$recv($globals.IRClosure)._new();
  37147. $ctx1.sendIdx["new"]=1;
  37148. $recv($1)._arguments_($recv(aNode)._parameters());
  37149. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  37150. $2=$recv(aNode)._scope();
  37151. $ctx1.sendIdx["scope"]=1;
  37152. $recv($1)._scope_($2);
  37153. $ctx1.sendIdx["scope:"]=1;
  37154. $3=$recv($1)._yourself();
  37155. $ctx1.sendIdx["yourself"]=1;
  37156. closure=$3;
  37157. $5=$recv(aNode)._scope();
  37158. $ctx1.sendIdx["scope"]=2;
  37159. $4=$recv($5)._temps();
  37160. $recv($4)._do_((function(each){
  37161. return $core.withContext(function($ctx2) {
  37162. $6=closure;
  37163. $8=$recv($globals.IRTempDeclaration)._new();
  37164. $recv($8)._name_($recv(each)._name());
  37165. $recv($8)._scope_($recv(aNode)._scope());
  37166. $7=$recv($8)._yourself();
  37167. return $recv($6)._add_($7);
  37168. $ctx2.sendIdx["add:"]=1;
  37169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37170. }));
  37171. $ctx1.sendIdx["do:"]=1;
  37172. $recv($recv(aNode)._dagChildren())._do_((function(each){
  37173. return $core.withContext(function($ctx2) {
  37174. return $recv(closure)._add_($self._visit_(each));
  37175. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37176. }));
  37177. return closure;
  37178. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  37179. },
  37180. args: ["aNode"],
  37181. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\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 dagChildren do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  37182. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  37183. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  37184. }),
  37185. $globals.IRASTTranslator);
  37186. $core.addMethod(
  37187. $core.method({
  37188. selector: "visitBlockSequenceNode:",
  37189. protocol: "visiting",
  37190. fn: function (aNode){
  37191. var self=this,$self=this;
  37192. return $core.withContext(function($ctx1) {
  37193. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  37194. $1=$recv($globals.IRBlockSequence)._new();
  37195. $ctx1.sendIdx["new"]=1;
  37196. return $self._withSequence_do_($1,(function(){
  37197. return $core.withContext(function($ctx2) {
  37198. $2=$recv(aNode)._dagChildren();
  37199. $ctx2.sendIdx["dagChildren"]=1;
  37200. return $recv($2)._ifNotEmpty_((function(){
  37201. return $core.withContext(function($ctx3) {
  37202. $4=$recv(aNode)._dagChildren();
  37203. $ctx3.sendIdx["dagChildren"]=2;
  37204. $3=$recv($4)._allButLast();
  37205. $recv($3)._do_((function(each){
  37206. return $core.withContext(function($ctx4) {
  37207. $5=$self._sequence();
  37208. $ctx4.sendIdx["sequence"]=1;
  37209. $6=$self._visitOrAlias_(each);
  37210. $ctx4.sendIdx["visitOrAlias:"]=1;
  37211. return $recv($5)._add_($6);
  37212. $ctx4.sendIdx["add:"]=1;
  37213. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  37214. }));
  37215. $9=$recv(aNode)._dagChildren();
  37216. $ctx3.sendIdx["dagChildren"]=3;
  37217. $8=$recv($9)._last();
  37218. $ctx3.sendIdx["last"]=1;
  37219. $7=$recv($8)._isReturnNode();
  37220. if($core.assert($7)){
  37221. return $recv($self._sequence())._add_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  37222. } else {
  37223. $10=$self._sequence();
  37224. $ctx3.sendIdx["sequence"]=2;
  37225. $12=$recv($globals.IRBlockReturn)._new();
  37226. $15=$recv(aNode)._dagChildren();
  37227. $ctx3.sendIdx["dagChildren"]=4;
  37228. $14=$recv($15)._last();
  37229. $ctx3.sendIdx["last"]=2;
  37230. $13=$self._visitOrAlias_($14);
  37231. $ctx3.sendIdx["visitOrAlias:"]=2;
  37232. $recv($12)._add_($13);
  37233. $ctx3.sendIdx["add:"]=3;
  37234. $11=$recv($12)._yourself();
  37235. return $recv($10)._add_($11);
  37236. $ctx3.sendIdx["add:"]=2;
  37237. }
  37238. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  37239. }));
  37240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37241. }));
  37242. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37243. },
  37244. args: ["aNode"],
  37245. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode dagChildren last) ] ]]",
  37246. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  37247. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  37248. }),
  37249. $globals.IRASTTranslator);
  37250. $core.addMethod(
  37251. $core.method({
  37252. selector: "visitCascadeNode:",
  37253. protocol: "visiting",
  37254. fn: function (aNode){
  37255. var self=this,$self=this;
  37256. var receiver;
  37257. return $core.withContext(function($ctx1) {
  37258. var $1,$2,$4,$3;
  37259. receiver=$recv(aNode)._receiver();
  37260. $1=$recv(receiver)._isImmutable();
  37261. if(!$core.assert($1)){
  37262. var alias;
  37263. alias=$self._alias_(receiver);
  37264. alias;
  37265. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  37266. receiver;
  37267. }
  37268. $2=$recv(aNode)._dagChildren();
  37269. $ctx1.sendIdx["dagChildren"]=1;
  37270. $recv($2)._do_((function(each){
  37271. return $core.withContext(function($ctx2) {
  37272. return $recv(each)._receiver_(receiver);
  37273. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37274. }));
  37275. $ctx1.sendIdx["do:"]=1;
  37276. $4=$recv(aNode)._dagChildren();
  37277. $ctx1.sendIdx["dagChildren"]=2;
  37278. $3=$recv($4)._allButLast();
  37279. $recv($3)._do_((function(each){
  37280. return $core.withContext(function($ctx2) {
  37281. return $recv($self._sequence())._add_($self._visit_(each));
  37282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  37283. }));
  37284. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  37285. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  37286. },
  37287. args: ["aNode"],
  37288. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  37289. referencedClasses: ["VariableNode"],
  37290. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  37291. }),
  37292. $globals.IRASTTranslator);
  37293. $core.addMethod(
  37294. $core.method({
  37295. selector: "visitDynamicArrayNode:",
  37296. protocol: "visiting",
  37297. fn: function (aNode){
  37298. var self=this,$self=this;
  37299. var array;
  37300. return $core.withContext(function($ctx1) {
  37301. array=$recv($globals.IRDynamicArray)._new();
  37302. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  37303. return $core.withContext(function($ctx2) {
  37304. return $recv(array)._add_(each);
  37305. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37306. }));
  37307. return array;
  37308. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  37309. },
  37310. args: ["aNode"],
  37311. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  37312. referencedClasses: ["IRDynamicArray"],
  37313. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  37314. }),
  37315. $globals.IRASTTranslator);
  37316. $core.addMethod(
  37317. $core.method({
  37318. selector: "visitDynamicDictionaryNode:",
  37319. protocol: "visiting",
  37320. fn: function (aNode){
  37321. var self=this,$self=this;
  37322. var dictionary;
  37323. return $core.withContext(function($ctx1) {
  37324. dictionary=$recv($globals.IRDynamicDictionary)._new();
  37325. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  37326. return $core.withContext(function($ctx2) {
  37327. return $recv(dictionary)._add_(each);
  37328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37329. }));
  37330. return dictionary;
  37331. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  37332. },
  37333. args: ["aNode"],
  37334. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  37335. referencedClasses: ["IRDynamicDictionary"],
  37336. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  37337. }),
  37338. $globals.IRASTTranslator);
  37339. $core.addMethod(
  37340. $core.method({
  37341. selector: "visitJSStatementNode:",
  37342. protocol: "visiting",
  37343. fn: function (aNode){
  37344. var self=this,$self=this;
  37345. return $core.withContext(function($ctx1) {
  37346. var $1;
  37347. $1=$recv($globals.IRVerbatim)._new();
  37348. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  37349. return $recv($1)._yourself();
  37350. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37351. },
  37352. args: ["aNode"],
  37353. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  37354. referencedClasses: ["IRVerbatim"],
  37355. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  37356. }),
  37357. $globals.IRASTTranslator);
  37358. $core.addMethod(
  37359. $core.method({
  37360. selector: "visitMethodNode:",
  37361. protocol: "visiting",
  37362. fn: function (aNode){
  37363. var self=this,$self=this;
  37364. return $core.withContext(function($ctx1) {
  37365. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  37366. $2=$recv($globals.IRMethod)._new();
  37367. $ctx1.sendIdx["new"]=1;
  37368. $recv($2)._source_($recv($self._source())._crlfSanitized());
  37369. $ctx1.sendIdx["source:"]=1;
  37370. $recv($2)._theClass_($self._theClass());
  37371. $recv($2)._arguments_($recv(aNode)._arguments());
  37372. $recv($2)._selector_($recv(aNode)._selector());
  37373. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  37374. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  37375. $recv($2)._classReferences_($recv(aNode)._classReferences());
  37376. $3=$recv(aNode)._scope();
  37377. $ctx1.sendIdx["scope"]=1;
  37378. $recv($2)._scope_($3);
  37379. $ctx1.sendIdx["scope:"]=1;
  37380. $4=$recv($2)._yourself();
  37381. $ctx1.sendIdx["yourself"]=1;
  37382. $1=$4;
  37383. $self._method_($1);
  37384. $6=$recv(aNode)._scope();
  37385. $ctx1.sendIdx["scope"]=2;
  37386. $5=$recv($6)._temps();
  37387. $recv($5)._do_((function(each){
  37388. return $core.withContext(function($ctx2) {
  37389. $7=$self._method();
  37390. $ctx2.sendIdx["method"]=1;
  37391. $9=$recv($globals.IRTempDeclaration)._new();
  37392. $ctx2.sendIdx["new"]=2;
  37393. $recv($9)._name_($recv(each)._name());
  37394. $10=$recv(aNode)._scope();
  37395. $ctx2.sendIdx["scope"]=3;
  37396. $recv($9)._scope_($10);
  37397. $11=$recv($9)._yourself();
  37398. $ctx2.sendIdx["yourself"]=2;
  37399. $8=$11;
  37400. return $recv($7)._add_($8);
  37401. $ctx2.sendIdx["add:"]=1;
  37402. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37403. }));
  37404. $ctx1.sendIdx["do:"]=1;
  37405. $recv($recv(aNode)._dagChildren())._do_((function(each){
  37406. return $core.withContext(function($ctx2) {
  37407. $12=$self._method();
  37408. $ctx2.sendIdx["method"]=2;
  37409. return $recv($12)._add_($self._visit_(each));
  37410. $ctx2.sendIdx["add:"]=2;
  37411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37412. }));
  37413. $14=$recv(aNode)._scope();
  37414. $ctx1.sendIdx["scope"]=4;
  37415. $13=$recv($14)._hasLocalReturn();
  37416. if(!$core.assert($13)){
  37417. $15=$self._method();
  37418. $ctx1.sendIdx["method"]=3;
  37419. $17=$recv($globals.IRReturn)._new();
  37420. $ctx1.sendIdx["new"]=3;
  37421. $19=$recv($globals.IRVariable)._new();
  37422. $ctx1.sendIdx["new"]=4;
  37423. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  37424. $20=$recv($19)._yourself();
  37425. $ctx1.sendIdx["yourself"]=3;
  37426. $18=$20;
  37427. $recv($17)._add_($18);
  37428. $ctx1.sendIdx["add:"]=4;
  37429. $21=$recv($17)._yourself();
  37430. $ctx1.sendIdx["yourself"]=4;
  37431. $16=$21;
  37432. $recv($15)._add_($16);
  37433. $ctx1.sendIdx["add:"]=3;
  37434. $23=$recv($globals.IRVerbatim)._new();
  37435. $recv($23)._source_("");
  37436. $22=$recv($23)._yourself();
  37437. $recv($15)._add_($22);
  37438. }
  37439. return $self._method();
  37440. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37441. },
  37442. args: ["aNode"],
  37443. 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\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\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 dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  37444. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  37445. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
  37446. }),
  37447. $globals.IRASTTranslator);
  37448. $core.addMethod(
  37449. $core.method({
  37450. selector: "visitOrAlias:",
  37451. protocol: "visiting",
  37452. fn: function (aNode){
  37453. var self=this,$self=this;
  37454. return $core.withContext(function($ctx1) {
  37455. var $1;
  37456. $1=$recv(aNode)._shouldBeAliased();
  37457. if($core.assert($1)){
  37458. return $self._alias_(aNode);
  37459. } else {
  37460. return $self._visit_(aNode);
  37461. }
  37462. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  37463. },
  37464. args: ["aNode"],
  37465. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  37466. referencedClasses: [],
  37467. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  37468. }),
  37469. $globals.IRASTTranslator);
  37470. $core.addMethod(
  37471. $core.method({
  37472. selector: "visitReturnNode:",
  37473. protocol: "visiting",
  37474. fn: function (aNode){
  37475. var self=this,$self=this;
  37476. var return_;
  37477. return $core.withContext(function($ctx1) {
  37478. var $1;
  37479. $1=$recv(aNode)._nonLocalReturn();
  37480. if($core.assert($1)){
  37481. return_=$recv($globals.IRNonLocalReturn)._new();
  37482. $ctx1.sendIdx["new"]=1;
  37483. } else {
  37484. return_=$recv($globals.IRReturn)._new();
  37485. }
  37486. $recv(return_)._scope_($recv(aNode)._scope());
  37487. $recv($recv(aNode)._dagChildren())._do_((function(each){
  37488. return $core.withContext(function($ctx2) {
  37489. return $recv(return_)._add_($self._visitOrAlias_(each));
  37490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  37491. }));
  37492. return return_;
  37493. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  37494. },
  37495. args: ["aNode"],
  37496. 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 dagChildren do: [ :each |\x0a\x09\x09return add: (self visitOrAlias: each) ].\x0a\x09^ return",
  37497. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  37498. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  37499. }),
  37500. $globals.IRASTTranslator);
  37501. $core.addMethod(
  37502. $core.method({
  37503. selector: "visitSendNode:",
  37504. protocol: "visiting",
  37505. fn: function (aNode){
  37506. var self=this,$self=this;
  37507. var send;
  37508. return $core.withContext(function($ctx1) {
  37509. var $1;
  37510. send=$recv($globals.IRSend)._new();
  37511. $1=send;
  37512. $recv($1)._selector_($recv(aNode)._selector());
  37513. $recv($1)._index_($recv(aNode)._index());
  37514. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  37515. return $core.withContext(function($ctx2) {
  37516. return $recv(send)._add_(each);
  37517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37518. }));
  37519. return send;
  37520. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  37521. },
  37522. args: ["aNode"],
  37523. source: "visitSendNode: aNode\x0a\x09| send |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  37524. referencedClasses: ["IRSend"],
  37525. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  37526. }),
  37527. $globals.IRASTTranslator);
  37528. $core.addMethod(
  37529. $core.method({
  37530. selector: "visitSequenceNode:",
  37531. protocol: "visiting",
  37532. fn: function (aNode){
  37533. var self=this,$self=this;
  37534. return $core.withContext(function($ctx1) {
  37535. var $1;
  37536. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  37537. return $core.withContext(function($ctx2) {
  37538. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  37539. var instruction;
  37540. return $core.withContext(function($ctx3) {
  37541. instruction=$self._visitOrAlias_(each);
  37542. instruction;
  37543. $1=$recv(instruction)._isVariable();
  37544. if(!$core.assert($1)){
  37545. return $recv($self._sequence())._add_(instruction);
  37546. }
  37547. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  37548. }));
  37549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37550. }));
  37551. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37552. },
  37553. args: ["aNode"],
  37554. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  37555. referencedClasses: ["IRSequence"],
  37556. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  37557. }),
  37558. $globals.IRASTTranslator);
  37559. $core.addMethod(
  37560. $core.method({
  37561. selector: "visitValueNode:",
  37562. protocol: "visiting",
  37563. fn: function (aNode){
  37564. var self=this,$self=this;
  37565. return $core.withContext(function($ctx1) {
  37566. var $1;
  37567. $1=$recv($globals.IRValue)._new();
  37568. $recv($1)._value_($recv(aNode)._value());
  37569. return $recv($1)._yourself();
  37570. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37571. },
  37572. args: ["aNode"],
  37573. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  37574. referencedClasses: ["IRValue"],
  37575. messageSends: ["value:", "new", "value", "yourself"]
  37576. }),
  37577. $globals.IRASTTranslator);
  37578. $core.addMethod(
  37579. $core.method({
  37580. selector: "visitVariableNode:",
  37581. protocol: "visiting",
  37582. fn: function (aNode){
  37583. var self=this,$self=this;
  37584. return $core.withContext(function($ctx1) {
  37585. var $1;
  37586. $1=$recv($globals.IRVariable)._new();
  37587. $recv($1)._variable_($recv(aNode)._binding());
  37588. return $recv($1)._yourself();
  37589. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37590. },
  37591. args: ["aNode"],
  37592. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  37593. referencedClasses: ["IRVariable"],
  37594. messageSends: ["variable:", "new", "binding", "yourself"]
  37595. }),
  37596. $globals.IRASTTranslator);
  37597. $core.addMethod(
  37598. $core.method({
  37599. selector: "withSequence:do:",
  37600. protocol: "accessing",
  37601. fn: function (aSequence,aBlock){
  37602. var self=this,$self=this;
  37603. var outerSequence;
  37604. return $core.withContext(function($ctx1) {
  37605. outerSequence=$self._sequence();
  37606. $self._sequence_(aSequence);
  37607. $ctx1.sendIdx["sequence:"]=1;
  37608. $recv(aBlock)._value();
  37609. $self._sequence_(outerSequence);
  37610. return aSequence;
  37611. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  37612. },
  37613. args: ["aSequence", "aBlock"],
  37614. 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",
  37615. referencedClasses: [],
  37616. messageSends: ["sequence", "sequence:", "value"]
  37617. }),
  37618. $globals.IRASTTranslator);
  37619. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  37620. $globals.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.";
  37621. $core.addMethod(
  37622. $core.method({
  37623. selector: "add:",
  37624. protocol: "building",
  37625. fn: function (anObject){
  37626. var self=this,$self=this;
  37627. return $core.withContext(function($ctx1) {
  37628. $recv(anObject)._parent_(self);
  37629. return $recv($self._dagChildren())._add_(anObject);
  37630. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  37631. },
  37632. args: ["anObject"],
  37633. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  37634. referencedClasses: [],
  37635. messageSends: ["parent:", "add:", "dagChildren"]
  37636. }),
  37637. $globals.IRInstruction);
  37638. $core.addMethod(
  37639. $core.method({
  37640. selector: "isClosure",
  37641. protocol: "testing",
  37642. fn: function (){
  37643. var self=this,$self=this;
  37644. return false;
  37645. },
  37646. args: [],
  37647. source: "isClosure\x0a\x09^ false",
  37648. referencedClasses: [],
  37649. messageSends: []
  37650. }),
  37651. $globals.IRInstruction);
  37652. $core.addMethod(
  37653. $core.method({
  37654. selector: "isInlined",
  37655. protocol: "testing",
  37656. fn: function (){
  37657. var self=this,$self=this;
  37658. return false;
  37659. },
  37660. args: [],
  37661. source: "isInlined\x0a\x09^ false",
  37662. referencedClasses: [],
  37663. messageSends: []
  37664. }),
  37665. $globals.IRInstruction);
  37666. $core.addMethod(
  37667. $core.method({
  37668. selector: "isMethod",
  37669. protocol: "testing",
  37670. fn: function (){
  37671. var self=this,$self=this;
  37672. return false;
  37673. },
  37674. args: [],
  37675. source: "isMethod\x0a\x09^ false",
  37676. referencedClasses: [],
  37677. messageSends: []
  37678. }),
  37679. $globals.IRInstruction);
  37680. $core.addMethod(
  37681. $core.method({
  37682. selector: "isSelf",
  37683. protocol: "testing",
  37684. fn: function (){
  37685. var self=this,$self=this;
  37686. return false;
  37687. },
  37688. args: [],
  37689. source: "isSelf\x0a\x09^ false",
  37690. referencedClasses: [],
  37691. messageSends: []
  37692. }),
  37693. $globals.IRInstruction);
  37694. $core.addMethod(
  37695. $core.method({
  37696. selector: "isSend",
  37697. protocol: "testing",
  37698. fn: function (){
  37699. var self=this,$self=this;
  37700. return false;
  37701. },
  37702. args: [],
  37703. source: "isSend\x0a\x09^ false",
  37704. referencedClasses: [],
  37705. messageSends: []
  37706. }),
  37707. $globals.IRInstruction);
  37708. $core.addMethod(
  37709. $core.method({
  37710. selector: "isSequence",
  37711. protocol: "testing",
  37712. fn: function (){
  37713. var self=this,$self=this;
  37714. return false;
  37715. },
  37716. args: [],
  37717. source: "isSequence\x0a\x09^ false",
  37718. referencedClasses: [],
  37719. messageSends: []
  37720. }),
  37721. $globals.IRInstruction);
  37722. $core.addMethod(
  37723. $core.method({
  37724. selector: "isSuper",
  37725. protocol: "testing",
  37726. fn: function (){
  37727. var self=this,$self=this;
  37728. return false;
  37729. },
  37730. args: [],
  37731. source: "isSuper\x0a\x09^ false",
  37732. referencedClasses: [],
  37733. messageSends: []
  37734. }),
  37735. $globals.IRInstruction);
  37736. $core.addMethod(
  37737. $core.method({
  37738. selector: "isTempDeclaration",
  37739. protocol: "testing",
  37740. fn: function (){
  37741. var self=this,$self=this;
  37742. return false;
  37743. },
  37744. args: [],
  37745. source: "isTempDeclaration\x0a\x09^ false",
  37746. referencedClasses: [],
  37747. messageSends: []
  37748. }),
  37749. $globals.IRInstruction);
  37750. $core.addMethod(
  37751. $core.method({
  37752. selector: "isVariable",
  37753. protocol: "testing",
  37754. fn: function (){
  37755. var self=this,$self=this;
  37756. return false;
  37757. },
  37758. args: [],
  37759. source: "isVariable\x0a\x09^ false",
  37760. referencedClasses: [],
  37761. messageSends: []
  37762. }),
  37763. $globals.IRInstruction);
  37764. $core.addMethod(
  37765. $core.method({
  37766. selector: "method",
  37767. protocol: "accessing",
  37768. fn: function (){
  37769. var self=this,$self=this;
  37770. return $core.withContext(function($ctx1) {
  37771. return $recv($self._parent())._method();
  37772. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  37773. },
  37774. args: [],
  37775. source: "method\x0a\x09^ self parent method",
  37776. referencedClasses: [],
  37777. messageSends: ["method", "parent"]
  37778. }),
  37779. $globals.IRInstruction);
  37780. $core.addMethod(
  37781. $core.method({
  37782. selector: "needsBoxingAsReceiver",
  37783. protocol: "testing",
  37784. fn: function (){
  37785. var self=this,$self=this;
  37786. return true;
  37787. },
  37788. args: [],
  37789. source: "needsBoxingAsReceiver\x0a\x09^ true",
  37790. referencedClasses: [],
  37791. messageSends: []
  37792. }),
  37793. $globals.IRInstruction);
  37794. $core.addMethod(
  37795. $core.method({
  37796. selector: "parent",
  37797. protocol: "accessing",
  37798. fn: function (){
  37799. var self=this,$self=this;
  37800. return $self["@parent"];
  37801. },
  37802. args: [],
  37803. source: "parent\x0a\x09^ parent",
  37804. referencedClasses: [],
  37805. messageSends: []
  37806. }),
  37807. $globals.IRInstruction);
  37808. $core.addMethod(
  37809. $core.method({
  37810. selector: "parent:",
  37811. protocol: "accessing",
  37812. fn: function (anIRInstruction){
  37813. var self=this,$self=this;
  37814. $self["@parent"]=anIRInstruction;
  37815. return self;
  37816. },
  37817. args: ["anIRInstruction"],
  37818. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  37819. referencedClasses: [],
  37820. messageSends: []
  37821. }),
  37822. $globals.IRInstruction);
  37823. $core.addMethod(
  37824. $core.method({
  37825. selector: "remove:",
  37826. protocol: "building",
  37827. fn: function (anIRInstruction){
  37828. var self=this,$self=this;
  37829. return $core.withContext(function($ctx1) {
  37830. $recv($self._dagChildren())._remove_(anIRInstruction);
  37831. return self;
  37832. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37833. },
  37834. args: ["anIRInstruction"],
  37835. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  37836. referencedClasses: [],
  37837. messageSends: ["remove:", "dagChildren"]
  37838. }),
  37839. $globals.IRInstruction);
  37840. $core.addMethod(
  37841. $core.method({
  37842. selector: "replace:with:",
  37843. protocol: "building",
  37844. fn: function (anIRInstruction,anotherIRInstruction){
  37845. var self=this,$self=this;
  37846. return $core.withContext(function($ctx1) {
  37847. var $1;
  37848. $recv(anotherIRInstruction)._parent_(self);
  37849. $1=$self._dagChildren();
  37850. $ctx1.sendIdx["dagChildren"]=1;
  37851. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  37852. return self;
  37853. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  37854. },
  37855. args: ["anIRInstruction", "anotherIRInstruction"],
  37856. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  37857. referencedClasses: [],
  37858. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  37859. }),
  37860. $globals.IRInstruction);
  37861. $core.addMethod(
  37862. $core.method({
  37863. selector: "replaceWith:",
  37864. protocol: "building",
  37865. fn: function (anIRInstruction){
  37866. var self=this,$self=this;
  37867. return $core.withContext(function($ctx1) {
  37868. $recv($self._parent())._replace_with_(self,anIRInstruction);
  37869. return self;
  37870. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37871. },
  37872. args: ["anIRInstruction"],
  37873. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  37874. referencedClasses: [],
  37875. messageSends: ["replace:with:", "parent"]
  37876. }),
  37877. $globals.IRInstruction);
  37878. $core.addMethod(
  37879. $core.method({
  37880. selector: "scope",
  37881. protocol: "accessing",
  37882. fn: function (){
  37883. var self=this,$self=this;
  37884. return $core.withContext(function($ctx1) {
  37885. var $1,$receiver;
  37886. $1=$self._parent();
  37887. if(($receiver = $1) == null || $receiver.a$nil){
  37888. return $1;
  37889. } else {
  37890. var node;
  37891. node=$receiver;
  37892. return $recv(node)._scope();
  37893. }
  37894. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  37895. },
  37896. args: [],
  37897. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  37898. referencedClasses: [],
  37899. messageSends: ["ifNotNil:", "parent", "scope"]
  37900. }),
  37901. $globals.IRInstruction);
  37902. $core.addMethod(
  37903. $core.method({
  37904. selector: "yieldsValue",
  37905. protocol: "testing",
  37906. fn: function (){
  37907. var self=this,$self=this;
  37908. return true;
  37909. },
  37910. args: [],
  37911. source: "yieldsValue\x0a\x09^ true",
  37912. referencedClasses: [],
  37913. messageSends: []
  37914. }),
  37915. $globals.IRInstruction);
  37916. $core.addMethod(
  37917. $core.method({
  37918. selector: "on:",
  37919. protocol: "instance creation",
  37920. fn: function (aBuilder){
  37921. var self=this,$self=this;
  37922. return $core.withContext(function($ctx1) {
  37923. var $1;
  37924. $1=$self._new();
  37925. $recv($1)._builder_(aBuilder);
  37926. return $recv($1)._yourself();
  37927. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  37928. },
  37929. args: ["aBuilder"],
  37930. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  37931. referencedClasses: [],
  37932. messageSends: ["builder:", "new", "yourself"]
  37933. }),
  37934. $globals.IRInstruction.a$cls);
  37935. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  37936. $core.addMethod(
  37937. $core.method({
  37938. selector: "acceptDagVisitor:",
  37939. protocol: "visiting",
  37940. fn: function (aVisitor){
  37941. var self=this,$self=this;
  37942. return $core.withContext(function($ctx1) {
  37943. return $recv(aVisitor)._visitIRAssignment_(self);
  37944. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  37945. },
  37946. args: ["aVisitor"],
  37947. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  37948. referencedClasses: [],
  37949. messageSends: ["visitIRAssignment:"]
  37950. }),
  37951. $globals.IRAssignment);
  37952. $core.addMethod(
  37953. $core.method({
  37954. selector: "left",
  37955. protocol: "accessing",
  37956. fn: function (){
  37957. var self=this,$self=this;
  37958. return $core.withContext(function($ctx1) {
  37959. return $recv($self._dagChildren())._first();
  37960. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  37961. },
  37962. args: [],
  37963. source: "left\x0a\x09^ self dagChildren first",
  37964. referencedClasses: [],
  37965. messageSends: ["first", "dagChildren"]
  37966. }),
  37967. $globals.IRAssignment);
  37968. $core.addMethod(
  37969. $core.method({
  37970. selector: "right",
  37971. protocol: "accessing",
  37972. fn: function (){
  37973. var self=this,$self=this;
  37974. return $core.withContext(function($ctx1) {
  37975. return $recv($self._dagChildren())._last();
  37976. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  37977. },
  37978. args: [],
  37979. source: "right\x0a\x09^ self dagChildren last",
  37980. referencedClasses: [],
  37981. messageSends: ["last", "dagChildren"]
  37982. }),
  37983. $globals.IRAssignment);
  37984. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  37985. $core.addMethod(
  37986. $core.method({
  37987. selector: "acceptDagVisitor:",
  37988. protocol: "visiting",
  37989. fn: function (aVisitor){
  37990. var self=this,$self=this;
  37991. return $core.withContext(function($ctx1) {
  37992. return $recv(aVisitor)._visitIRDynamicArray_(self);
  37993. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  37994. },
  37995. args: ["aVisitor"],
  37996. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  37997. referencedClasses: [],
  37998. messageSends: ["visitIRDynamicArray:"]
  37999. }),
  38000. $globals.IRDynamicArray);
  38001. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  38002. $core.addMethod(
  38003. $core.method({
  38004. selector: "acceptDagVisitor:",
  38005. protocol: "visiting",
  38006. fn: function (aVisitor){
  38007. var self=this,$self=this;
  38008. return $core.withContext(function($ctx1) {
  38009. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  38010. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  38011. },
  38012. args: ["aVisitor"],
  38013. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  38014. referencedClasses: [],
  38015. messageSends: ["visitIRDynamicDictionary:"]
  38016. }),
  38017. $globals.IRDynamicDictionary);
  38018. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  38019. $core.addMethod(
  38020. $core.method({
  38021. selector: "scope",
  38022. protocol: "accessing",
  38023. fn: function (){
  38024. var self=this,$self=this;
  38025. return $self["@scope"];
  38026. },
  38027. args: [],
  38028. source: "scope\x0a\x09^ scope",
  38029. referencedClasses: [],
  38030. messageSends: []
  38031. }),
  38032. $globals.IRScopedInstruction);
  38033. $core.addMethod(
  38034. $core.method({
  38035. selector: "scope:",
  38036. protocol: "accessing",
  38037. fn: function (aScope){
  38038. var self=this,$self=this;
  38039. $self["@scope"]=aScope;
  38040. return self;
  38041. },
  38042. args: ["aScope"],
  38043. source: "scope: aScope\x0a\x09scope := aScope",
  38044. referencedClasses: [],
  38045. messageSends: []
  38046. }),
  38047. $globals.IRScopedInstruction);
  38048. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  38049. $core.addMethod(
  38050. $core.method({
  38051. selector: "arguments",
  38052. protocol: "accessing",
  38053. fn: function (){
  38054. var self=this,$self=this;
  38055. return $core.withContext(function($ctx1) {
  38056. var $1,$receiver;
  38057. $1=$self["@arguments"];
  38058. if(($receiver = $1) == null || $receiver.a$nil){
  38059. return [];
  38060. } else {
  38061. return $1;
  38062. }
  38063. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  38064. },
  38065. args: [],
  38066. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  38067. referencedClasses: [],
  38068. messageSends: ["ifNil:"]
  38069. }),
  38070. $globals.IRClosureInstruction);
  38071. $core.addMethod(
  38072. $core.method({
  38073. selector: "arguments:",
  38074. protocol: "accessing",
  38075. fn: function (aCollection){
  38076. var self=this,$self=this;
  38077. $self["@arguments"]=aCollection;
  38078. return self;
  38079. },
  38080. args: ["aCollection"],
  38081. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  38082. referencedClasses: [],
  38083. messageSends: []
  38084. }),
  38085. $globals.IRClosureInstruction);
  38086. $core.addMethod(
  38087. $core.method({
  38088. selector: "locals",
  38089. protocol: "accessing",
  38090. fn: function (){
  38091. var self=this,$self=this;
  38092. return $core.withContext(function($ctx1) {
  38093. var $1;
  38094. $1=$recv($self._arguments())._copy();
  38095. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  38096. return $core.withContext(function($ctx2) {
  38097. return $recv(each)._name();
  38098. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38099. })));
  38100. return $recv($1)._yourself();
  38101. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  38102. },
  38103. args: [],
  38104. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  38105. referencedClasses: [],
  38106. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  38107. }),
  38108. $globals.IRClosureInstruction);
  38109. $core.addMethod(
  38110. $core.method({
  38111. selector: "requiresSmalltalkContext",
  38112. protocol: "accessing",
  38113. fn: function (){
  38114. var self=this,$self=this;
  38115. return $core.withContext(function($ctx1) {
  38116. var $1,$receiver;
  38117. $1=$self["@requiresSmalltalkContext"];
  38118. if(($receiver = $1) == null || $receiver.a$nil){
  38119. return false;
  38120. } else {
  38121. return $1;
  38122. }
  38123. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  38124. },
  38125. args: [],
  38126. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  38127. referencedClasses: [],
  38128. messageSends: ["ifNil:"]
  38129. }),
  38130. $globals.IRClosureInstruction);
  38131. $core.addMethod(
  38132. $core.method({
  38133. selector: "requiresSmalltalkContext:",
  38134. protocol: "accessing",
  38135. fn: function (anObject){
  38136. var self=this,$self=this;
  38137. $self["@requiresSmalltalkContext"]=anObject;
  38138. return self;
  38139. },
  38140. args: ["anObject"],
  38141. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  38142. referencedClasses: [],
  38143. messageSends: []
  38144. }),
  38145. $globals.IRClosureInstruction);
  38146. $core.addMethod(
  38147. $core.method({
  38148. selector: "scope:",
  38149. protocol: "accessing",
  38150. fn: function (aScope){
  38151. var self=this,$self=this;
  38152. return $core.withContext(function($ctx1) {
  38153. (
  38154. $ctx1.supercall = true,
  38155. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  38156. $ctx1.supercall = false;
  38157. $recv(aScope)._instruction_(self);
  38158. return self;
  38159. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  38160. },
  38161. args: ["aScope"],
  38162. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  38163. referencedClasses: [],
  38164. messageSends: ["scope:", "instruction:"]
  38165. }),
  38166. $globals.IRClosureInstruction);
  38167. $core.addMethod(
  38168. $core.method({
  38169. selector: "tempDeclarations",
  38170. protocol: "accessing",
  38171. fn: function (){
  38172. var self=this,$self=this;
  38173. return $core.withContext(function($ctx1) {
  38174. return $recv($self._dagChildren())._select_((function(each){
  38175. return $core.withContext(function($ctx2) {
  38176. return $recv(each)._isTempDeclaration();
  38177. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38178. }));
  38179. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  38180. },
  38181. args: [],
  38182. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  38183. referencedClasses: [],
  38184. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  38185. }),
  38186. $globals.IRClosureInstruction);
  38187. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  38188. $core.addMethod(
  38189. $core.method({
  38190. selector: "acceptDagVisitor:",
  38191. protocol: "visiting",
  38192. fn: function (aVisitor){
  38193. var self=this,$self=this;
  38194. return $core.withContext(function($ctx1) {
  38195. return $recv(aVisitor)._visitIRClosure_(self);
  38196. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  38197. },
  38198. args: ["aVisitor"],
  38199. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  38200. referencedClasses: [],
  38201. messageSends: ["visitIRClosure:"]
  38202. }),
  38203. $globals.IRClosure);
  38204. $core.addMethod(
  38205. $core.method({
  38206. selector: "isClosure",
  38207. protocol: "testing",
  38208. fn: function (){
  38209. var self=this,$self=this;
  38210. return true;
  38211. },
  38212. args: [],
  38213. source: "isClosure\x0a\x09^ true",
  38214. referencedClasses: [],
  38215. messageSends: []
  38216. }),
  38217. $globals.IRClosure);
  38218. $core.addMethod(
  38219. $core.method({
  38220. selector: "sequence",
  38221. protocol: "accessing",
  38222. fn: function (){
  38223. var self=this,$self=this;
  38224. return $core.withContext(function($ctx1) {
  38225. return $recv($self._dagChildren())._last();
  38226. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  38227. },
  38228. args: [],
  38229. source: "sequence\x0a\x09^ self dagChildren last",
  38230. referencedClasses: [],
  38231. messageSends: ["last", "dagChildren"]
  38232. }),
  38233. $globals.IRClosure);
  38234. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  38235. $globals.IRMethod.comment="I am a method instruction";
  38236. $core.addMethod(
  38237. $core.method({
  38238. selector: "acceptDagVisitor:",
  38239. protocol: "visiting",
  38240. fn: function (aVisitor){
  38241. var self=this,$self=this;
  38242. return $core.withContext(function($ctx1) {
  38243. return $recv(aVisitor)._visitIRMethod_(self);
  38244. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  38245. },
  38246. args: ["aVisitor"],
  38247. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  38248. referencedClasses: [],
  38249. messageSends: ["visitIRMethod:"]
  38250. }),
  38251. $globals.IRMethod);
  38252. $core.addMethod(
  38253. $core.method({
  38254. selector: "classReferences",
  38255. protocol: "accessing",
  38256. fn: function (){
  38257. var self=this,$self=this;
  38258. return $self["@classReferences"];
  38259. },
  38260. args: [],
  38261. source: "classReferences\x0a\x09^ classReferences",
  38262. referencedClasses: [],
  38263. messageSends: []
  38264. }),
  38265. $globals.IRMethod);
  38266. $core.addMethod(
  38267. $core.method({
  38268. selector: "classReferences:",
  38269. protocol: "accessing",
  38270. fn: function (aCollection){
  38271. var self=this,$self=this;
  38272. $self["@classReferences"]=aCollection;
  38273. return self;
  38274. },
  38275. args: ["aCollection"],
  38276. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  38277. referencedClasses: [],
  38278. messageSends: []
  38279. }),
  38280. $globals.IRMethod);
  38281. $core.addMethod(
  38282. $core.method({
  38283. selector: "internalVariables",
  38284. protocol: "accessing",
  38285. fn: function (){
  38286. var self=this,$self=this;
  38287. return $core.withContext(function($ctx1) {
  38288. var $1,$receiver;
  38289. $1=$self["@internalVariables"];
  38290. if(($receiver = $1) == null || $receiver.a$nil){
  38291. $self["@internalVariables"]=$recv($globals.Set)._new();
  38292. return $self["@internalVariables"];
  38293. } else {
  38294. return $1;
  38295. }
  38296. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  38297. },
  38298. args: [],
  38299. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  38300. referencedClasses: ["Set"],
  38301. messageSends: ["ifNil:", "new"]
  38302. }),
  38303. $globals.IRMethod);
  38304. $core.addMethod(
  38305. $core.method({
  38306. selector: "isMethod",
  38307. protocol: "testing",
  38308. fn: function (){
  38309. var self=this,$self=this;
  38310. return true;
  38311. },
  38312. args: [],
  38313. source: "isMethod\x0a\x09^ true",
  38314. referencedClasses: [],
  38315. messageSends: []
  38316. }),
  38317. $globals.IRMethod);
  38318. $core.addMethod(
  38319. $core.method({
  38320. selector: "messageSends",
  38321. protocol: "accessing",
  38322. fn: function (){
  38323. var self=this,$self=this;
  38324. return $core.withContext(function($ctx1) {
  38325. return $recv($self._sendIndexes())._keys();
  38326. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  38327. },
  38328. args: [],
  38329. source: "messageSends\x0a\x09^ self sendIndexes keys",
  38330. referencedClasses: [],
  38331. messageSends: ["keys", "sendIndexes"]
  38332. }),
  38333. $globals.IRMethod);
  38334. $core.addMethod(
  38335. $core.method({
  38336. selector: "method",
  38337. protocol: "accessing",
  38338. fn: function (){
  38339. var self=this,$self=this;
  38340. return self;
  38341. },
  38342. args: [],
  38343. source: "method\x0a\x09^ self",
  38344. referencedClasses: [],
  38345. messageSends: []
  38346. }),
  38347. $globals.IRMethod);
  38348. $core.addMethod(
  38349. $core.method({
  38350. selector: "selector",
  38351. protocol: "accessing",
  38352. fn: function (){
  38353. var self=this,$self=this;
  38354. return $self["@selector"];
  38355. },
  38356. args: [],
  38357. source: "selector\x0a\x09^ selector",
  38358. referencedClasses: [],
  38359. messageSends: []
  38360. }),
  38361. $globals.IRMethod);
  38362. $core.addMethod(
  38363. $core.method({
  38364. selector: "selector:",
  38365. protocol: "accessing",
  38366. fn: function (aString){
  38367. var self=this,$self=this;
  38368. $self["@selector"]=aString;
  38369. return self;
  38370. },
  38371. args: ["aString"],
  38372. source: "selector: aString\x0a\x09selector := aString",
  38373. referencedClasses: [],
  38374. messageSends: []
  38375. }),
  38376. $globals.IRMethod);
  38377. $core.addMethod(
  38378. $core.method({
  38379. selector: "sendIndexes",
  38380. protocol: "accessing",
  38381. fn: function (){
  38382. var self=this,$self=this;
  38383. return $self["@sendIndexes"];
  38384. },
  38385. args: [],
  38386. source: "sendIndexes\x0a\x09^ sendIndexes",
  38387. referencedClasses: [],
  38388. messageSends: []
  38389. }),
  38390. $globals.IRMethod);
  38391. $core.addMethod(
  38392. $core.method({
  38393. selector: "sendIndexes:",
  38394. protocol: "accessing",
  38395. fn: function (aDictionary){
  38396. var self=this,$self=this;
  38397. $self["@sendIndexes"]=aDictionary;
  38398. return self;
  38399. },
  38400. args: ["aDictionary"],
  38401. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  38402. referencedClasses: [],
  38403. messageSends: []
  38404. }),
  38405. $globals.IRMethod);
  38406. $core.addMethod(
  38407. $core.method({
  38408. selector: "source",
  38409. protocol: "accessing",
  38410. fn: function (){
  38411. var self=this,$self=this;
  38412. return $self["@source"];
  38413. },
  38414. args: [],
  38415. source: "source\x0a\x09^ source",
  38416. referencedClasses: [],
  38417. messageSends: []
  38418. }),
  38419. $globals.IRMethod);
  38420. $core.addMethod(
  38421. $core.method({
  38422. selector: "source:",
  38423. protocol: "accessing",
  38424. fn: function (aString){
  38425. var self=this,$self=this;
  38426. $self["@source"]=aString;
  38427. return self;
  38428. },
  38429. args: ["aString"],
  38430. source: "source: aString\x0a\x09source := aString",
  38431. referencedClasses: [],
  38432. messageSends: []
  38433. }),
  38434. $globals.IRMethod);
  38435. $core.addMethod(
  38436. $core.method({
  38437. selector: "theClass",
  38438. protocol: "accessing",
  38439. fn: function (){
  38440. var self=this,$self=this;
  38441. return $self["@theClass"];
  38442. },
  38443. args: [],
  38444. source: "theClass\x0a\x09^ theClass",
  38445. referencedClasses: [],
  38446. messageSends: []
  38447. }),
  38448. $globals.IRMethod);
  38449. $core.addMethod(
  38450. $core.method({
  38451. selector: "theClass:",
  38452. protocol: "accessing",
  38453. fn: function (aClass){
  38454. var self=this,$self=this;
  38455. $self["@theClass"]=aClass;
  38456. return self;
  38457. },
  38458. args: ["aClass"],
  38459. source: "theClass: aClass\x0a\x09theClass := aClass",
  38460. referencedClasses: [],
  38461. messageSends: []
  38462. }),
  38463. $globals.IRMethod);
  38464. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  38465. $globals.IRReturn.comment="I am a local return instruction.";
  38466. $core.addMethod(
  38467. $core.method({
  38468. selector: "acceptDagVisitor:",
  38469. protocol: "visiting",
  38470. fn: function (aVisitor){
  38471. var self=this,$self=this;
  38472. return $core.withContext(function($ctx1) {
  38473. return $recv(aVisitor)._visitIRReturn_(self);
  38474. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  38475. },
  38476. args: ["aVisitor"],
  38477. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  38478. referencedClasses: [],
  38479. messageSends: ["visitIRReturn:"]
  38480. }),
  38481. $globals.IRReturn);
  38482. $core.addMethod(
  38483. $core.method({
  38484. selector: "expression",
  38485. protocol: "accessing",
  38486. fn: function (){
  38487. var self=this,$self=this;
  38488. return $core.withContext(function($ctx1) {
  38489. return $recv($self._dagChildren())._single();
  38490. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  38491. },
  38492. args: [],
  38493. source: "expression\x0a\x09^ self dagChildren single",
  38494. referencedClasses: [],
  38495. messageSends: ["single", "dagChildren"]
  38496. }),
  38497. $globals.IRReturn);
  38498. $core.addMethod(
  38499. $core.method({
  38500. selector: "scope",
  38501. protocol: "accessing",
  38502. fn: function (){
  38503. var self=this,$self=this;
  38504. return $core.withContext(function($ctx1) {
  38505. var $1,$receiver;
  38506. $1=$self["@scope"];
  38507. if(($receiver = $1) == null || $receiver.a$nil){
  38508. return $recv($self._parent())._scope();
  38509. } else {
  38510. return $1;
  38511. }
  38512. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  38513. },
  38514. args: [],
  38515. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  38516. referencedClasses: [],
  38517. messageSends: ["ifNil:", "scope", "parent"]
  38518. }),
  38519. $globals.IRReturn);
  38520. $core.addMethod(
  38521. $core.method({
  38522. selector: "yieldsValue",
  38523. protocol: "testing",
  38524. fn: function (){
  38525. var self=this,$self=this;
  38526. return false;
  38527. },
  38528. args: [],
  38529. source: "yieldsValue\x0a\x09^ false",
  38530. referencedClasses: [],
  38531. messageSends: []
  38532. }),
  38533. $globals.IRReturn);
  38534. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  38535. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  38536. $core.addMethod(
  38537. $core.method({
  38538. selector: "acceptDagVisitor:",
  38539. protocol: "visiting",
  38540. fn: function (aVisitor){
  38541. var self=this,$self=this;
  38542. return $core.withContext(function($ctx1) {
  38543. return $recv(aVisitor)._visitIRBlockReturn_(self);
  38544. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  38545. },
  38546. args: ["aVisitor"],
  38547. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  38548. referencedClasses: [],
  38549. messageSends: ["visitIRBlockReturn:"]
  38550. }),
  38551. $globals.IRBlockReturn);
  38552. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  38553. $globals.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class.";
  38554. $core.addMethod(
  38555. $core.method({
  38556. selector: "acceptDagVisitor:",
  38557. protocol: "visiting",
  38558. fn: function (aVisitor){
  38559. var self=this,$self=this;
  38560. return $core.withContext(function($ctx1) {
  38561. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  38562. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  38563. },
  38564. args: ["aVisitor"],
  38565. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  38566. referencedClasses: [],
  38567. messageSends: ["visitIRNonLocalReturn:"]
  38568. }),
  38569. $globals.IRNonLocalReturn);
  38570. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  38571. $core.addMethod(
  38572. $core.method({
  38573. selector: "acceptDagVisitor:",
  38574. protocol: "visiting",
  38575. fn: function (aVisitor){
  38576. var self=this,$self=this;
  38577. return $core.withContext(function($ctx1) {
  38578. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  38579. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  38580. },
  38581. args: ["aVisitor"],
  38582. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  38583. referencedClasses: [],
  38584. messageSends: ["visitIRTempDeclaration:"]
  38585. }),
  38586. $globals.IRTempDeclaration);
  38587. $core.addMethod(
  38588. $core.method({
  38589. selector: "isTempDeclaration",
  38590. protocol: "testing",
  38591. fn: function (){
  38592. var self=this,$self=this;
  38593. return true;
  38594. },
  38595. args: [],
  38596. source: "isTempDeclaration\x0a\x09^ true",
  38597. referencedClasses: [],
  38598. messageSends: []
  38599. }),
  38600. $globals.IRTempDeclaration);
  38601. $core.addMethod(
  38602. $core.method({
  38603. selector: "name",
  38604. protocol: "accessing",
  38605. fn: function (){
  38606. var self=this,$self=this;
  38607. return $self["@name"];
  38608. },
  38609. args: [],
  38610. source: "name\x0a\x09^ name",
  38611. referencedClasses: [],
  38612. messageSends: []
  38613. }),
  38614. $globals.IRTempDeclaration);
  38615. $core.addMethod(
  38616. $core.method({
  38617. selector: "name:",
  38618. protocol: "accessing",
  38619. fn: function (aString){
  38620. var self=this,$self=this;
  38621. $self["@name"]=aString;
  38622. return self;
  38623. },
  38624. args: ["aString"],
  38625. source: "name: aString\x0a\x09name := aString",
  38626. referencedClasses: [],
  38627. messageSends: []
  38628. }),
  38629. $globals.IRTempDeclaration);
  38630. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  38631. $globals.IRSend.comment="I am a message send instruction.";
  38632. $core.addMethod(
  38633. $core.method({
  38634. selector: "acceptDagVisitor:",
  38635. protocol: "visiting",
  38636. fn: function (aVisitor){
  38637. var self=this,$self=this;
  38638. return $core.withContext(function($ctx1) {
  38639. return $recv(aVisitor)._visitIRSend_(self);
  38640. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  38641. },
  38642. args: ["aVisitor"],
  38643. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  38644. referencedClasses: [],
  38645. messageSends: ["visitIRSend:"]
  38646. }),
  38647. $globals.IRSend);
  38648. $core.addMethod(
  38649. $core.method({
  38650. selector: "arguments",
  38651. protocol: "accessing",
  38652. fn: function (){
  38653. var self=this,$self=this;
  38654. return $core.withContext(function($ctx1) {
  38655. return $recv($self._dagChildren())._allButFirst();
  38656. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  38657. },
  38658. args: [],
  38659. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  38660. referencedClasses: [],
  38661. messageSends: ["allButFirst", "dagChildren"]
  38662. }),
  38663. $globals.IRSend);
  38664. $core.addMethod(
  38665. $core.method({
  38666. selector: "index",
  38667. protocol: "accessing",
  38668. fn: function (){
  38669. var self=this,$self=this;
  38670. return $self["@index"];
  38671. },
  38672. args: [],
  38673. source: "index\x0a\x09^ index",
  38674. referencedClasses: [],
  38675. messageSends: []
  38676. }),
  38677. $globals.IRSend);
  38678. $core.addMethod(
  38679. $core.method({
  38680. selector: "index:",
  38681. protocol: "accessing",
  38682. fn: function (anInteger){
  38683. var self=this,$self=this;
  38684. $self["@index"]=anInteger;
  38685. return self;
  38686. },
  38687. args: ["anInteger"],
  38688. source: "index: anInteger\x0a\x09index := anInteger",
  38689. referencedClasses: [],
  38690. messageSends: []
  38691. }),
  38692. $globals.IRSend);
  38693. $core.addMethod(
  38694. $core.method({
  38695. selector: "isSend",
  38696. protocol: "testing",
  38697. fn: function (){
  38698. var self=this,$self=this;
  38699. return true;
  38700. },
  38701. args: [],
  38702. source: "isSend\x0a\x09^ true",
  38703. referencedClasses: [],
  38704. messageSends: []
  38705. }),
  38706. $globals.IRSend);
  38707. $core.addMethod(
  38708. $core.method({
  38709. selector: "receiver",
  38710. protocol: "accessing",
  38711. fn: function (){
  38712. var self=this,$self=this;
  38713. return $core.withContext(function($ctx1) {
  38714. return $recv($self._dagChildren())._first();
  38715. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  38716. },
  38717. args: [],
  38718. source: "receiver\x0a\x09^ self dagChildren first",
  38719. referencedClasses: [],
  38720. messageSends: ["first", "dagChildren"]
  38721. }),
  38722. $globals.IRSend);
  38723. $core.addMethod(
  38724. $core.method({
  38725. selector: "selector",
  38726. protocol: "accessing",
  38727. fn: function (){
  38728. var self=this,$self=this;
  38729. return $self["@selector"];
  38730. },
  38731. args: [],
  38732. source: "selector\x0a\x09^ selector",
  38733. referencedClasses: [],
  38734. messageSends: []
  38735. }),
  38736. $globals.IRSend);
  38737. $core.addMethod(
  38738. $core.method({
  38739. selector: "selector:",
  38740. protocol: "accessing",
  38741. fn: function (aString){
  38742. var self=this,$self=this;
  38743. $self["@selector"]=aString;
  38744. return self;
  38745. },
  38746. args: ["aString"],
  38747. source: "selector: aString\x0a\x09selector := aString",
  38748. referencedClasses: [],
  38749. messageSends: []
  38750. }),
  38751. $globals.IRSend);
  38752. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  38753. $core.addMethod(
  38754. $core.method({
  38755. selector: "acceptDagVisitor:",
  38756. protocol: "visiting",
  38757. fn: function (aVisitor){
  38758. var self=this,$self=this;
  38759. return $core.withContext(function($ctx1) {
  38760. return $recv(aVisitor)._visitIRSequence_(self);
  38761. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  38762. },
  38763. args: ["aVisitor"],
  38764. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  38765. referencedClasses: [],
  38766. messageSends: ["visitIRSequence:"]
  38767. }),
  38768. $globals.IRSequence);
  38769. $core.addMethod(
  38770. $core.method({
  38771. selector: "isSequence",
  38772. protocol: "testing",
  38773. fn: function (){
  38774. var self=this,$self=this;
  38775. return true;
  38776. },
  38777. args: [],
  38778. source: "isSequence\x0a\x09^ true",
  38779. referencedClasses: [],
  38780. messageSends: []
  38781. }),
  38782. $globals.IRSequence);
  38783. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  38784. $core.addMethod(
  38785. $core.method({
  38786. selector: "acceptDagVisitor:",
  38787. protocol: "visiting",
  38788. fn: function (aVisitor){
  38789. var self=this,$self=this;
  38790. return $core.withContext(function($ctx1) {
  38791. return $recv(aVisitor)._visitIRBlockSequence_(self);
  38792. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  38793. },
  38794. args: ["aVisitor"],
  38795. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  38796. referencedClasses: [],
  38797. messageSends: ["visitIRBlockSequence:"]
  38798. }),
  38799. $globals.IRBlockSequence);
  38800. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  38801. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  38802. $core.addMethod(
  38803. $core.method({
  38804. selector: "acceptDagVisitor:",
  38805. protocol: "visiting",
  38806. fn: function (aVisitor){
  38807. var self=this,$self=this;
  38808. return $core.withContext(function($ctx1) {
  38809. return $recv(aVisitor)._visitIRValue_(self);
  38810. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  38811. },
  38812. args: ["aVisitor"],
  38813. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  38814. referencedClasses: [],
  38815. messageSends: ["visitIRValue:"]
  38816. }),
  38817. $globals.IRValue);
  38818. $core.addMethod(
  38819. $core.method({
  38820. selector: "needsBoxingAsReceiver",
  38821. protocol: "testing",
  38822. fn: function (){
  38823. var self=this,$self=this;
  38824. return false;
  38825. },
  38826. args: [],
  38827. source: "needsBoxingAsReceiver\x0a\x09^ false",
  38828. referencedClasses: [],
  38829. messageSends: []
  38830. }),
  38831. $globals.IRValue);
  38832. $core.addMethod(
  38833. $core.method({
  38834. selector: "value",
  38835. protocol: "accessing",
  38836. fn: function (){
  38837. var self=this,$self=this;
  38838. return $self["@value"];
  38839. },
  38840. args: [],
  38841. source: "value\x0a\x09^ value",
  38842. referencedClasses: [],
  38843. messageSends: []
  38844. }),
  38845. $globals.IRValue);
  38846. $core.addMethod(
  38847. $core.method({
  38848. selector: "value:",
  38849. protocol: "accessing",
  38850. fn: function (aString){
  38851. var self=this,$self=this;
  38852. $self["@value"]=aString;
  38853. return self;
  38854. },
  38855. args: ["aString"],
  38856. source: "value: aString\x0a\x09value := aString",
  38857. referencedClasses: [],
  38858. messageSends: []
  38859. }),
  38860. $globals.IRValue);
  38861. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  38862. $globals.IRVariable.comment="I am a variable instruction.";
  38863. $core.addMethod(
  38864. $core.method({
  38865. selector: "acceptDagVisitor:",
  38866. protocol: "visiting",
  38867. fn: function (aVisitor){
  38868. var self=this,$self=this;
  38869. return $core.withContext(function($ctx1) {
  38870. return $recv(aVisitor)._visitIRVariable_(self);
  38871. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  38872. },
  38873. args: ["aVisitor"],
  38874. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  38875. referencedClasses: [],
  38876. messageSends: ["visitIRVariable:"]
  38877. }),
  38878. $globals.IRVariable);
  38879. $core.addMethod(
  38880. $core.method({
  38881. selector: "isSelf",
  38882. protocol: "testing",
  38883. fn: function (){
  38884. var self=this,$self=this;
  38885. return $core.withContext(function($ctx1) {
  38886. return $recv($self._variable())._isSelf();
  38887. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  38888. },
  38889. args: [],
  38890. source: "isSelf\x0a\x09^ self variable isSelf",
  38891. referencedClasses: [],
  38892. messageSends: ["isSelf", "variable"]
  38893. }),
  38894. $globals.IRVariable);
  38895. $core.addMethod(
  38896. $core.method({
  38897. selector: "isSuper",
  38898. protocol: "testing",
  38899. fn: function (){
  38900. var self=this,$self=this;
  38901. return $core.withContext(function($ctx1) {
  38902. return $recv($self._variable())._isSuper();
  38903. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  38904. },
  38905. args: [],
  38906. source: "isSuper\x0a\x09^ self variable isSuper",
  38907. referencedClasses: [],
  38908. messageSends: ["isSuper", "variable"]
  38909. }),
  38910. $globals.IRVariable);
  38911. $core.addMethod(
  38912. $core.method({
  38913. selector: "isVariable",
  38914. protocol: "testing",
  38915. fn: function (){
  38916. var self=this,$self=this;
  38917. return true;
  38918. },
  38919. args: [],
  38920. source: "isVariable\x0a\x09^ true",
  38921. referencedClasses: [],
  38922. messageSends: []
  38923. }),
  38924. $globals.IRVariable);
  38925. $core.addMethod(
  38926. $core.method({
  38927. selector: "needsBoxingAsReceiver",
  38928. protocol: "testing",
  38929. fn: function (){
  38930. var self=this,$self=this;
  38931. return $core.withContext(function($ctx1) {
  38932. return $recv($recv($self._variable())._isPseudoVar())._not();
  38933. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  38934. },
  38935. args: [],
  38936. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  38937. referencedClasses: [],
  38938. messageSends: ["not", "isPseudoVar", "variable"]
  38939. }),
  38940. $globals.IRVariable);
  38941. $core.addMethod(
  38942. $core.method({
  38943. selector: "variable",
  38944. protocol: "accessing",
  38945. fn: function (){
  38946. var self=this,$self=this;
  38947. return $self["@variable"];
  38948. },
  38949. args: [],
  38950. source: "variable\x0a\x09^ variable",
  38951. referencedClasses: [],
  38952. messageSends: []
  38953. }),
  38954. $globals.IRVariable);
  38955. $core.addMethod(
  38956. $core.method({
  38957. selector: "variable:",
  38958. protocol: "accessing",
  38959. fn: function (aScopeVariable){
  38960. var self=this,$self=this;
  38961. $self["@variable"]=aScopeVariable;
  38962. return self;
  38963. },
  38964. args: ["aScopeVariable"],
  38965. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  38966. referencedClasses: [],
  38967. messageSends: []
  38968. }),
  38969. $globals.IRVariable);
  38970. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  38971. $core.addMethod(
  38972. $core.method({
  38973. selector: "acceptDagVisitor:",
  38974. protocol: "visiting",
  38975. fn: function (aVisitor){
  38976. var self=this,$self=this;
  38977. return $core.withContext(function($ctx1) {
  38978. return $recv(aVisitor)._visitIRVerbatim_(self);
  38979. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  38980. },
  38981. args: ["aVisitor"],
  38982. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  38983. referencedClasses: [],
  38984. messageSends: ["visitIRVerbatim:"]
  38985. }),
  38986. $globals.IRVerbatim);
  38987. $core.addMethod(
  38988. $core.method({
  38989. selector: "source",
  38990. protocol: "accessing",
  38991. fn: function (){
  38992. var self=this,$self=this;
  38993. return $self["@source"];
  38994. },
  38995. args: [],
  38996. source: "source\x0a\x09^ source",
  38997. referencedClasses: [],
  38998. messageSends: []
  38999. }),
  39000. $globals.IRVerbatim);
  39001. $core.addMethod(
  39002. $core.method({
  39003. selector: "source:",
  39004. protocol: "accessing",
  39005. fn: function (aString){
  39006. var self=this,$self=this;
  39007. $self["@source"]=aString;
  39008. return self;
  39009. },
  39010. args: ["aString"],
  39011. source: "source: aString\x0a\x09source := aString",
  39012. referencedClasses: [],
  39013. messageSends: []
  39014. }),
  39015. $globals.IRVerbatim);
  39016. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  39017. $core.addMethod(
  39018. $core.method({
  39019. selector: "visitDagNode:",
  39020. protocol: "visiting",
  39021. fn: function (aNode){
  39022. var self=this,$self=this;
  39023. return $core.withContext(function($ctx1) {
  39024. return $self._visitDagNodeVariantSimple_(aNode);
  39025. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  39026. },
  39027. args: ["aNode"],
  39028. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  39029. referencedClasses: [],
  39030. messageSends: ["visitDagNodeVariantSimple:"]
  39031. }),
  39032. $globals.IRVisitor);
  39033. $core.addMethod(
  39034. $core.method({
  39035. selector: "visitIRAssignment:",
  39036. protocol: "visiting",
  39037. fn: function (anIRAssignment){
  39038. var self=this,$self=this;
  39039. return $core.withContext(function($ctx1) {
  39040. return $self._visitDagNode_(anIRAssignment);
  39041. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  39042. },
  39043. args: ["anIRAssignment"],
  39044. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  39045. referencedClasses: [],
  39046. messageSends: ["visitDagNode:"]
  39047. }),
  39048. $globals.IRVisitor);
  39049. $core.addMethod(
  39050. $core.method({
  39051. selector: "visitIRBlockReturn:",
  39052. protocol: "visiting",
  39053. fn: function (anIRBlockReturn){
  39054. var self=this,$self=this;
  39055. return $core.withContext(function($ctx1) {
  39056. return $self._visitIRReturn_(anIRBlockReturn);
  39057. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  39058. },
  39059. args: ["anIRBlockReturn"],
  39060. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  39061. referencedClasses: [],
  39062. messageSends: ["visitIRReturn:"]
  39063. }),
  39064. $globals.IRVisitor);
  39065. $core.addMethod(
  39066. $core.method({
  39067. selector: "visitIRBlockSequence:",
  39068. protocol: "visiting",
  39069. fn: function (anIRBlockSequence){
  39070. var self=this,$self=this;
  39071. return $core.withContext(function($ctx1) {
  39072. return $self._visitIRSequence_(anIRBlockSequence);
  39073. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  39074. },
  39075. args: ["anIRBlockSequence"],
  39076. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  39077. referencedClasses: [],
  39078. messageSends: ["visitIRSequence:"]
  39079. }),
  39080. $globals.IRVisitor);
  39081. $core.addMethod(
  39082. $core.method({
  39083. selector: "visitIRClosure:",
  39084. protocol: "visiting",
  39085. fn: function (anIRClosure){
  39086. var self=this,$self=this;
  39087. return $core.withContext(function($ctx1) {
  39088. return $self._visitDagNode_(anIRClosure);
  39089. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  39090. },
  39091. args: ["anIRClosure"],
  39092. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  39093. referencedClasses: [],
  39094. messageSends: ["visitDagNode:"]
  39095. }),
  39096. $globals.IRVisitor);
  39097. $core.addMethod(
  39098. $core.method({
  39099. selector: "visitIRDynamicArray:",
  39100. protocol: "visiting",
  39101. fn: function (anIRDynamicArray){
  39102. var self=this,$self=this;
  39103. return $core.withContext(function($ctx1) {
  39104. return $self._visitDagNode_(anIRDynamicArray);
  39105. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  39106. },
  39107. args: ["anIRDynamicArray"],
  39108. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  39109. referencedClasses: [],
  39110. messageSends: ["visitDagNode:"]
  39111. }),
  39112. $globals.IRVisitor);
  39113. $core.addMethod(
  39114. $core.method({
  39115. selector: "visitIRDynamicDictionary:",
  39116. protocol: "visiting",
  39117. fn: function (anIRDynamicDictionary){
  39118. var self=this,$self=this;
  39119. return $core.withContext(function($ctx1) {
  39120. return $self._visitDagNode_(anIRDynamicDictionary);
  39121. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  39122. },
  39123. args: ["anIRDynamicDictionary"],
  39124. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  39125. referencedClasses: [],
  39126. messageSends: ["visitDagNode:"]
  39127. }),
  39128. $globals.IRVisitor);
  39129. $core.addMethod(
  39130. $core.method({
  39131. selector: "visitIRInlinedClosure:",
  39132. protocol: "visiting",
  39133. fn: function (anIRInlinedClosure){
  39134. var self=this,$self=this;
  39135. return $core.withContext(function($ctx1) {
  39136. return $self._visitIRClosure_(anIRInlinedClosure);
  39137. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  39138. },
  39139. args: ["anIRInlinedClosure"],
  39140. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  39141. referencedClasses: [],
  39142. messageSends: ["visitIRClosure:"]
  39143. }),
  39144. $globals.IRVisitor);
  39145. $core.addMethod(
  39146. $core.method({
  39147. selector: "visitIRInlinedSequence:",
  39148. protocol: "visiting",
  39149. fn: function (anIRInlinedSequence){
  39150. var self=this,$self=this;
  39151. return $core.withContext(function($ctx1) {
  39152. return $self._visitIRSequence_(anIRInlinedSequence);
  39153. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  39154. },
  39155. args: ["anIRInlinedSequence"],
  39156. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  39157. referencedClasses: [],
  39158. messageSends: ["visitIRSequence:"]
  39159. }),
  39160. $globals.IRVisitor);
  39161. $core.addMethod(
  39162. $core.method({
  39163. selector: "visitIRMethod:",
  39164. protocol: "visiting",
  39165. fn: function (anIRMethod){
  39166. var self=this,$self=this;
  39167. return $core.withContext(function($ctx1) {
  39168. return $self._visitDagNode_(anIRMethod);
  39169. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  39170. },
  39171. args: ["anIRMethod"],
  39172. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  39173. referencedClasses: [],
  39174. messageSends: ["visitDagNode:"]
  39175. }),
  39176. $globals.IRVisitor);
  39177. $core.addMethod(
  39178. $core.method({
  39179. selector: "visitIRNonLocalReturn:",
  39180. protocol: "visiting",
  39181. fn: function (anIRNonLocalReturn){
  39182. var self=this,$self=this;
  39183. return $core.withContext(function($ctx1) {
  39184. return $self._visitDagNode_(anIRNonLocalReturn);
  39185. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  39186. },
  39187. args: ["anIRNonLocalReturn"],
  39188. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  39189. referencedClasses: [],
  39190. messageSends: ["visitDagNode:"]
  39191. }),
  39192. $globals.IRVisitor);
  39193. $core.addMethod(
  39194. $core.method({
  39195. selector: "visitIRNonLocalReturnHandling:",
  39196. protocol: "visiting",
  39197. fn: function (anIRNonLocalReturnHandling){
  39198. var self=this,$self=this;
  39199. return $core.withContext(function($ctx1) {
  39200. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  39201. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  39202. },
  39203. args: ["anIRNonLocalReturnHandling"],
  39204. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  39205. referencedClasses: [],
  39206. messageSends: ["visitDagNode:"]
  39207. }),
  39208. $globals.IRVisitor);
  39209. $core.addMethod(
  39210. $core.method({
  39211. selector: "visitIRReturn:",
  39212. protocol: "visiting",
  39213. fn: function (anIRReturn){
  39214. var self=this,$self=this;
  39215. return $core.withContext(function($ctx1) {
  39216. return $self._visitDagNode_(anIRReturn);
  39217. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  39218. },
  39219. args: ["anIRReturn"],
  39220. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  39221. referencedClasses: [],
  39222. messageSends: ["visitDagNode:"]
  39223. }),
  39224. $globals.IRVisitor);
  39225. $core.addMethod(
  39226. $core.method({
  39227. selector: "visitIRSend:",
  39228. protocol: "visiting",
  39229. fn: function (anIRSend){
  39230. var self=this,$self=this;
  39231. return $core.withContext(function($ctx1) {
  39232. return $self._visitDagNode_(anIRSend);
  39233. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  39234. },
  39235. args: ["anIRSend"],
  39236. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  39237. referencedClasses: [],
  39238. messageSends: ["visitDagNode:"]
  39239. }),
  39240. $globals.IRVisitor);
  39241. $core.addMethod(
  39242. $core.method({
  39243. selector: "visitIRSequence:",
  39244. protocol: "visiting",
  39245. fn: function (anIRSequence){
  39246. var self=this,$self=this;
  39247. return $core.withContext(function($ctx1) {
  39248. return $self._visitDagNode_(anIRSequence);
  39249. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  39250. },
  39251. args: ["anIRSequence"],
  39252. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  39253. referencedClasses: [],
  39254. messageSends: ["visitDagNode:"]
  39255. }),
  39256. $globals.IRVisitor);
  39257. $core.addMethod(
  39258. $core.method({
  39259. selector: "visitIRTempDeclaration:",
  39260. protocol: "visiting",
  39261. fn: function (anIRTempDeclaration){
  39262. var self=this,$self=this;
  39263. return $core.withContext(function($ctx1) {
  39264. return $self._visitDagNode_(anIRTempDeclaration);
  39265. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  39266. },
  39267. args: ["anIRTempDeclaration"],
  39268. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  39269. referencedClasses: [],
  39270. messageSends: ["visitDagNode:"]
  39271. }),
  39272. $globals.IRVisitor);
  39273. $core.addMethod(
  39274. $core.method({
  39275. selector: "visitIRValue:",
  39276. protocol: "visiting",
  39277. fn: function (anIRValue){
  39278. var self=this,$self=this;
  39279. return $core.withContext(function($ctx1) {
  39280. return $self._visitDagNode_(anIRValue);
  39281. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  39282. },
  39283. args: ["anIRValue"],
  39284. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  39285. referencedClasses: [],
  39286. messageSends: ["visitDagNode:"]
  39287. }),
  39288. $globals.IRVisitor);
  39289. $core.addMethod(
  39290. $core.method({
  39291. selector: "visitIRVariable:",
  39292. protocol: "visiting",
  39293. fn: function (anIRVariable){
  39294. var self=this,$self=this;
  39295. return $core.withContext(function($ctx1) {
  39296. return $self._visitDagNode_(anIRVariable);
  39297. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  39298. },
  39299. args: ["anIRVariable"],
  39300. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  39301. referencedClasses: [],
  39302. messageSends: ["visitDagNode:"]
  39303. }),
  39304. $globals.IRVisitor);
  39305. $core.addMethod(
  39306. $core.method({
  39307. selector: "visitIRVerbatim:",
  39308. protocol: "visiting",
  39309. fn: function (anIRVerbatim){
  39310. var self=this,$self=this;
  39311. return $core.withContext(function($ctx1) {
  39312. return $self._visitDagNode_(anIRVerbatim);
  39313. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  39314. },
  39315. args: ["anIRVerbatim"],
  39316. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  39317. referencedClasses: [],
  39318. messageSends: ["visitDagNode:"]
  39319. }),
  39320. $globals.IRVisitor);
  39321. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  39322. $core.addMethod(
  39323. $core.method({
  39324. selector: "contents",
  39325. protocol: "accessing",
  39326. fn: function (){
  39327. var self=this,$self=this;
  39328. return $core.withContext(function($ctx1) {
  39329. return $recv($self._stream())._contents();
  39330. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  39331. },
  39332. args: [],
  39333. source: "contents\x0a\x09^ self stream contents",
  39334. referencedClasses: [],
  39335. messageSends: ["contents", "stream"]
  39336. }),
  39337. $globals.IRJSTranslator);
  39338. $core.addMethod(
  39339. $core.method({
  39340. selector: "currentClass",
  39341. protocol: "accessing",
  39342. fn: function (){
  39343. var self=this,$self=this;
  39344. return $self["@currentClass"];
  39345. },
  39346. args: [],
  39347. source: "currentClass\x0a\x09^ currentClass",
  39348. referencedClasses: [],
  39349. messageSends: []
  39350. }),
  39351. $globals.IRJSTranslator);
  39352. $core.addMethod(
  39353. $core.method({
  39354. selector: "currentClass:",
  39355. protocol: "accessing",
  39356. fn: function (aClass){
  39357. var self=this,$self=this;
  39358. $self["@currentClass"]=aClass;
  39359. return self;
  39360. },
  39361. args: ["aClass"],
  39362. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  39363. referencedClasses: [],
  39364. messageSends: []
  39365. }),
  39366. $globals.IRJSTranslator);
  39367. $core.addMethod(
  39368. $core.method({
  39369. selector: "initialize",
  39370. protocol: "initialization",
  39371. fn: function (){
  39372. var self=this,$self=this;
  39373. return $core.withContext(function($ctx1) {
  39374. (
  39375. $ctx1.supercall = true,
  39376. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  39377. $ctx1.supercall = false;
  39378. $self["@stream"]=$recv($globals.JSStream)._new();
  39379. return self;
  39380. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  39381. },
  39382. args: [],
  39383. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  39384. referencedClasses: ["JSStream"],
  39385. messageSends: ["initialize", "new"]
  39386. }),
  39387. $globals.IRJSTranslator);
  39388. $core.addMethod(
  39389. $core.method({
  39390. selector: "stream",
  39391. protocol: "accessing",
  39392. fn: function (){
  39393. var self=this,$self=this;
  39394. return $self["@stream"];
  39395. },
  39396. args: [],
  39397. source: "stream\x0a\x09^ stream",
  39398. referencedClasses: [],
  39399. messageSends: []
  39400. }),
  39401. $globals.IRJSTranslator);
  39402. $core.addMethod(
  39403. $core.method({
  39404. selector: "stream:",
  39405. protocol: "accessing",
  39406. fn: function (aStream){
  39407. var self=this,$self=this;
  39408. $self["@stream"]=aStream;
  39409. return self;
  39410. },
  39411. args: ["aStream"],
  39412. source: "stream: aStream\x0a\x09stream := aStream",
  39413. referencedClasses: [],
  39414. messageSends: []
  39415. }),
  39416. $globals.IRJSTranslator);
  39417. $core.addMethod(
  39418. $core.method({
  39419. selector: "visitIRAssignment:",
  39420. protocol: "visiting",
  39421. fn: function (anIRAssignment){
  39422. var self=this,$self=this;
  39423. return $core.withContext(function($ctx1) {
  39424. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  39425. return $core.withContext(function($ctx2) {
  39426. return $self._visit_($recv(anIRAssignment)._left());
  39427. $ctx2.sendIdx["visit:"]=1;
  39428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39429. }),(function(){
  39430. return $core.withContext(function($ctx2) {
  39431. return $self._visit_($recv(anIRAssignment)._right());
  39432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39433. }));
  39434. return self;
  39435. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  39436. },
  39437. args: ["anIRAssignment"],
  39438. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  39439. referencedClasses: [],
  39440. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  39441. }),
  39442. $globals.IRJSTranslator);
  39443. $core.addMethod(
  39444. $core.method({
  39445. selector: "visitIRClosure:",
  39446. protocol: "visiting",
  39447. fn: function (anIRClosure){
  39448. var self=this,$self=this;
  39449. return $core.withContext(function($ctx1) {
  39450. var $1,$2;
  39451. $1=$self._stream();
  39452. $ctx1.sendIdx["stream"]=1;
  39453. $recv($1)._nextPutClosureWith_arguments_((function(){
  39454. return $core.withContext(function($ctx2) {
  39455. $2=$self._stream();
  39456. $ctx2.sendIdx["stream"]=2;
  39457. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  39458. return $core.withContext(function($ctx3) {
  39459. return $recv($recv(each)._name())._asVariableName();
  39460. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39461. })));
  39462. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  39463. return $core.withContext(function($ctx3) {
  39464. return (
  39465. $ctx3.supercall = true,
  39466. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  39467. $ctx3.supercall = false;
  39468. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  39469. }));
  39470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39471. }),$recv(anIRClosure)._arguments());
  39472. return self;
  39473. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  39474. },
  39475. args: ["anIRClosure"],
  39476. 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",
  39477. referencedClasses: [],
  39478. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  39479. }),
  39480. $globals.IRJSTranslator);
  39481. $core.addMethod(
  39482. $core.method({
  39483. selector: "visitIRDynamicArray:",
  39484. protocol: "visiting",
  39485. fn: function (anIRDynamicArray){
  39486. var self=this,$self=this;
  39487. return $core.withContext(function($ctx1) {
  39488. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  39489. return self;
  39490. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  39491. },
  39492. args: ["anIRDynamicArray"],
  39493. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  39494. referencedClasses: [],
  39495. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  39496. }),
  39497. $globals.IRJSTranslator);
  39498. $core.addMethod(
  39499. $core.method({
  39500. selector: "visitIRDynamicDictionary:",
  39501. protocol: "visiting",
  39502. fn: function (anIRDynamicDictionary){
  39503. var self=this,$self=this;
  39504. return $core.withContext(function($ctx1) {
  39505. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  39506. return self;
  39507. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  39508. },
  39509. args: ["anIRDynamicDictionary"],
  39510. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  39511. referencedClasses: [],
  39512. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  39513. }),
  39514. $globals.IRJSTranslator);
  39515. $core.addMethod(
  39516. $core.method({
  39517. selector: "visitIRMethod:",
  39518. protocol: "visiting",
  39519. fn: function (anIRMethod){
  39520. var self=this,$self=this;
  39521. return $core.withContext(function($ctx1) {
  39522. var $1,$2,$3,$4,$5,$6,$7;
  39523. $1=$self._stream();
  39524. $ctx1.sendIdx["stream"]=1;
  39525. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  39526. return $core.withContext(function($ctx2) {
  39527. $2=$self._stream();
  39528. $ctx2.sendIdx["stream"]=2;
  39529. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  39530. return $core.withContext(function($ctx3) {
  39531. $3=$self._stream();
  39532. $ctx3.sendIdx["stream"]=3;
  39533. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  39534. return $core.withContext(function($ctx4) {
  39535. return $recv($recv(each)._name())._asVariableName();
  39536. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39537. }));
  39538. $ctx3.sendIdx["collect:"]=1;
  39539. $recv($3)._nextPutVars_($4);
  39540. $ctx3.sendIdx["nextPutVars:"]=1;
  39541. $5=$self._stream();
  39542. $ctx3.sendIdx["stream"]=4;
  39543. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  39544. return $core.withContext(function($ctx4) {
  39545. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  39546. return $core.withContext(function($ctx5) {
  39547. $6=$self._stream();
  39548. $ctx5.sendIdx["stream"]=5;
  39549. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  39550. return $core.withContext(function($ctx6) {
  39551. return $recv($recv(each)._variable())._alias();
  39552. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  39553. })));
  39554. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  39555. }));
  39556. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  39557. if($core.assert($7)){
  39558. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  39559. return $core.withContext(function($ctx5) {
  39560. return (
  39561. $ctx5.supercall = true,
  39562. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  39563. $ctx5.supercall = false;
  39564. $ctx5.sendIdx["visitIRMethod:"]=1;
  39565. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  39566. }));
  39567. } else {
  39568. return (
  39569. $ctx4.supercall = true,
  39570. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  39571. $ctx4.supercall = false;
  39572. }
  39573. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  39574. }));
  39575. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39576. }),$recv(anIRMethod)._arguments());
  39577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39578. }));
  39579. return $self._contents();
  39580. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  39581. },
  39582. args: ["anIRMethod"],
  39583. 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\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09\x09anIRMethod internalVariables ifNotEmpty: [ :internalVars |\x0a\x09\x09\x09\x09\x09\x09self stream nextPutVars: \x0a\x09\x09\x09\x09\x09\x09\x09(internalVars asSet collect: [ :each | each 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 ].\x0a\x09^ self contents",
  39584. referencedClasses: [],
  39585. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifNotEmpty:", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments", "contents"]
  39586. }),
  39587. $globals.IRJSTranslator);
  39588. $core.addMethod(
  39589. $core.method({
  39590. selector: "visitIRNonLocalReturn:",
  39591. protocol: "visiting",
  39592. fn: function (anIRNonLocalReturn){
  39593. var self=this,$self=this;
  39594. return $core.withContext(function($ctx1) {
  39595. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  39596. return $core.withContext(function($ctx2) {
  39597. return (
  39598. $ctx2.supercall = true,
  39599. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  39600. $ctx2.supercall = false;
  39601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39602. }));
  39603. return self;
  39604. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  39605. },
  39606. args: ["anIRNonLocalReturn"],
  39607. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  39608. referencedClasses: [],
  39609. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  39610. }),
  39611. $globals.IRJSTranslator);
  39612. $core.addMethod(
  39613. $core.method({
  39614. selector: "visitIRReturn:",
  39615. protocol: "visiting",
  39616. fn: function (anIRReturn){
  39617. var self=this,$self=this;
  39618. return $core.withContext(function($ctx1) {
  39619. $recv($self._stream())._nextPutReturnWith_((function(){
  39620. return $core.withContext(function($ctx2) {
  39621. return (
  39622. $ctx2.supercall = true,
  39623. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  39624. $ctx2.supercall = false;
  39625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39626. }));
  39627. return self;
  39628. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  39629. },
  39630. args: ["anIRReturn"],
  39631. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  39632. referencedClasses: [],
  39633. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  39634. }),
  39635. $globals.IRJSTranslator);
  39636. $core.addMethod(
  39637. $core.method({
  39638. selector: "visitIRSend:",
  39639. protocol: "visiting",
  39640. fn: function (anIRSend){
  39641. var self=this,$self=this;
  39642. var sends,superclass;
  39643. return $core.withContext(function($ctx1) {
  39644. var $1,$2;
  39645. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  39646. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  39647. if($core.assert($1)){
  39648. $self._visitSuperSend_(anIRSend);
  39649. } else {
  39650. $self._visitSend_(anIRSend);
  39651. }
  39652. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  39653. if($core.assert($2)){
  39654. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  39655. }
  39656. return self;
  39657. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  39658. },
  39659. args: ["anIRSend"],
  39660. source: "visitIRSend: anIRSend\x0a\x09| sends superclass |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend receiver isSuper\x0a\x09\x09ifTrue: [ self visitSuperSend: anIRSend ]\x0a\x09\x09ifFalse: [ self visitSend: anIRSend ].\x0a\x09\x09\x0a\x09anIRSend index < sends\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  39661. referencedClasses: [],
  39662. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  39663. }),
  39664. $globals.IRJSTranslator);
  39665. $core.addMethod(
  39666. $core.method({
  39667. selector: "visitIRSequence:",
  39668. protocol: "visiting",
  39669. fn: function (anIRSequence){
  39670. var self=this,$self=this;
  39671. return $core.withContext(function($ctx1) {
  39672. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  39673. return $core.withContext(function($ctx2) {
  39674. return $recv($self._stream())._nextPutStatementWith_((function(){
  39675. return $core.withContext(function($ctx3) {
  39676. return $self._visit_(each);
  39677. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39678. }));
  39679. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39680. }));
  39681. return self;
  39682. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  39683. },
  39684. args: ["anIRSequence"],
  39685. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  39686. referencedClasses: [],
  39687. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  39688. }),
  39689. $globals.IRJSTranslator);
  39690. $core.addMethod(
  39691. $core.method({
  39692. selector: "visitIRTempDeclaration:",
  39693. protocol: "visiting",
  39694. fn: function (anIRTempDeclaration){
  39695. var self=this,$self=this;
  39696. return self;
  39697. },
  39698. args: ["anIRTempDeclaration"],
  39699. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  39700. referencedClasses: [],
  39701. messageSends: []
  39702. }),
  39703. $globals.IRJSTranslator);
  39704. $core.addMethod(
  39705. $core.method({
  39706. selector: "visitIRValue:",
  39707. protocol: "visiting",
  39708. fn: function (anIRValue){
  39709. var self=this,$self=this;
  39710. return $core.withContext(function($ctx1) {
  39711. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  39712. return self;
  39713. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  39714. },
  39715. args: ["anIRValue"],
  39716. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  39717. referencedClasses: [],
  39718. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  39719. }),
  39720. $globals.IRJSTranslator);
  39721. $core.addMethod(
  39722. $core.method({
  39723. selector: "visitIRVariable:",
  39724. protocol: "visiting",
  39725. fn: function (anIRVariable){
  39726. var self=this,$self=this;
  39727. return $core.withContext(function($ctx1) {
  39728. var $3,$2,$1,$4;
  39729. $3=$recv(anIRVariable)._variable();
  39730. $ctx1.sendIdx["variable"]=1;
  39731. $2=$recv($3)._name();
  39732. $1=$recv($2).__eq("thisContext");
  39733. if($core.assert($1)){
  39734. $4=$self._stream();
  39735. $ctx1.sendIdx["stream"]=1;
  39736. $recv($4)._nextPutAll_("$core.getThisContext()");
  39737. $ctx1.sendIdx["nextPutAll:"]=1;
  39738. } else {
  39739. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  39740. }
  39741. return self;
  39742. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  39743. },
  39744. args: ["anIRVariable"],
  39745. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: '$core.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  39746. referencedClasses: [],
  39747. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  39748. }),
  39749. $globals.IRJSTranslator);
  39750. $core.addMethod(
  39751. $core.method({
  39752. selector: "visitIRVerbatim:",
  39753. protocol: "visiting",
  39754. fn: function (anIRVerbatim){
  39755. var self=this,$self=this;
  39756. return $core.withContext(function($ctx1) {
  39757. var $1;
  39758. $1=$self._stream();
  39759. $ctx1.sendIdx["stream"]=1;
  39760. $recv($1)._nextPutStatementWith_((function(){
  39761. return $core.withContext(function($ctx2) {
  39762. return $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  39763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39764. }));
  39765. return self;
  39766. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  39767. },
  39768. args: ["anIRVerbatim"],
  39769. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  39770. referencedClasses: [],
  39771. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  39772. }),
  39773. $globals.IRJSTranslator);
  39774. $core.addMethod(
  39775. $core.method({
  39776. selector: "visitInstructionList:enclosedBetween:and:",
  39777. protocol: "visiting",
  39778. fn: function (anArray,aString,anotherString){
  39779. var self=this,$self=this;
  39780. return $core.withContext(function($ctx1) {
  39781. var $1;
  39782. $1=$self._stream();
  39783. $ctx1.sendIdx["stream"]=1;
  39784. $recv($1)._nextPutAll_(aString);
  39785. $ctx1.sendIdx["nextPutAll:"]=1;
  39786. $recv(anArray)._do_separatedBy_((function(each){
  39787. return $core.withContext(function($ctx2) {
  39788. return $self._visit_(each);
  39789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39790. }),(function(){
  39791. return $core.withContext(function($ctx2) {
  39792. return $recv($self._stream())._nextPutAll_(",");
  39793. $ctx2.sendIdx["nextPutAll:"]=2;
  39794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39795. }));
  39796. $recv($self["@stream"])._nextPutAll_(anotherString);
  39797. return self;
  39798. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  39799. },
  39800. args: ["anArray", "aString", "anotherString"],
  39801. source: "visitInstructionList: anArray enclosedBetween: aString and: anotherString\x0a\x09self stream nextPutAll: aString.\x0a\x09anArray\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: anotherString",
  39802. referencedClasses: [],
  39803. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  39804. }),
  39805. $globals.IRJSTranslator);
  39806. $core.addMethod(
  39807. $core.method({
  39808. selector: "visitReceiver:",
  39809. protocol: "visiting",
  39810. fn: function (anIRInstruction){
  39811. var self=this,$self=this;
  39812. var instr;
  39813. return $core.withContext(function($ctx1) {
  39814. var $1,$2,$4,$5,$3,$6,$7,$8;
  39815. $1=$recv(anIRInstruction)._isSelf();
  39816. if($core.assert($1)){
  39817. $2=$recv(anIRInstruction)._copy();
  39818. $ctx1.sendIdx["copy"]=1;
  39819. $4=$recv($recv(anIRInstruction)._variable())._copy();
  39820. $recv($4)._name_("$self");
  39821. $5=$recv($4)._yourself();
  39822. $ctx1.sendIdx["yourself"]=1;
  39823. $3=$5;
  39824. $recv($2)._variable_($3);
  39825. instr=$recv($2)._yourself();
  39826. instr;
  39827. } else {
  39828. instr=anIRInstruction;
  39829. instr;
  39830. }
  39831. $6=$recv(instr)._needsBoxingAsReceiver();
  39832. if(!$core.assert($6)){
  39833. $7=$self._visit_(instr);
  39834. $ctx1.sendIdx["visit:"]=1;
  39835. return $7;
  39836. }
  39837. $8=$self._stream();
  39838. $ctx1.sendIdx["stream"]=1;
  39839. $recv($8)._nextPutAll_("$recv(");
  39840. $ctx1.sendIdx["nextPutAll:"]=1;
  39841. $self._visit_(instr);
  39842. $recv($self._stream())._nextPutAll_(")");
  39843. return self;
  39844. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  39845. },
  39846. args: ["anIRInstruction"],
  39847. source: "visitReceiver: anIRInstruction\x0a\x09| instr |\x0a\x0a\x09anIRInstruction isSelf\x0a\x09\x09ifTrue: [ instr := anIRInstruction copy\x0a\x09\x09\x09variable: (anIRInstruction variable copy name: '$self'; yourself);\x0a\x09\x09\x09yourself ]\x0a\x09\x09ifFalse: [ instr := anIRInstruction ].\x0a\x09\x0a\x09instr needsBoxingAsReceiver ifFalse: [ ^ self visit: instr ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: instr.\x0a\x09self stream nextPutAll: ')'",
  39848. referencedClasses: [],
  39849. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  39850. }),
  39851. $globals.IRJSTranslator);
  39852. $core.addMethod(
  39853. $core.method({
  39854. selector: "visitSend:",
  39855. protocol: "visiting",
  39856. fn: function (anIRSend){
  39857. var self=this,$self=this;
  39858. return $core.withContext(function($ctx1) {
  39859. $self._visitReceiver_($recv(anIRSend)._receiver());
  39860. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  39861. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  39862. return self;
  39863. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39864. },
  39865. args: ["anIRSend"],
  39866. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend receiver.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '(' and: ')'",
  39867. referencedClasses: [],
  39868. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  39869. }),
  39870. $globals.IRJSTranslator);
  39871. $core.addMethod(
  39872. $core.method({
  39873. selector: "visitSuperSend:",
  39874. protocol: "visiting",
  39875. fn: function (anIRSend){
  39876. var self=this,$self=this;
  39877. return $core.withContext(function($ctx1) {
  39878. var $1,$4,$3,$2,$5,$6,$7,$8;
  39879. $1=$self._stream();
  39880. $ctx1.sendIdx["stream"]=1;
  39881. $recv($1)._nextPutAll_("(");
  39882. $ctx1.sendIdx["nextPutAll:"]=1;
  39883. $recv($1)._lf();
  39884. $ctx1.sendIdx["lf"]=1;
  39885. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39886. $ctx1.sendIdx["nextPutAll:"]=2;
  39887. $recv($1)._lf();
  39888. $ctx1.sendIdx["lf"]=2;
  39889. $4=$recv(anIRSend)._scope();
  39890. $ctx1.sendIdx["scope"]=1;
  39891. $3=$recv($4)._alias();
  39892. $ctx1.sendIdx["alias"]=1;
  39893. $2=$recv($3).__comma(".supercall = true,");
  39894. $ctx1.sendIdx[","]=1;
  39895. $recv($1)._nextPutAll_($2);
  39896. $ctx1.sendIdx["nextPutAll:"]=3;
  39897. $recv($1)._lf();
  39898. $ctx1.sendIdx["lf"]=3;
  39899. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39900. $ctx1.sendIdx["nextPutAll:"]=4;
  39901. $recv($1)._lf();
  39902. $ctx1.sendIdx["lf"]=4;
  39903. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  39904. $ctx1.sendIdx[","]=2;
  39905. $recv($1)._nextPutAll_($5);
  39906. $ctx1.sendIdx["nextPutAll:"]=5;
  39907. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  39908. $ctx1.sendIdx["nextPutAll:"]=6;
  39909. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  39910. $ctx1.sendIdx[","]=3;
  39911. $recv($1)._nextPutAll_($6);
  39912. $ctx1.sendIdx["nextPutAll:"]=7;
  39913. $7=$recv($1)._nextPutAll_("$self, ");
  39914. $ctx1.sendIdx["nextPutAll:"]=8;
  39915. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  39916. $8=$self._stream();
  39917. $recv($8)._nextPutAll_("));");
  39918. $ctx1.sendIdx["nextPutAll:"]=9;
  39919. $recv($8)._lf();
  39920. $ctx1.sendIdx["lf"]=5;
  39921. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39922. $ctx1.sendIdx["nextPutAll:"]=10;
  39923. $recv($8)._lf();
  39924. $ctx1.sendIdx["lf"]=6;
  39925. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  39926. $ctx1.sendIdx["nextPutAll:"]=11;
  39927. $recv($8)._lf();
  39928. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39929. return self;
  39930. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39931. },
  39932. args: ["anIRSend"],
  39933. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true,'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: '(', self currentClass asJavaScriptSource;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$self, '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream \x0a\x09\x09nextPutAll: '));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  39934. referencedClasses: [],
  39935. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  39936. }),
  39937. $globals.IRJSTranslator);
  39938. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  39939. $core.addMethod(
  39940. $core.method({
  39941. selector: "contents",
  39942. protocol: "accessing",
  39943. fn: function (){
  39944. var self=this,$self=this;
  39945. return $core.withContext(function($ctx1) {
  39946. return $recv($self["@stream"])._contents();
  39947. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  39948. },
  39949. args: [],
  39950. source: "contents\x0a\x09^ stream contents",
  39951. referencedClasses: [],
  39952. messageSends: ["contents"]
  39953. }),
  39954. $globals.JSStream);
  39955. $core.addMethod(
  39956. $core.method({
  39957. selector: "initialize",
  39958. protocol: "initialization",
  39959. fn: function (){
  39960. var self=this,$self=this;
  39961. return $core.withContext(function($ctx1) {
  39962. (
  39963. $ctx1.supercall = true,
  39964. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  39965. $ctx1.supercall = false;
  39966. $self["@stream"]=""._writeStream();
  39967. return self;
  39968. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  39969. },
  39970. args: [],
  39971. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  39972. referencedClasses: [],
  39973. messageSends: ["initialize", "writeStream"]
  39974. }),
  39975. $globals.JSStream);
  39976. $core.addMethod(
  39977. $core.method({
  39978. selector: "lf",
  39979. protocol: "streaming",
  39980. fn: function (){
  39981. var self=this,$self=this;
  39982. return $core.withContext(function($ctx1) {
  39983. $recv($self["@stream"])._lf();
  39984. return self;
  39985. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  39986. },
  39987. args: [],
  39988. source: "lf\x0a\x09stream lf",
  39989. referencedClasses: [],
  39990. messageSends: ["lf"]
  39991. }),
  39992. $globals.JSStream);
  39993. $core.addMethod(
  39994. $core.method({
  39995. selector: "nextPut:",
  39996. protocol: "streaming",
  39997. fn: function (aString){
  39998. var self=this,$self=this;
  39999. return $core.withContext(function($ctx1) {
  40000. $recv($self["@stream"])._nextPut_(aString);
  40001. return self;
  40002. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  40003. },
  40004. args: ["aString"],
  40005. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  40006. referencedClasses: [],
  40007. messageSends: ["nextPut:"]
  40008. }),
  40009. $globals.JSStream);
  40010. $core.addMethod(
  40011. $core.method({
  40012. selector: "nextPutAll:",
  40013. protocol: "streaming",
  40014. fn: function (aString){
  40015. var self=this,$self=this;
  40016. return $core.withContext(function($ctx1) {
  40017. $recv($self["@stream"])._nextPutAll_(aString);
  40018. return self;
  40019. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  40020. },
  40021. args: ["aString"],
  40022. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  40023. referencedClasses: [],
  40024. messageSends: ["nextPutAll:"]
  40025. }),
  40026. $globals.JSStream);
  40027. $core.addMethod(
  40028. $core.method({
  40029. selector: "nextPutAssignLhs:rhs:",
  40030. protocol: "streaming",
  40031. fn: function (aBlock,anotherBlock){
  40032. var self=this,$self=this;
  40033. return $core.withContext(function($ctx1) {
  40034. $recv(aBlock)._value();
  40035. $ctx1.sendIdx["value"]=1;
  40036. $recv($self["@stream"])._nextPutAll_("=");
  40037. $recv(anotherBlock)._value();
  40038. return self;
  40039. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  40040. },
  40041. args: ["aBlock", "anotherBlock"],
  40042. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  40043. referencedClasses: [],
  40044. messageSends: ["value", "nextPutAll:"]
  40045. }),
  40046. $globals.JSStream);
  40047. $core.addMethod(
  40048. $core.method({
  40049. selector: "nextPutBlockContextFor:during:",
  40050. protocol: "streaming",
  40051. fn: function (anIRClosure,aBlock){
  40052. var self=this,$self=this;
  40053. return $core.withContext(function($ctx1) {
  40054. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  40055. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  40056. if(!$core.assert($1)){
  40057. $2=$recv(aBlock)._value();
  40058. $ctx1.sendIdx["value"]=1;
  40059. return $2;
  40060. }
  40061. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40062. $ctx1.sendIdx["nextPutAll:"]=1;
  40063. $self._lf();
  40064. $ctx1.sendIdx["lf"]=1;
  40065. $6=$recv(anIRClosure)._scope();
  40066. $ctx1.sendIdx["scope"]=1;
  40067. $5=$recv($6)._alias();
  40068. $ctx1.sendIdx["alias"]=1;
  40069. $4="return $core.withContext(function(".__comma($5);
  40070. $ctx1.sendIdx[","]=2;
  40071. $3=$recv($4).__comma(") {");
  40072. $ctx1.sendIdx[","]=1;
  40073. $self._nextPutAll_($3);
  40074. $ctx1.sendIdx["nextPutAll:"]=2;
  40075. $self._lf();
  40076. $ctx1.sendIdx["lf"]=2;
  40077. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40078. $ctx1.sendIdx["nextPutAll:"]=3;
  40079. $7=$self._lf();
  40080. $ctx1.sendIdx["lf"]=3;
  40081. $recv(aBlock)._value();
  40082. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40083. $ctx1.sendIdx["nextPutAll:"]=4;
  40084. $self._lf();
  40085. $ctx1.sendIdx["lf"]=4;
  40086. $11=$recv(anIRClosure)._scope();
  40087. $ctx1.sendIdx["scope"]=2;
  40088. $10=$recv($11)._alias();
  40089. $ctx1.sendIdx["alias"]=2;
  40090. $9="}, function(".__comma($10);
  40091. $ctx1.sendIdx[","]=4;
  40092. $8=$recv($9).__comma(") {");
  40093. $ctx1.sendIdx[","]=3;
  40094. $self._nextPutAll_($8);
  40095. $ctx1.sendIdx["nextPutAll:"]=5;
  40096. $15=$recv(anIRClosure)._scope();
  40097. $ctx1.sendIdx["scope"]=3;
  40098. $14=$recv($15)._alias();
  40099. $ctx1.sendIdx["alias"]=3;
  40100. $13=$recv($14).__comma(".fillBlock({");
  40101. $ctx1.sendIdx[","]=5;
  40102. $12=$self._nextPutAll_($13);
  40103. $ctx1.sendIdx["nextPutAll:"]=6;
  40104. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  40105. return $core.withContext(function($ctx2) {
  40106. $16=$recv(each)._asVariableName();
  40107. $ctx2.sendIdx["asVariableName"]=1;
  40108. $self._nextPutAll_($16);
  40109. $ctx2.sendIdx["nextPutAll:"]=7;
  40110. $self._nextPutAll_(":");
  40111. $ctx2.sendIdx["nextPutAll:"]=8;
  40112. $17=$self._nextPutAll_($recv(each)._asVariableName());
  40113. $ctx2.sendIdx["nextPutAll:"]=9;
  40114. return $17;
  40115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40116. }),(function(){
  40117. return $core.withContext(function($ctx2) {
  40118. return $self._nextPutAll_(",");
  40119. $ctx2.sendIdx["nextPutAll:"]=10;
  40120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40121. }));
  40122. $self._nextPutAll_("},");
  40123. $ctx1.sendIdx["nextPutAll:"]=11;
  40124. $23=$recv(anIRClosure)._scope();
  40125. $ctx1.sendIdx["scope"]=4;
  40126. $22=$recv($23)._outerScope();
  40127. $21=$recv($22)._alias();
  40128. $20=$recv($21).__comma(",");
  40129. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  40130. $ctx1.sendIdx[","]=7;
  40131. $18=$recv($19).__comma(")});");
  40132. $ctx1.sendIdx[","]=6;
  40133. $self._nextPutAll_($18);
  40134. $ctx1.sendIdx["nextPutAll:"]=12;
  40135. $self._lf();
  40136. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40137. return self;
  40138. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  40139. },
  40140. args: ["anIRClosure", "aBlock"],
  40141. source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', anIRClosure scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  40142. referencedClasses: [],
  40143. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  40144. }),
  40145. $globals.JSStream);
  40146. $core.addMethod(
  40147. $core.method({
  40148. selector: "nextPutClosureWith:arguments:",
  40149. protocol: "streaming",
  40150. fn: function (aBlock,anArray){
  40151. var self=this,$self=this;
  40152. return $core.withContext(function($ctx1) {
  40153. var $1,$2,$3;
  40154. $recv($self["@stream"])._nextPutAll_("(function(");
  40155. $ctx1.sendIdx["nextPutAll:"]=1;
  40156. $recv(anArray)._do_separatedBy_((function(each){
  40157. return $core.withContext(function($ctx2) {
  40158. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  40159. $ctx2.sendIdx["nextPutAll:"]=2;
  40160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40161. }),(function(){
  40162. return $core.withContext(function($ctx2) {
  40163. return $recv($self["@stream"])._nextPut_(",");
  40164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40165. }));
  40166. $1=$self["@stream"];
  40167. $recv($1)._nextPutAll_("){");
  40168. $ctx1.sendIdx["nextPutAll:"]=3;
  40169. $2=$recv($1)._lf();
  40170. $ctx1.sendIdx["lf"]=1;
  40171. $recv(aBlock)._value();
  40172. $3=$self["@stream"];
  40173. $recv($3)._lf();
  40174. $recv($3)._nextPutAll_("})");
  40175. return self;
  40176. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  40177. },
  40178. args: ["aBlock", "anArray"],
  40179. 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 lf; nextPutAll: '})'",
  40180. referencedClasses: [],
  40181. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  40182. }),
  40183. $globals.JSStream);
  40184. $core.addMethod(
  40185. $core.method({
  40186. selector: "nextPutContextFor:during:",
  40187. protocol: "streaming",
  40188. fn: function (aMethod,aBlock){
  40189. var self=this,$self=this;
  40190. return $core.withContext(function($ctx1) {
  40191. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  40192. $1=$recv(aMethod)._requiresSmalltalkContext();
  40193. if(!$core.assert($1)){
  40194. $2=$recv(aBlock)._value();
  40195. $ctx1.sendIdx["value"]=1;
  40196. return $2;
  40197. }
  40198. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40199. $ctx1.sendIdx["nextPutAll:"]=1;
  40200. $self._lf();
  40201. $ctx1.sendIdx["lf"]=1;
  40202. $6=$recv(aMethod)._scope();
  40203. $ctx1.sendIdx["scope"]=1;
  40204. $5=$recv($6)._alias();
  40205. $ctx1.sendIdx["alias"]=1;
  40206. $4="return $core.withContext(function(".__comma($5);
  40207. $ctx1.sendIdx[","]=2;
  40208. $3=$recv($4).__comma(") {");
  40209. $ctx1.sendIdx[","]=1;
  40210. $self._nextPutAll_($3);
  40211. $ctx1.sendIdx["nextPutAll:"]=2;
  40212. $self._lf();
  40213. $ctx1.sendIdx["lf"]=2;
  40214. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40215. $ctx1.sendIdx["nextPutAll:"]=3;
  40216. $7=$self._lf();
  40217. $ctx1.sendIdx["lf"]=3;
  40218. $recv(aBlock)._value();
  40219. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40220. $ctx1.sendIdx["nextPutAll:"]=4;
  40221. $self._lf();
  40222. $ctx1.sendIdx["lf"]=4;
  40223. $12=$recv(aMethod)._scope();
  40224. $ctx1.sendIdx["scope"]=2;
  40225. $11=$recv($12)._alias();
  40226. $ctx1.sendIdx["alias"]=2;
  40227. $10="}, function(".__comma($11);
  40228. $ctx1.sendIdx[","]=5;
  40229. $9=$recv($10).__comma(") {");
  40230. $ctx1.sendIdx[","]=4;
  40231. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  40232. $ctx1.sendIdx[","]=3;
  40233. $self._nextPutAll_($8);
  40234. $ctx1.sendIdx["nextPutAll:"]=5;
  40235. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  40236. $ctx1.sendIdx["asJavaScriptSource"]=1;
  40237. $15=".fill(self,".__comma($16);
  40238. $14=$recv($15).__comma(",{");
  40239. $ctx1.sendIdx[","]=6;
  40240. $13=$self._nextPutAll_($14);
  40241. $ctx1.sendIdx["nextPutAll:"]=6;
  40242. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  40243. return $core.withContext(function($ctx2) {
  40244. $17=$recv(each)._asVariableName();
  40245. $ctx2.sendIdx["asVariableName"]=1;
  40246. $self._nextPutAll_($17);
  40247. $ctx2.sendIdx["nextPutAll:"]=7;
  40248. $self._nextPutAll_(":");
  40249. $ctx2.sendIdx["nextPutAll:"]=8;
  40250. $18=$self._nextPutAll_($recv(each)._asVariableName());
  40251. $ctx2.sendIdx["nextPutAll:"]=9;
  40252. return $18;
  40253. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40254. }),(function(){
  40255. return $core.withContext(function($ctx2) {
  40256. return $self._nextPutAll_(",");
  40257. $ctx2.sendIdx["nextPutAll:"]=10;
  40258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40259. }));
  40260. $self._nextPutAll_("},");
  40261. $ctx1.sendIdx["nextPutAll:"]=11;
  40262. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  40263. $ctx1.sendIdx["nextPutAll:"]=12;
  40264. $self._nextPutAll_(")});");
  40265. $ctx1.sendIdx["nextPutAll:"]=13;
  40266. $self._lf();
  40267. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40268. return self;
  40269. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  40270. },
  40271. args: ["aMethod", "aBlock"],
  40272. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', aMethod scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavaScriptSource, ',{'.\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 asJavaScriptSource;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  40273. referencedClasses: [],
  40274. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  40275. }),
  40276. $globals.JSStream);
  40277. $core.addMethod(
  40278. $core.method({
  40279. selector: "nextPutFunctionWith:arguments:",
  40280. protocol: "streaming",
  40281. fn: function (aBlock,anArray){
  40282. var self=this,$self=this;
  40283. return $core.withContext(function($ctx1) {
  40284. var $1,$2,$3,$4,$5;
  40285. $recv($self["@stream"])._nextPutAll_("fn: function(");
  40286. $ctx1.sendIdx["nextPutAll:"]=1;
  40287. $recv(anArray)._do_separatedBy_((function(each){
  40288. return $core.withContext(function($ctx2) {
  40289. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  40290. $ctx2.sendIdx["nextPutAll:"]=2;
  40291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40292. }),(function(){
  40293. return $core.withContext(function($ctx2) {
  40294. return $recv($self["@stream"])._nextPut_(",");
  40295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40296. }));
  40297. $1=$self["@stream"];
  40298. $recv($1)._nextPutAll_("){");
  40299. $ctx1.sendIdx["nextPutAll:"]=3;
  40300. $2=$recv($1)._lf();
  40301. $ctx1.sendIdx["lf"]=1;
  40302. $3=$self["@stream"];
  40303. $recv($3)._nextPutAll_("var self=this,$self=this;");
  40304. $ctx1.sendIdx["nextPutAll:"]=4;
  40305. $4=$recv($3)._lf();
  40306. $ctx1.sendIdx["lf"]=2;
  40307. $recv(aBlock)._value();
  40308. $5=$self["@stream"];
  40309. $recv($5)._lf();
  40310. $recv($5)._nextPutAll_("}");
  40311. return self;
  40312. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  40313. },
  40314. args: ["aBlock", "anArray"],
  40315. 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,$self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  40316. referencedClasses: [],
  40317. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  40318. }),
  40319. $globals.JSStream);
  40320. $core.addMethod(
  40321. $core.method({
  40322. selector: "nextPutIf:then:",
  40323. protocol: "streaming",
  40324. fn: function (aBlock,anotherBlock){
  40325. var self=this,$self=this;
  40326. return $core.withContext(function($ctx1) {
  40327. var $1;
  40328. $recv($self["@stream"])._nextPutAll_("if(");
  40329. $ctx1.sendIdx["nextPutAll:"]=1;
  40330. $recv(aBlock)._value();
  40331. $ctx1.sendIdx["value"]=1;
  40332. $1=$self["@stream"];
  40333. $recv($1)._nextPutAll_("){");
  40334. $ctx1.sendIdx["nextPutAll:"]=2;
  40335. $recv($1)._lf();
  40336. $recv(anotherBlock)._value();
  40337. $recv($self["@stream"])._nextPutAll_("}");
  40338. $self._omitSemicolon_(true);
  40339. return self;
  40340. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  40341. },
  40342. args: ["aBlock", "anotherBlock"],
  40343. source: "nextPutIf: aBlock then: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'.\x0a\x09self omitSemicolon: true",
  40344. referencedClasses: [],
  40345. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  40346. }),
  40347. $globals.JSStream);
  40348. $core.addMethod(
  40349. $core.method({
  40350. selector: "nextPutIf:then:else:",
  40351. protocol: "streaming",
  40352. fn: function (aBlock,ifBlock,elseBlock){
  40353. var self=this,$self=this;
  40354. return $core.withContext(function($ctx1) {
  40355. var $1,$2,$3;
  40356. $recv($self["@stream"])._nextPutAll_("if(");
  40357. $ctx1.sendIdx["nextPutAll:"]=1;
  40358. $recv(aBlock)._value();
  40359. $ctx1.sendIdx["value"]=1;
  40360. $1=$self["@stream"];
  40361. $recv($1)._nextPutAll_("){");
  40362. $ctx1.sendIdx["nextPutAll:"]=2;
  40363. $2=$recv($1)._lf();
  40364. $ctx1.sendIdx["lf"]=1;
  40365. $recv(ifBlock)._value();
  40366. $ctx1.sendIdx["value"]=2;
  40367. $3=$self["@stream"];
  40368. $recv($3)._nextPutAll_("} else {");
  40369. $ctx1.sendIdx["nextPutAll:"]=3;
  40370. $recv($3)._lf();
  40371. $recv(elseBlock)._value();
  40372. $recv($self["@stream"])._nextPutAll_("}");
  40373. $self._omitSemicolon_(true);
  40374. return self;
  40375. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  40376. },
  40377. args: ["aBlock", "ifBlock", "elseBlock"],
  40378. source: "nextPutIf: aBlock then: ifBlock else: 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: '}'.\x0a\x09self omitSemicolon: true",
  40379. referencedClasses: [],
  40380. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  40381. }),
  40382. $globals.JSStream);
  40383. $core.addMethod(
  40384. $core.method({
  40385. selector: "nextPutMethodDeclaration:with:",
  40386. protocol: "streaming",
  40387. fn: function (aMethod,aBlock){
  40388. var self=this,$self=this;
  40389. return $core.withContext(function($ctx1) {
  40390. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  40391. $1=$self["@stream"];
  40392. $recv($1)._nextPutAll_("$core.method({");
  40393. $ctx1.sendIdx["nextPutAll:"]=1;
  40394. $recv($1)._lf();
  40395. $ctx1.sendIdx["lf"]=1;
  40396. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  40397. $ctx1.sendIdx["asJavaScriptSource"]=1;
  40398. $3="selector: ".__comma($4);
  40399. $ctx1.sendIdx[","]=2;
  40400. $2=$recv($3).__comma(",");
  40401. $ctx1.sendIdx[","]=1;
  40402. $recv($1)._nextPutAll_($2);
  40403. $ctx1.sendIdx["nextPutAll:"]=2;
  40404. $recv($1)._lf();
  40405. $ctx1.sendIdx["lf"]=2;
  40406. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  40407. $ctx1.sendIdx["asJavaScriptSource"]=2;
  40408. $6="source: ".__comma($7);
  40409. $ctx1.sendIdx[","]=4;
  40410. $5=$recv($6).__comma(",");
  40411. $ctx1.sendIdx[","]=3;
  40412. $recv($1)._nextPutAll_($5);
  40413. $ctx1.sendIdx["nextPutAll:"]=3;
  40414. $8=$recv($1)._lf();
  40415. $ctx1.sendIdx["lf"]=3;
  40416. $recv(aBlock)._value();
  40417. $ctx1.sendIdx["value"]=1;
  40418. $9=$self["@stream"];
  40419. $12=$recv($globals.String)._lf();
  40420. $ctx1.sendIdx["lf"]=4;
  40421. $11=",".__comma($12);
  40422. $ctx1.sendIdx[","]=6;
  40423. $10=$recv($11).__comma("messageSends: ");
  40424. $ctx1.sendIdx[","]=5;
  40425. $recv($9)._nextPutAll_($10);
  40426. $ctx1.sendIdx["nextPutAll:"]=4;
  40427. $15=$recv($recv(aMethod)._messageSends())._asArray();
  40428. $ctx1.sendIdx["asArray"]=1;
  40429. $14=$recv($15)._asJavaScriptSource();
  40430. $ctx1.sendIdx["asJavaScriptSource"]=3;
  40431. $13=$recv($14).__comma(",");
  40432. $ctx1.sendIdx[","]=7;
  40433. $recv($9)._nextPutAll_($13);
  40434. $ctx1.sendIdx["nextPutAll:"]=5;
  40435. $recv($9)._lf();
  40436. $ctx1.sendIdx["lf"]=5;
  40437. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  40438. return $core.withContext(function($ctx2) {
  40439. return $recv(each)._value();
  40440. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40441. })))._asArray())._asJavaScriptSource();
  40442. $ctx1.sendIdx["asJavaScriptSource"]=4;
  40443. $17="args: ".__comma($18);
  40444. $16=$recv($17).__comma(",");
  40445. $ctx1.sendIdx[","]=8;
  40446. $recv($9)._nextPutAll_($16);
  40447. $ctx1.sendIdx["nextPutAll:"]=6;
  40448. $recv($9)._lf();
  40449. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  40450. $ctx1.sendIdx["nextPutAll:"]=7;
  40451. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  40452. return $core.withContext(function($ctx2) {
  40453. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  40454. $ctx2.sendIdx["nextPutAll:"]=8;
  40455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40456. }),(function(){
  40457. return $core.withContext(function($ctx2) {
  40458. return $recv($self["@stream"])._nextPutAll_(",");
  40459. $ctx2.sendIdx["nextPutAll:"]=9;
  40460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40461. }));
  40462. $20=$self["@stream"];
  40463. $recv($20)._nextPutAll_("]");
  40464. $ctx1.sendIdx["nextPutAll:"]=10;
  40465. $recv($20)._nextPutAll_("})");
  40466. return self;
  40467. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  40468. },
  40469. args: ["aMethod", "aBlock"],
  40470. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: '$core.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavaScriptSource, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavaScriptSource ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  40471. referencedClasses: ["String"],
  40472. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  40473. }),
  40474. $globals.JSStream);
  40475. $core.addMethod(
  40476. $core.method({
  40477. selector: "nextPutNonLocalReturnHandlingWith:",
  40478. protocol: "streaming",
  40479. fn: function (aBlock){
  40480. var self=this,$self=this;
  40481. return $core.withContext(function($ctx1) {
  40482. var $1,$2,$3;
  40483. $1=$self["@stream"];
  40484. $recv($1)._nextPutAll_("var $early={};");
  40485. $ctx1.sendIdx["nextPutAll:"]=1;
  40486. $recv($1)._lf();
  40487. $ctx1.sendIdx["lf"]=1;
  40488. $recv($1)._nextPutAll_("try {");
  40489. $ctx1.sendIdx["nextPutAll:"]=2;
  40490. $2=$recv($1)._lf();
  40491. $ctx1.sendIdx["lf"]=2;
  40492. $recv(aBlock)._value();
  40493. $3=$self["@stream"];
  40494. $recv($3)._nextPutAll_("}");
  40495. $ctx1.sendIdx["nextPutAll:"]=3;
  40496. $recv($3)._lf();
  40497. $ctx1.sendIdx["lf"]=3;
  40498. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  40499. $recv($3)._lf();
  40500. return self;
  40501. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  40502. },
  40503. args: ["aBlock"],
  40504. 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",
  40505. referencedClasses: [],
  40506. messageSends: ["nextPutAll:", "lf", "value"]
  40507. }),
  40508. $globals.JSStream);
  40509. $core.addMethod(
  40510. $core.method({
  40511. selector: "nextPutNonLocalReturnWith:",
  40512. protocol: "streaming",
  40513. fn: function (aBlock){
  40514. var self=this,$self=this;
  40515. return $core.withContext(function($ctx1) {
  40516. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  40517. $ctx1.sendIdx["nextPutAll:"]=1;
  40518. $recv(aBlock)._value();
  40519. $recv($self["@stream"])._nextPutAll_("]");
  40520. return self;
  40521. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40522. },
  40523. args: ["aBlock"],
  40524. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  40525. referencedClasses: [],
  40526. messageSends: ["nextPutAll:", "value"]
  40527. }),
  40528. $globals.JSStream);
  40529. $core.addMethod(
  40530. $core.method({
  40531. selector: "nextPutReturnWith:",
  40532. protocol: "streaming",
  40533. fn: function (aBlock){
  40534. var self=this,$self=this;
  40535. return $core.withContext(function($ctx1) {
  40536. $recv($self["@stream"])._nextPutAll_("return ");
  40537. $recv(aBlock)._value();
  40538. return self;
  40539. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40540. },
  40541. args: ["aBlock"],
  40542. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  40543. referencedClasses: [],
  40544. messageSends: ["nextPutAll:", "value"]
  40545. }),
  40546. $globals.JSStream);
  40547. $core.addMethod(
  40548. $core.method({
  40549. selector: "nextPutSendIndexFor:",
  40550. protocol: "streaming",
  40551. fn: function (anIRSend){
  40552. var self=this,$self=this;
  40553. return $core.withContext(function($ctx1) {
  40554. $self._nextPutAll_(";");
  40555. $ctx1.sendIdx["nextPutAll:"]=1;
  40556. $self._lf();
  40557. $ctx1.sendIdx["lf"]=1;
  40558. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40559. $ctx1.sendIdx["nextPutAll:"]=2;
  40560. $self._lf();
  40561. $ctx1.sendIdx["lf"]=2;
  40562. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  40563. $ctx1.sendIdx["nextPutAll:"]=3;
  40564. $self._nextPutAll_(".sendIdx[");
  40565. $ctx1.sendIdx["nextPutAll:"]=4;
  40566. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  40567. $ctx1.sendIdx["nextPutAll:"]=5;
  40568. $self._nextPutAll_("]=");
  40569. $ctx1.sendIdx["nextPutAll:"]=6;
  40570. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  40571. $ctx1.sendIdx["nextPutAll:"]=7;
  40572. $self._nextPutAll_(";");
  40573. $ctx1.sendIdx["nextPutAll:"]=8;
  40574. $self._lf();
  40575. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  40576. return self;
  40577. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  40578. },
  40579. args: ["anIRSend"],
  40580. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptSource;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'",
  40581. referencedClasses: [],
  40582. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  40583. }),
  40584. $globals.JSStream);
  40585. $core.addMethod(
  40586. $core.method({
  40587. selector: "nextPutStatementWith:",
  40588. protocol: "streaming",
  40589. fn: function (aBlock){
  40590. var self=this,$self=this;
  40591. return $core.withContext(function($ctx1) {
  40592. var $1;
  40593. $self._omitSemicolon_(false);
  40594. $ctx1.sendIdx["omitSemicolon:"]=1;
  40595. $recv(aBlock)._value();
  40596. $1=$self._omitSemicolon();
  40597. if(!$core.assert($1)){
  40598. $recv($self["@stream"])._nextPutAll_(";");
  40599. }
  40600. $self._omitSemicolon_(false);
  40601. $recv($self["@stream"])._lf();
  40602. return self;
  40603. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  40604. },
  40605. args: ["aBlock"],
  40606. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  40607. referencedClasses: [],
  40608. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  40609. }),
  40610. $globals.JSStream);
  40611. $core.addMethod(
  40612. $core.method({
  40613. selector: "nextPutVars:",
  40614. protocol: "streaming",
  40615. fn: function (aCollection){
  40616. var self=this,$self=this;
  40617. return $core.withContext(function($ctx1) {
  40618. var $1;
  40619. $recv(aCollection)._ifNotEmpty_((function(){
  40620. return $core.withContext(function($ctx2) {
  40621. $recv($self["@stream"])._nextPutAll_("var ");
  40622. $ctx2.sendIdx["nextPutAll:"]=1;
  40623. $recv(aCollection)._do_separatedBy_((function(each){
  40624. return $core.withContext(function($ctx3) {
  40625. return $recv($self["@stream"])._nextPutAll_(each);
  40626. $ctx3.sendIdx["nextPutAll:"]=2;
  40627. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40628. }),(function(){
  40629. return $core.withContext(function($ctx3) {
  40630. return $recv($self["@stream"])._nextPutAll_(",");
  40631. $ctx3.sendIdx["nextPutAll:"]=3;
  40632. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  40633. }));
  40634. $1=$self["@stream"];
  40635. $recv($1)._nextPutAll_(";");
  40636. return $recv($1)._lf();
  40637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40638. }));
  40639. return self;
  40640. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  40641. },
  40642. args: ["aCollection"],
  40643. source: "nextPutVars: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09stream nextPutAll: 'var '.\x0a\x09\x09aCollection\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09\x09stream nextPutAll: ';'; lf ]",
  40644. referencedClasses: [],
  40645. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  40646. }),
  40647. $globals.JSStream);
  40648. $core.addMethod(
  40649. $core.method({
  40650. selector: "omitSemicolon",
  40651. protocol: "accessing",
  40652. fn: function (){
  40653. var self=this,$self=this;
  40654. return $self["@omitSemicolon"];
  40655. },
  40656. args: [],
  40657. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  40658. referencedClasses: [],
  40659. messageSends: []
  40660. }),
  40661. $globals.JSStream);
  40662. $core.addMethod(
  40663. $core.method({
  40664. selector: "omitSemicolon:",
  40665. protocol: "accessing",
  40666. fn: function (aBoolean){
  40667. var self=this,$self=this;
  40668. $self["@omitSemicolon"]=aBoolean;
  40669. return self;
  40670. },
  40671. args: ["aBoolean"],
  40672. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  40673. referencedClasses: [],
  40674. messageSends: []
  40675. }),
  40676. $globals.JSStream);
  40677. $core.addMethod(
  40678. $core.method({
  40679. selector: "isReferenced",
  40680. protocol: "*Compiler-IR",
  40681. fn: function (){
  40682. var self=this,$self=this;
  40683. return $core.withContext(function($ctx1) {
  40684. var $3,$2,$1;
  40685. $3=$self._parent();
  40686. $ctx1.sendIdx["parent"]=1;
  40687. $2=$recv($3)._isSequenceNode();
  40688. $1=$recv($2)._or_((function(){
  40689. return $core.withContext(function($ctx2) {
  40690. return $recv($self._parent())._isAssignmentNode();
  40691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40692. }));
  40693. return $recv($1)._not();
  40694. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  40695. },
  40696. args: [],
  40697. source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not",
  40698. referencedClasses: [],
  40699. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  40700. }),
  40701. $globals.ASTNode);
  40702. $core.addMethod(
  40703. $core.method({
  40704. selector: "subtreeNeedsAliasing",
  40705. protocol: "*Compiler-IR",
  40706. fn: function (){
  40707. var self=this,$self=this;
  40708. return $core.withContext(function($ctx1) {
  40709. return $recv($self._shouldBeAliased())._or_((function(){
  40710. return $core.withContext(function($ctx2) {
  40711. return $recv($self._dagChildren())._anySatisfy_((function(each){
  40712. return $core.withContext(function($ctx3) {
  40713. return $recv(each)._subtreeNeedsAliasing();
  40714. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40715. }));
  40716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40717. }));
  40718. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  40719. },
  40720. args: [],
  40721. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  40722. referencedClasses: [],
  40723. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  40724. }),
  40725. $globals.ASTNode);
  40726. $core.addMethod(
  40727. $core.method({
  40728. selector: "shouldBeAliased",
  40729. protocol: "*Compiler-IR",
  40730. fn: function (){
  40731. var self=this,$self=this;
  40732. return $core.withContext(function($ctx1) {
  40733. var $1;
  40734. $1=(
  40735. $ctx1.supercall = true,
  40736. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  40737. $ctx1.supercall = false;
  40738. return $recv($1)._or_((function(){
  40739. return $core.withContext(function($ctx2) {
  40740. return $self._isReferenced();
  40741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40742. }));
  40743. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  40744. },
  40745. args: [],
  40746. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  40747. referencedClasses: [],
  40748. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  40749. }),
  40750. $globals.AssignmentNode);
  40751. $core.addMethod(
  40752. $core.method({
  40753. selector: "appendToInstruction:",
  40754. protocol: "*Compiler-IR",
  40755. fn: function (anIRInstruction){
  40756. var self=this,$self=this;
  40757. return $core.withContext(function($ctx1) {
  40758. $recv(anIRInstruction)._appendBlock_(self);
  40759. return self;
  40760. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  40761. },
  40762. args: ["anIRInstruction"],
  40763. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  40764. referencedClasses: [],
  40765. messageSends: ["appendBlock:"]
  40766. }),
  40767. $globals.BlockClosure);
  40768. $core.addMethod(
  40769. $core.method({
  40770. selector: "subtreeNeedsAliasing",
  40771. protocol: "*Compiler-IR",
  40772. fn: function (){
  40773. var self=this,$self=this;
  40774. return $core.withContext(function($ctx1) {
  40775. return $self._shouldBeAliased();
  40776. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  40777. },
  40778. args: [],
  40779. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  40780. referencedClasses: [],
  40781. messageSends: ["shouldBeAliased"]
  40782. }),
  40783. $globals.BlockNode);
  40784. $core.addMethod(
  40785. $core.method({
  40786. selector: "subtreeNeedsAliasing",
  40787. protocol: "*Compiler-IR",
  40788. fn: function (){
  40789. var self=this,$self=this;
  40790. return $core.withContext(function($ctx1) {
  40791. return $recv($recv($self._parent())._isSequenceNode())._not();
  40792. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  40793. },
  40794. args: [],
  40795. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  40796. referencedClasses: [],
  40797. messageSends: ["not", "isSequenceNode", "parent"]
  40798. }),
  40799. $globals.CascadeNode);
  40800. $core.addMethod(
  40801. $core.method({
  40802. selector: "shouldBeAliased",
  40803. protocol: "*Compiler-IR",
  40804. fn: function (){
  40805. var self=this,$self=this;
  40806. var sends;
  40807. return $core.withContext(function($ctx1) {
  40808. var $2,$1;
  40809. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  40810. $2=(
  40811. $ctx1.supercall = true,
  40812. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  40813. $ctx1.supercall = false;
  40814. $1=$recv($2)._or_((function(){
  40815. return $core.withContext(function($ctx2) {
  40816. return $recv($self._isReferenced())._and_((function(){
  40817. return $core.withContext(function($ctx3) {
  40818. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  40819. return $core.withContext(function($ctx4) {
  40820. return $self._superSend();
  40821. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  40822. }));
  40823. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40824. }));
  40825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40826. }));
  40827. $ctx1.sendIdx["or:"]=1;
  40828. return $1;
  40829. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  40830. },
  40831. args: [],
  40832. source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09self index < sends or: [\x0a\x09\x09\x09\x09self superSend ] ] ])",
  40833. referencedClasses: [],
  40834. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  40835. }),
  40836. $globals.SendNode);
  40837. $core.addMethod(
  40838. $core.method({
  40839. selector: "subtreeNeedsAliasing",
  40840. protocol: "*Compiler-IR",
  40841. fn: function (){
  40842. var self=this,$self=this;
  40843. return $core.withContext(function($ctx1) {
  40844. return $recv($self._shouldBeInlined())._or_((function(){
  40845. return $core.withContext(function($ctx2) {
  40846. return (
  40847. $ctx2.supercall = true,
  40848. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  40849. $ctx2.supercall = false;
  40850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40851. }));
  40852. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  40853. },
  40854. args: [],
  40855. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  40856. referencedClasses: [],
  40857. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  40858. }),
  40859. $globals.SendNode);
  40860. });
  40861. define('amber_core/Compiler-Inlining',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Compiler-IR", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects"], function($boot){"use strict";
  40862. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  40863. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  40864. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  40865. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  40866. $core.addPackage("Compiler-Inlining");
  40867. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  40868. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40869. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  40870. $core.addMethod(
  40871. $core.method({
  40872. selector: "visitSendNode:",
  40873. protocol: "visiting",
  40874. fn: function (aNode){
  40875. var self=this,$self=this;
  40876. return $core.withContext(function($ctx1) {
  40877. var $1,$2,$3,$4,$receiver;
  40878. $1=$recv(aNode)._superSend();
  40879. if(!$core.assert($1)){
  40880. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  40881. if($core.assert($2)){
  40882. $recv(aNode)._shouldBeInlined_(true);
  40883. $3=$recv(aNode)._receiver();
  40884. if(($receiver = $3) == null || $receiver.a$nil){
  40885. $3;
  40886. } else {
  40887. var receiver;
  40888. receiver=$receiver;
  40889. $recv(receiver)._shouldBeAliased_(true);
  40890. }
  40891. }
  40892. }
  40893. $4=(
  40894. $ctx1.supercall = true,
  40895. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  40896. $ctx1.supercall = false;
  40897. return $4;
  40898. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  40899. },
  40900. args: ["aNode"],
  40901. source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09^ super visitSendNode: aNode",
  40902. referencedClasses: ["IRSendInliner"],
  40903. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  40904. }),
  40905. $globals.ASTPreInliner);
  40906. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  40907. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  40908. $core.addMethod(
  40909. $core.method({
  40910. selector: "acceptDagVisitor:",
  40911. protocol: "visiting",
  40912. fn: function (aVisitor){
  40913. var self=this,$self=this;
  40914. return $core.withContext(function($ctx1) {
  40915. $recv(aVisitor)._visitIRInlinedClosure_(self);
  40916. return self;
  40917. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  40918. },
  40919. args: ["aVisitor"],
  40920. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  40921. referencedClasses: [],
  40922. messageSends: ["visitIRInlinedClosure:"]
  40923. }),
  40924. $globals.IRInlinedClosure);
  40925. $core.addMethod(
  40926. $core.method({
  40927. selector: "isInlined",
  40928. protocol: "testing",
  40929. fn: function (){
  40930. var self=this,$self=this;
  40931. return true;
  40932. },
  40933. args: [],
  40934. source: "isInlined\x0a\x09^ true",
  40935. referencedClasses: [],
  40936. messageSends: []
  40937. }),
  40938. $globals.IRInlinedClosure);
  40939. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  40940. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  40941. $core.addMethod(
  40942. $core.method({
  40943. selector: "acceptDagVisitor:",
  40944. protocol: "visiting",
  40945. fn: function (aVisitor){
  40946. var self=this,$self=this;
  40947. return $core.withContext(function($ctx1) {
  40948. $recv(aVisitor)._visitInlinedSend_(self);
  40949. return self;
  40950. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  40951. },
  40952. args: ["aVisitor"],
  40953. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  40954. referencedClasses: [],
  40955. messageSends: ["visitInlinedSend:"]
  40956. }),
  40957. $globals.IRInlinedSend);
  40958. $core.addMethod(
  40959. $core.method({
  40960. selector: "internalVariables",
  40961. protocol: "accessing",
  40962. fn: function (){
  40963. var self=this,$self=this;
  40964. return [];
  40965. },
  40966. args: [],
  40967. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  40968. referencedClasses: [],
  40969. messageSends: []
  40970. }),
  40971. $globals.IRInlinedSend);
  40972. $core.addMethod(
  40973. $core.method({
  40974. selector: "isInlined",
  40975. protocol: "testing",
  40976. fn: function (){
  40977. var self=this,$self=this;
  40978. return true;
  40979. },
  40980. args: [],
  40981. source: "isInlined\x0a\x09^ true",
  40982. referencedClasses: [],
  40983. messageSends: []
  40984. }),
  40985. $globals.IRInlinedSend);
  40986. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  40987. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  40988. $core.addMethod(
  40989. $core.method({
  40990. selector: "acceptDagVisitor:",
  40991. protocol: "visiting",
  40992. fn: function (aVisitor){
  40993. var self=this,$self=this;
  40994. return $core.withContext(function($ctx1) {
  40995. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  40996. return self;
  40997. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  40998. },
  40999. args: ["aVisitor"],
  41000. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  41001. referencedClasses: [],
  41002. messageSends: ["visitIRInlinedIfFalse:"]
  41003. }),
  41004. $globals.IRInlinedIfFalse);
  41005. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41006. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  41007. $core.addMethod(
  41008. $core.method({
  41009. selector: "acceptDagVisitor:",
  41010. protocol: "visiting",
  41011. fn: function (aVisitor){
  41012. var self=this,$self=this;
  41013. return $core.withContext(function($ctx1) {
  41014. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  41015. return self;
  41016. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  41017. },
  41018. args: ["aVisitor"],
  41019. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  41020. referencedClasses: [],
  41021. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  41022. }),
  41023. $globals.IRInlinedIfNilIfNotNil);
  41024. $core.addMethod(
  41025. $core.method({
  41026. selector: "internalVariables",
  41027. protocol: "accessing",
  41028. fn: function (){
  41029. var self=this,$self=this;
  41030. return $core.withContext(function($ctx1) {
  41031. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  41032. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  41033. },
  41034. args: [],
  41035. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  41036. referencedClasses: ["Array"],
  41037. messageSends: ["with:", "receiverInternalVariable"]
  41038. }),
  41039. $globals.IRInlinedIfNilIfNotNil);
  41040. $core.addMethod(
  41041. $core.method({
  41042. selector: "receiverInternalVariable",
  41043. protocol: "accessing",
  41044. fn: function (){
  41045. var self=this,$self=this;
  41046. return $core.withContext(function($ctx1) {
  41047. var $1;
  41048. $1=$recv($globals.IRVariable)._new();
  41049. $ctx1.sendIdx["new"]=1;
  41050. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  41051. return $recv($1)._yourself();
  41052. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  41053. },
  41054. args: [],
  41055. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  41056. referencedClasses: ["IRVariable", "AliasVar"],
  41057. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  41058. }),
  41059. $globals.IRInlinedIfNilIfNotNil);
  41060. $core.addMethod(
  41061. $core.method({
  41062. selector: "receiverInternalVariableName",
  41063. protocol: "accessing",
  41064. fn: function (){
  41065. var self=this,$self=this;
  41066. return "$receiver";
  41067. },
  41068. args: [],
  41069. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  41070. referencedClasses: [],
  41071. messageSends: []
  41072. }),
  41073. $globals.IRInlinedIfNilIfNotNil);
  41074. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41075. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  41076. $core.addMethod(
  41077. $core.method({
  41078. selector: "acceptDagVisitor:",
  41079. protocol: "visiting",
  41080. fn: function (aVisitor){
  41081. var self=this,$self=this;
  41082. return $core.withContext(function($ctx1) {
  41083. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  41084. return self;
  41085. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  41086. },
  41087. args: ["aVisitor"],
  41088. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  41089. referencedClasses: [],
  41090. messageSends: ["visitIRInlinedIfTrue:"]
  41091. }),
  41092. $globals.IRInlinedIfTrue);
  41093. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41094. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  41095. $core.addMethod(
  41096. $core.method({
  41097. selector: "acceptDagVisitor:",
  41098. protocol: "visiting",
  41099. fn: function (aVisitor){
  41100. var self=this,$self=this;
  41101. return $core.withContext(function($ctx1) {
  41102. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  41103. return self;
  41104. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  41105. },
  41106. args: ["aVisitor"],
  41107. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  41108. referencedClasses: [],
  41109. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  41110. }),
  41111. $globals.IRInlinedIfTrueIfFalse);
  41112. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  41113. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  41114. $core.addMethod(
  41115. $core.method({
  41116. selector: "acceptDagVisitor:",
  41117. protocol: "visiting",
  41118. fn: function (aVisitor){
  41119. var self=this,$self=this;
  41120. return $core.withContext(function($ctx1) {
  41121. $recv(aVisitor)._visitIRInlinedSequence_(self);
  41122. return self;
  41123. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  41124. },
  41125. args: ["aVisitor"],
  41126. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  41127. referencedClasses: [],
  41128. messageSends: ["visitIRInlinedSequence:"]
  41129. }),
  41130. $globals.IRInlinedSequence);
  41131. $core.addMethod(
  41132. $core.method({
  41133. selector: "isInlined",
  41134. protocol: "testing",
  41135. fn: function (){
  41136. var self=this,$self=this;
  41137. return true;
  41138. },
  41139. args: [],
  41140. source: "isInlined\x0a\x09^ true",
  41141. referencedClasses: [],
  41142. messageSends: []
  41143. }),
  41144. $globals.IRInlinedSequence);
  41145. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  41146. $globals.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`";
  41147. $core.addMethod(
  41148. $core.method({
  41149. selector: "assignmentInliner",
  41150. protocol: "factory",
  41151. fn: function (){
  41152. var self=this,$self=this;
  41153. return $core.withContext(function($ctx1) {
  41154. var $1;
  41155. $1=$recv($globals.IRAssignmentInliner)._new();
  41156. $recv($1)._translator_(self);
  41157. return $recv($1)._yourself();
  41158. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  41159. },
  41160. args: [],
  41161. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41162. referencedClasses: ["IRAssignmentInliner"],
  41163. messageSends: ["translator:", "new", "yourself"]
  41164. }),
  41165. $globals.IRInliner);
  41166. $core.addMethod(
  41167. $core.method({
  41168. selector: "returnInliner",
  41169. protocol: "factory",
  41170. fn: function (){
  41171. var self=this,$self=this;
  41172. return $core.withContext(function($ctx1) {
  41173. var $1;
  41174. $1=$recv($globals.IRReturnInliner)._new();
  41175. $recv($1)._translator_(self);
  41176. return $recv($1)._yourself();
  41177. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  41178. },
  41179. args: [],
  41180. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41181. referencedClasses: ["IRReturnInliner"],
  41182. messageSends: ["translator:", "new", "yourself"]
  41183. }),
  41184. $globals.IRInliner);
  41185. $core.addMethod(
  41186. $core.method({
  41187. selector: "sendInliner",
  41188. protocol: "factory",
  41189. fn: function (){
  41190. var self=this,$self=this;
  41191. return $core.withContext(function($ctx1) {
  41192. var $1;
  41193. $1=$recv($globals.IRSendInliner)._new();
  41194. $recv($1)._translator_(self);
  41195. return $recv($1)._yourself();
  41196. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  41197. },
  41198. args: [],
  41199. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41200. referencedClasses: ["IRSendInliner"],
  41201. messageSends: ["translator:", "new", "yourself"]
  41202. }),
  41203. $globals.IRInliner);
  41204. $core.addMethod(
  41205. $core.method({
  41206. selector: "shouldInlineAssignment:",
  41207. protocol: "testing",
  41208. fn: function (anIRAssignment){
  41209. var self=this,$self=this;
  41210. return $core.withContext(function($ctx1) {
  41211. var $3,$2,$1;
  41212. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  41213. return $core.withContext(function($ctx2) {
  41214. $3=$recv(anIRAssignment)._right();
  41215. $ctx2.sendIdx["right"]=1;
  41216. $2=$recv($3)._isSend();
  41217. return $recv($2)._and_((function(){
  41218. return $core.withContext(function($ctx3) {
  41219. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  41220. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41221. }));
  41222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41223. }));
  41224. $ctx1.sendIdx["and:"]=1;
  41225. return $1;
  41226. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  41227. },
  41228. args: ["anIRAssignment"],
  41229. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  41230. referencedClasses: [],
  41231. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  41232. }),
  41233. $globals.IRInliner);
  41234. $core.addMethod(
  41235. $core.method({
  41236. selector: "shouldInlineReturn:",
  41237. protocol: "testing",
  41238. fn: function (anIRReturn){
  41239. var self=this,$self=this;
  41240. return $core.withContext(function($ctx1) {
  41241. var $3,$2,$1;
  41242. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  41243. return $core.withContext(function($ctx2) {
  41244. $3=$recv(anIRReturn)._expression();
  41245. $ctx2.sendIdx["expression"]=1;
  41246. $2=$recv($3)._isSend();
  41247. return $recv($2)._and_((function(){
  41248. return $core.withContext(function($ctx3) {
  41249. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  41250. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41251. }));
  41252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41253. }));
  41254. $ctx1.sendIdx["and:"]=1;
  41255. return $1;
  41256. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  41257. },
  41258. args: ["anIRReturn"],
  41259. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  41260. referencedClasses: [],
  41261. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  41262. }),
  41263. $globals.IRInliner);
  41264. $core.addMethod(
  41265. $core.method({
  41266. selector: "shouldInlineSend:",
  41267. protocol: "testing",
  41268. fn: function (anIRSend){
  41269. var self=this,$self=this;
  41270. return $core.withContext(function($ctx1) {
  41271. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  41272. return $core.withContext(function($ctx2) {
  41273. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  41274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41275. }));
  41276. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  41277. },
  41278. args: ["anIRSend"],
  41279. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  41280. referencedClasses: ["IRSendInliner"],
  41281. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  41282. }),
  41283. $globals.IRInliner);
  41284. $core.addMethod(
  41285. $core.method({
  41286. selector: "visitIRAssignment:",
  41287. protocol: "visiting",
  41288. fn: function (anIRAssignment){
  41289. var self=this,$self=this;
  41290. return $core.withContext(function($ctx1) {
  41291. var $1;
  41292. $1=$self._shouldInlineAssignment_(anIRAssignment);
  41293. if($core.assert($1)){
  41294. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  41295. } else {
  41296. return (
  41297. $ctx1.supercall = true,
  41298. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  41299. $ctx1.supercall = false;
  41300. }
  41301. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  41302. },
  41303. args: ["anIRAssignment"],
  41304. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  41305. referencedClasses: [],
  41306. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  41307. }),
  41308. $globals.IRInliner);
  41309. $core.addMethod(
  41310. $core.method({
  41311. selector: "visitIRNonLocalReturn:",
  41312. protocol: "visiting",
  41313. fn: function (anIRNonLocalReturn){
  41314. var self=this,$self=this;
  41315. var localReturn;
  41316. return $core.withContext(function($ctx1) {
  41317. var $2,$1,$4,$3,$5,$6,$7;
  41318. $2=$recv(anIRNonLocalReturn)._scope();
  41319. $ctx1.sendIdx["scope"]=1;
  41320. $1=$recv($2)._canInlineNonLocalReturns();
  41321. if($core.assert($1)){
  41322. $4=$recv(anIRNonLocalReturn)._scope();
  41323. $ctx1.sendIdx["scope"]=2;
  41324. $3=$recv($4)._methodScope();
  41325. $5=$recv(anIRNonLocalReturn)._scope();
  41326. $ctx1.sendIdx["scope"]=3;
  41327. $recv($3)._removeNonLocalReturn_($5);
  41328. $6=$recv($globals.IRReturn)._new();
  41329. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  41330. localReturn=$recv($6)._yourself();
  41331. localReturn;
  41332. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  41333. return $core.withContext(function($ctx2) {
  41334. return $recv(localReturn)._add_(each);
  41335. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41336. }));
  41337. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  41338. return $self._visitIRReturn_(localReturn);
  41339. }
  41340. $7=(
  41341. $ctx1.supercall = true,
  41342. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41343. $ctx1.supercall = false;
  41344. return $7;
  41345. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  41346. },
  41347. args: ["anIRNonLocalReturn"],
  41348. source: "visitIRNonLocalReturn: anIRNonLocalReturn\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 dagChildren do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ self visitIRReturn: localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  41349. referencedClasses: ["IRReturn"],
  41350. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  41351. }),
  41352. $globals.IRInliner);
  41353. $core.addMethod(
  41354. $core.method({
  41355. selector: "visitIRReturn:",
  41356. protocol: "visiting",
  41357. fn: function (anIRReturn){
  41358. var self=this,$self=this;
  41359. return $core.withContext(function($ctx1) {
  41360. var $1;
  41361. $1=$self._shouldInlineReturn_(anIRReturn);
  41362. if($core.assert($1)){
  41363. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  41364. } else {
  41365. return (
  41366. $ctx1.supercall = true,
  41367. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41368. $ctx1.supercall = false;
  41369. }
  41370. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  41371. },
  41372. args: ["anIRReturn"],
  41373. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  41374. referencedClasses: [],
  41375. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  41376. }),
  41377. $globals.IRInliner);
  41378. $core.addMethod(
  41379. $core.method({
  41380. selector: "visitIRSend:",
  41381. protocol: "visiting",
  41382. fn: function (anIRSend){
  41383. var self=this,$self=this;
  41384. return $core.withContext(function($ctx1) {
  41385. var $1;
  41386. $1=$self._shouldInlineSend_(anIRSend);
  41387. if($core.assert($1)){
  41388. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  41389. } else {
  41390. return (
  41391. $ctx1.supercall = true,
  41392. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  41393. $ctx1.supercall = false;
  41394. }
  41395. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  41396. },
  41397. args: ["anIRSend"],
  41398. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  41399. referencedClasses: [],
  41400. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  41401. }),
  41402. $globals.IRInliner);
  41403. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  41404. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  41405. $core.addMethod(
  41406. $core.method({
  41407. selector: "visitIRInlinedClosure:",
  41408. protocol: "visiting",
  41409. fn: function (anIRInlinedClosure){
  41410. var self=this,$self=this;
  41411. return $core.withContext(function($ctx1) {
  41412. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  41413. return $core.withContext(function($ctx2) {
  41414. return $recv($recv(each)._name())._asVariableName();
  41415. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41416. })));
  41417. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  41418. return self;
  41419. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  41420. },
  41421. args: ["anIRInlinedClosure"],
  41422. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  41423. referencedClasses: [],
  41424. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  41425. }),
  41426. $globals.IRInliningJSTranslator);
  41427. $core.addMethod(
  41428. $core.method({
  41429. selector: "visitIRInlinedIfFalse:",
  41430. protocol: "visiting",
  41431. fn: function (anIRInlinedIfFalse){
  41432. var self=this,$self=this;
  41433. return $core.withContext(function($ctx1) {
  41434. var $1,$2,$4,$3;
  41435. $1=$self._stream();
  41436. $ctx1.sendIdx["stream"]=1;
  41437. $recv($1)._nextPutIf_then_((function(){
  41438. return $core.withContext(function($ctx2) {
  41439. $2=$self._stream();
  41440. $ctx2.sendIdx["stream"]=2;
  41441. $recv($2)._nextPutAll_("!$core.assert(");
  41442. $ctx2.sendIdx["nextPutAll:"]=1;
  41443. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  41444. $ctx2.sendIdx["dagChildren"]=1;
  41445. $3=$recv($4)._first();
  41446. $self._visit_($3);
  41447. $ctx2.sendIdx["visit:"]=1;
  41448. return $recv($self._stream())._nextPutAll_(")");
  41449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41450. }),(function(){
  41451. return $core.withContext(function($ctx2) {
  41452. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  41453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41454. }));
  41455. return self;
  41456. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  41457. },
  41458. args: ["anIRInlinedIfFalse"],
  41459. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse dagChildren first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfFalse dagChildren last ]",
  41460. referencedClasses: [],
  41461. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  41462. }),
  41463. $globals.IRInliningJSTranslator);
  41464. $core.addMethod(
  41465. $core.method({
  41466. selector: "visitIRInlinedIfNilIfNotNil:",
  41467. protocol: "visiting",
  41468. fn: function (anIRInlinedIfNilIfNotNil){
  41469. var self=this,$self=this;
  41470. return $core.withContext(function($ctx1) {
  41471. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  41472. $1=$self._stream();
  41473. $ctx1.sendIdx["stream"]=1;
  41474. $recv($1)._nextPutIf_then_else_((function(){
  41475. var recvVarName;
  41476. return $core.withContext(function($ctx2) {
  41477. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  41478. recvVarName;
  41479. $2=$self._stream();
  41480. $ctx2.sendIdx["stream"]=2;
  41481. $4="(".__comma(recvVarName);
  41482. $ctx2.sendIdx[","]=2;
  41483. $3=$recv($4).__comma(" = ");
  41484. $ctx2.sendIdx[","]=1;
  41485. $recv($2)._nextPutAll_($3);
  41486. $ctx2.sendIdx["nextPutAll:"]=1;
  41487. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  41488. $ctx2.sendIdx["dagChildren"]=1;
  41489. $5=$recv($6)._first();
  41490. $self._visit_($5);
  41491. $ctx2.sendIdx["visit:"]=1;
  41492. $7=$self._stream();
  41493. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  41494. $ctx2.sendIdx[","]=3;
  41495. return $recv($7)._nextPutAll_($8);
  41496. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  41497. }),(function(){
  41498. return $core.withContext(function($ctx2) {
  41499. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  41500. $ctx2.sendIdx["dagChildren"]=2;
  41501. $9=$recv($10)._second();
  41502. return $self._visit_($9);
  41503. $ctx2.sendIdx["visit:"]=2;
  41504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41505. }),(function(){
  41506. return $core.withContext(function($ctx2) {
  41507. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  41508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41509. }));
  41510. return self;
  41511. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  41512. },
  41513. args: ["anIRInlinedIfNilIfNotNil"],
  41514. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09| recvVarName |\x0a\x09\x09\x09recvVarName := anIRInlinedIfNilIfNotNil receiverInternalVariableName.\x0a\x09\x09\x09self stream nextPutAll: '(', recvVarName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || ', recvVarName, '.a$nil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]",
  41515. referencedClasses: [],
  41516. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  41517. }),
  41518. $globals.IRInliningJSTranslator);
  41519. $core.addMethod(
  41520. $core.method({
  41521. selector: "visitIRInlinedIfTrue:",
  41522. protocol: "visiting",
  41523. fn: function (anIRInlinedIfTrue){
  41524. var self=this,$self=this;
  41525. return $core.withContext(function($ctx1) {
  41526. var $1,$2,$4,$3;
  41527. $1=$self._stream();
  41528. $ctx1.sendIdx["stream"]=1;
  41529. $recv($1)._nextPutIf_then_((function(){
  41530. return $core.withContext(function($ctx2) {
  41531. $2=$self._stream();
  41532. $ctx2.sendIdx["stream"]=2;
  41533. $recv($2)._nextPutAll_("$core.assert(");
  41534. $ctx2.sendIdx["nextPutAll:"]=1;
  41535. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  41536. $ctx2.sendIdx["dagChildren"]=1;
  41537. $3=$recv($4)._first();
  41538. $self._visit_($3);
  41539. $ctx2.sendIdx["visit:"]=1;
  41540. return $recv($self._stream())._nextPutAll_(")");
  41541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41542. }),(function(){
  41543. return $core.withContext(function($ctx2) {
  41544. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  41545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41546. }));
  41547. return self;
  41548. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  41549. },
  41550. args: ["anIRInlinedIfTrue"],
  41551. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue dagChildren first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrue dagChildren last ]",
  41552. referencedClasses: [],
  41553. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  41554. }),
  41555. $globals.IRInliningJSTranslator);
  41556. $core.addMethod(
  41557. $core.method({
  41558. selector: "visitIRInlinedIfTrueIfFalse:",
  41559. protocol: "visiting",
  41560. fn: function (anIRInlinedIfTrueIfFalse){
  41561. var self=this,$self=this;
  41562. return $core.withContext(function($ctx1) {
  41563. var $1,$2,$4,$3,$6,$5;
  41564. $1=$self._stream();
  41565. $ctx1.sendIdx["stream"]=1;
  41566. $recv($1)._nextPutIf_then_else_((function(){
  41567. return $core.withContext(function($ctx2) {
  41568. $2=$self._stream();
  41569. $ctx2.sendIdx["stream"]=2;
  41570. $recv($2)._nextPutAll_("$core.assert(");
  41571. $ctx2.sendIdx["nextPutAll:"]=1;
  41572. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  41573. $ctx2.sendIdx["dagChildren"]=1;
  41574. $3=$recv($4)._first();
  41575. $self._visit_($3);
  41576. $ctx2.sendIdx["visit:"]=1;
  41577. return $recv($self._stream())._nextPutAll_(")");
  41578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41579. }),(function(){
  41580. return $core.withContext(function($ctx2) {
  41581. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  41582. $ctx2.sendIdx["dagChildren"]=2;
  41583. $5=$recv($6)._second();
  41584. return $self._visit_($5);
  41585. $ctx2.sendIdx["visit:"]=2;
  41586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41587. }),(function(){
  41588. return $core.withContext(function($ctx2) {
  41589. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  41590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41591. }));
  41592. return self;
  41593. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  41594. },
  41595. args: ["anIRInlinedIfTrueIfFalse"],
  41596. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrueIfFalse dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfTrueIfFalse dagChildren third ]",
  41597. referencedClasses: [],
  41598. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  41599. }),
  41600. $globals.IRInliningJSTranslator);
  41601. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  41602. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  41603. $core.addMethod(
  41604. $core.method({
  41605. selector: "ifFalse:",
  41606. protocol: "inlining",
  41607. fn: function (anIRInstruction){
  41608. var self=this,$self=this;
  41609. return $core.withContext(function($ctx1) {
  41610. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  41611. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41612. },
  41613. args: ["anIRInstruction"],
  41614. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  41615. referencedClasses: ["IRInlinedIfFalse"],
  41616. messageSends: ["inlinedSend:withBlock:", "new"]
  41617. }),
  41618. $globals.IRSendInliner);
  41619. $core.addMethod(
  41620. $core.method({
  41621. selector: "ifFalse:ifTrue:",
  41622. protocol: "inlining",
  41623. fn: function (anIRInstruction,anotherIRInstruction){
  41624. var self=this,$self=this;
  41625. return $core.withContext(function($ctx1) {
  41626. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  41627. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41628. },
  41629. args: ["anIRInstruction", "anotherIRInstruction"],
  41630. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  41631. referencedClasses: [],
  41632. messageSends: ["perform:withArguments:"]
  41633. }),
  41634. $globals.IRSendInliner);
  41635. $core.addMethod(
  41636. $core.method({
  41637. selector: "ifNil:",
  41638. protocol: "inlining",
  41639. fn: function (anIRInstruction){
  41640. var self=this,$self=this;
  41641. return $core.withContext(function($ctx1) {
  41642. var $1,$3,$5,$6,$4,$2;
  41643. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  41644. $ctx1.sendIdx["new"]=1;
  41645. $3=$recv($globals.IRClosure)._new();
  41646. $ctx1.sendIdx["new"]=2;
  41647. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41648. $5=$recv($globals.IRBlockSequence)._new();
  41649. $recv($5)._add_($recv($self._send())._receiver());
  41650. $6=$recv($5)._yourself();
  41651. $ctx1.sendIdx["yourself"]=1;
  41652. $4=$6;
  41653. $recv($3)._add_($4);
  41654. $ctx1.sendIdx["add:"]=1;
  41655. $2=$recv($3)._yourself();
  41656. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  41657. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41658. },
  41659. args: ["anIRInstruction"],
  41660. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: anIRInstruction\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  41661. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41662. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  41663. }),
  41664. $globals.IRSendInliner);
  41665. $core.addMethod(
  41666. $core.method({
  41667. selector: "ifNil:ifNotNil:",
  41668. protocol: "inlining",
  41669. fn: function (anIRInstruction,anotherIRInstruction){
  41670. var self=this,$self=this;
  41671. return $core.withContext(function($ctx1) {
  41672. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  41673. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41674. },
  41675. args: ["anIRInstruction", "anotherIRInstruction"],
  41676. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  41677. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41678. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  41679. }),
  41680. $globals.IRSendInliner);
  41681. $core.addMethod(
  41682. $core.method({
  41683. selector: "ifNotNil:",
  41684. protocol: "inlining",
  41685. fn: function (anIRInstruction){
  41686. var self=this,$self=this;
  41687. return $core.withContext(function($ctx1) {
  41688. var $1,$3,$5,$6,$4,$2;
  41689. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  41690. $ctx1.sendIdx["new"]=1;
  41691. $3=$recv($globals.IRClosure)._new();
  41692. $ctx1.sendIdx["new"]=2;
  41693. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41694. $5=$recv($globals.IRBlockSequence)._new();
  41695. $recv($5)._add_($recv($self._send())._receiver());
  41696. $6=$recv($5)._yourself();
  41697. $ctx1.sendIdx["yourself"]=1;
  41698. $4=$6;
  41699. $recv($3)._add_($4);
  41700. $ctx1.sendIdx["add:"]=1;
  41701. $2=$recv($3)._yourself();
  41702. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  41703. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41704. },
  41705. args: ["anIRInstruction"],
  41706. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
  41707. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41708. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  41709. }),
  41710. $globals.IRSendInliner);
  41711. $core.addMethod(
  41712. $core.method({
  41713. selector: "ifNotNil:ifNil:",
  41714. protocol: "inlining",
  41715. fn: function (anIRInstruction,anotherIRInstruction){
  41716. var self=this,$self=this;
  41717. return $core.withContext(function($ctx1) {
  41718. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  41719. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41720. },
  41721. args: ["anIRInstruction", "anotherIRInstruction"],
  41722. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  41723. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41724. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  41725. }),
  41726. $globals.IRSendInliner);
  41727. $core.addMethod(
  41728. $core.method({
  41729. selector: "ifTrue:",
  41730. protocol: "inlining",
  41731. fn: function (anIRInstruction){
  41732. var self=this,$self=this;
  41733. return $core.withContext(function($ctx1) {
  41734. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  41735. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41736. },
  41737. args: ["anIRInstruction"],
  41738. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  41739. referencedClasses: ["IRInlinedIfTrue"],
  41740. messageSends: ["inlinedSend:withBlock:", "new"]
  41741. }),
  41742. $globals.IRSendInliner);
  41743. $core.addMethod(
  41744. $core.method({
  41745. selector: "ifTrue:ifFalse:",
  41746. protocol: "inlining",
  41747. fn: function (anIRInstruction,anotherIRInstruction){
  41748. var self=this,$self=this;
  41749. return $core.withContext(function($ctx1) {
  41750. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  41751. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41752. },
  41753. args: ["anIRInstruction", "anotherIRInstruction"],
  41754. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  41755. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  41756. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  41757. }),
  41758. $globals.IRSendInliner);
  41759. $core.addMethod(
  41760. $core.method({
  41761. selector: "inlineClosure:",
  41762. protocol: "inlining",
  41763. fn: function (anIRClosure){
  41764. var self=this,$self=this;
  41765. var inlinedClosure,sequence,statements;
  41766. return $core.withContext(function($ctx1) {
  41767. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  41768. inlinedClosure=$self._inlinedClosure();
  41769. $1=inlinedClosure;
  41770. $2=$recv(anIRClosure)._scope();
  41771. $ctx1.sendIdx["scope"]=1;
  41772. $recv($1)._scope_($2);
  41773. $ctx1.sendIdx["scope:"]=1;
  41774. $recv($1)._parent_($recv(anIRClosure)._parent());
  41775. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  41776. return $core.withContext(function($ctx2) {
  41777. return $recv(inlinedClosure)._add_(each);
  41778. $ctx2.sendIdx["add:"]=1;
  41779. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41780. }));
  41781. $ctx1.sendIdx["do:"]=1;
  41782. sequence=$self._inlinedSequence();
  41783. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  41784. return $core.withContext(function($ctx2) {
  41785. $3=inlinedClosure;
  41786. $5=$recv($globals.IRTempDeclaration)._new();
  41787. $ctx2.sendIdx["new"]=1;
  41788. $recv($5)._name_(each);
  41789. $ctx2.sendIdx["name:"]=1;
  41790. $6=$recv($5)._yourself();
  41791. $ctx2.sendIdx["yourself"]=1;
  41792. $4=$6;
  41793. $recv($3)._add_($4);
  41794. $ctx2.sendIdx["add:"]=2;
  41795. $7=sequence;
  41796. $9=$recv($globals.IRAssignment)._new();
  41797. $ctx2.sendIdx["new"]=2;
  41798. $11=$recv($globals.IRVariable)._new();
  41799. $ctx2.sendIdx["new"]=3;
  41800. $13=$recv($globals.AliasVar)._new();
  41801. $ctx2.sendIdx["new"]=4;
  41802. $14=$recv(inlinedClosure)._scope();
  41803. $ctx2.sendIdx["scope"]=2;
  41804. $recv($13)._scope_($14);
  41805. $ctx2.sendIdx["scope:"]=2;
  41806. $recv($13)._name_(each);
  41807. $ctx2.sendIdx["name:"]=2;
  41808. $15=$recv($13)._yourself();
  41809. $ctx2.sendIdx["yourself"]=2;
  41810. $12=$15;
  41811. $10=$recv($11)._variable_($12);
  41812. $ctx2.sendIdx["variable:"]=1;
  41813. $recv($9)._add_($10);
  41814. $ctx2.sendIdx["add:"]=4;
  41815. $17=$recv($globals.IRVariable)._new();
  41816. $ctx2.sendIdx["new"]=5;
  41817. $19=$recv($globals.AliasVar)._new();
  41818. $recv($19)._scope_($recv(inlinedClosure)._scope());
  41819. $recv($19)._name_("$receiver");
  41820. $20=$recv($19)._yourself();
  41821. $ctx2.sendIdx["yourself"]=3;
  41822. $18=$20;
  41823. $16=$recv($17)._variable_($18);
  41824. $recv($9)._add_($16);
  41825. $ctx2.sendIdx["add:"]=5;
  41826. $8=$recv($9)._yourself();
  41827. return $recv($7)._add_($8);
  41828. $ctx2.sendIdx["add:"]=3;
  41829. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41830. }));
  41831. $ctx1.sendIdx["do:"]=2;
  41832. $recv(inlinedClosure)._add_(sequence);
  41833. $ctx1.sendIdx["add:"]=6;
  41834. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  41835. $recv(statements)._ifNotEmpty_((function(){
  41836. return $core.withContext(function($ctx2) {
  41837. $recv($recv(statements)._allButLast())._do_((function(each){
  41838. return $core.withContext(function($ctx3) {
  41839. return $recv(sequence)._add_(each);
  41840. $ctx3.sendIdx["add:"]=7;
  41841. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  41842. }));
  41843. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  41844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41845. }));
  41846. return inlinedClosure;
  41847. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  41848. },
  41849. args: ["anIRClosure"],
  41850. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\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 sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures change local returns into result value itself\x22\x0a\x09\x09sequence add: statements last asInlinedBlockResult ].\x0a\x0a\x09^ inlinedClosure",
  41851. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  41852. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  41853. }),
  41854. $globals.IRSendInliner);
  41855. $core.addMethod(
  41856. $core.method({
  41857. selector: "inlineSend:",
  41858. protocol: "inlining",
  41859. fn: function (anIRSend){
  41860. var self=this,$self=this;
  41861. return $core.withContext(function($ctx1) {
  41862. var $2,$1;
  41863. $self._send_(anIRSend);
  41864. $2=$self._send();
  41865. $ctx1.sendIdx["send"]=1;
  41866. $1=$recv($2)._selector();
  41867. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  41868. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  41869. },
  41870. args: ["anIRSend"],
  41871. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  41872. referencedClasses: [],
  41873. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  41874. }),
  41875. $globals.IRSendInliner);
  41876. $core.addMethod(
  41877. $core.method({
  41878. selector: "inlineSend:andReplace:",
  41879. protocol: "private",
  41880. fn: function (anIRSend,anIRInstruction){
  41881. var self=this,$self=this;
  41882. return $core.withContext(function($ctx1) {
  41883. $recv(anIRInstruction)._replaceWith_(anIRSend);
  41884. return $self._inlineSend_(anIRSend);
  41885. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41886. },
  41887. args: ["anIRSend", "anIRInstruction"],
  41888. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  41889. referencedClasses: [],
  41890. messageSends: ["replaceWith:", "inlineSend:"]
  41891. }),
  41892. $globals.IRSendInliner);
  41893. $core.addMethod(
  41894. $core.method({
  41895. selector: "inlinedClosure",
  41896. protocol: "factory",
  41897. fn: function (){
  41898. var self=this,$self=this;
  41899. return $core.withContext(function($ctx1) {
  41900. return $recv($globals.IRInlinedClosure)._new();
  41901. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  41902. },
  41903. args: [],
  41904. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  41905. referencedClasses: ["IRInlinedClosure"],
  41906. messageSends: ["new"]
  41907. }),
  41908. $globals.IRSendInliner);
  41909. $core.addMethod(
  41910. $core.method({
  41911. selector: "inlinedSend:withBlock:",
  41912. protocol: "private",
  41913. fn: function (inlinedSend,anIRInstruction){
  41914. var self=this,$self=this;
  41915. var inlinedClosure;
  41916. return $core.withContext(function($ctx1) {
  41917. var $1,$2,$4,$3,$5;
  41918. $1=$recv(anIRInstruction)._isClosure();
  41919. if(!$core.assert($1)){
  41920. $self._inliningError_("Message argument should be a block");
  41921. $ctx1.sendIdx["inliningError:"]=1;
  41922. }
  41923. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  41924. if(!$core.assert($2)){
  41925. $self._inliningError_("Inlined block should have zero argument");
  41926. }
  41927. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  41928. $4=$self._send();
  41929. $ctx1.sendIdx["send"]=1;
  41930. $3=$recv($4)._receiver();
  41931. $recv(inlinedSend)._add_($3);
  41932. $ctx1.sendIdx["add:"]=1;
  41933. $recv(inlinedSend)._add_(inlinedClosure);
  41934. $recv($self._send())._replaceWith_(inlinedSend);
  41935. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  41936. $ctx1.sendIdx["internalVariables"]=1;
  41937. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  41938. return inlinedSend;
  41939. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  41940. },
  41941. args: ["inlinedSend", "anIRInstruction"],
  41942. source: "inlinedSend: inlinedSend withBlock: 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 receiver;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  41943. referencedClasses: [],
  41944. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41945. }),
  41946. $globals.IRSendInliner);
  41947. $core.addMethod(
  41948. $core.method({
  41949. selector: "inlinedSend:withBlock:withBlock:",
  41950. protocol: "private",
  41951. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  41952. var self=this,$self=this;
  41953. var inlinedClosure1,inlinedClosure2;
  41954. return $core.withContext(function($ctx1) {
  41955. var $1,$2,$3,$4,$6,$5,$7;
  41956. $1=$recv(anIRInstruction)._isClosure();
  41957. $ctx1.sendIdx["isClosure"]=1;
  41958. if(!$core.assert($1)){
  41959. $self._inliningError_("Message argument should be a block");
  41960. $ctx1.sendIdx["inliningError:"]=1;
  41961. }
  41962. $2=$recv(anotherIRInstruction)._isClosure();
  41963. if(!$core.assert($2)){
  41964. $self._inliningError_("Message argument should be a block");
  41965. }
  41966. $3=$self._translator();
  41967. $ctx1.sendIdx["translator"]=1;
  41968. $4=$self._inlineClosure_(anIRInstruction);
  41969. $ctx1.sendIdx["inlineClosure:"]=1;
  41970. inlinedClosure1=$recv($3)._visit_($4);
  41971. $ctx1.sendIdx["visit:"]=1;
  41972. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  41973. $6=$self._send();
  41974. $ctx1.sendIdx["send"]=1;
  41975. $5=$recv($6)._receiver();
  41976. $recv(inlinedSend)._add_($5);
  41977. $ctx1.sendIdx["add:"]=1;
  41978. $recv(inlinedSend)._add_(inlinedClosure1);
  41979. $ctx1.sendIdx["add:"]=2;
  41980. $recv(inlinedSend)._add_(inlinedClosure2);
  41981. $recv($self._send())._replaceWith_(inlinedSend);
  41982. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  41983. $ctx1.sendIdx["internalVariables"]=1;
  41984. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  41985. return inlinedSend;
  41986. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  41987. },
  41988. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  41989. source: "inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: 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 receiver;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  41990. referencedClasses: [],
  41991. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41992. }),
  41993. $globals.IRSendInliner);
  41994. $core.addMethod(
  41995. $core.method({
  41996. selector: "inlinedSequence",
  41997. protocol: "factory",
  41998. fn: function (){
  41999. var self=this,$self=this;
  42000. return $core.withContext(function($ctx1) {
  42001. return $recv($globals.IRInlinedSequence)._new();
  42002. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  42003. },
  42004. args: [],
  42005. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  42006. referencedClasses: ["IRInlinedSequence"],
  42007. messageSends: ["new"]
  42008. }),
  42009. $globals.IRSendInliner);
  42010. $core.addMethod(
  42011. $core.method({
  42012. selector: "inliningError:",
  42013. protocol: "error handling",
  42014. fn: function (aString){
  42015. var self=this,$self=this;
  42016. return $core.withContext(function($ctx1) {
  42017. $recv($globals.InliningError)._signal_(aString);
  42018. return self;
  42019. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  42020. },
  42021. args: ["aString"],
  42022. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  42023. referencedClasses: ["InliningError"],
  42024. messageSends: ["signal:"]
  42025. }),
  42026. $globals.IRSendInliner);
  42027. $core.addMethod(
  42028. $core.method({
  42029. selector: "send",
  42030. protocol: "accessing",
  42031. fn: function (){
  42032. var self=this,$self=this;
  42033. return $self["@send"];
  42034. },
  42035. args: [],
  42036. source: "send\x0a\x09^ send",
  42037. referencedClasses: [],
  42038. messageSends: []
  42039. }),
  42040. $globals.IRSendInliner);
  42041. $core.addMethod(
  42042. $core.method({
  42043. selector: "send:",
  42044. protocol: "accessing",
  42045. fn: function (anIRSend){
  42046. var self=this,$self=this;
  42047. $self["@send"]=anIRSend;
  42048. return self;
  42049. },
  42050. args: ["anIRSend"],
  42051. source: "send: anIRSend\x0a\x09send := anIRSend",
  42052. referencedClasses: [],
  42053. messageSends: []
  42054. }),
  42055. $globals.IRSendInliner);
  42056. $core.addMethod(
  42057. $core.method({
  42058. selector: "translator",
  42059. protocol: "accessing",
  42060. fn: function (){
  42061. var self=this,$self=this;
  42062. return $self["@translator"];
  42063. },
  42064. args: [],
  42065. source: "translator\x0a\x09^ translator",
  42066. referencedClasses: [],
  42067. messageSends: []
  42068. }),
  42069. $globals.IRSendInliner);
  42070. $core.addMethod(
  42071. $core.method({
  42072. selector: "translator:",
  42073. protocol: "accessing",
  42074. fn: function (anASTTranslator){
  42075. var self=this,$self=this;
  42076. $self["@translator"]=anASTTranslator;
  42077. return self;
  42078. },
  42079. args: ["anASTTranslator"],
  42080. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  42081. referencedClasses: [],
  42082. messageSends: []
  42083. }),
  42084. $globals.IRSendInliner);
  42085. $core.addMethod(
  42086. $core.method({
  42087. selector: "inlinedSelectors",
  42088. protocol: "accessing",
  42089. fn: function (){
  42090. var self=this,$self=this;
  42091. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  42092. },
  42093. args: [],
  42094. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  42095. referencedClasses: [],
  42096. messageSends: []
  42097. }),
  42098. $globals.IRSendInliner.a$cls);
  42099. $core.addMethod(
  42100. $core.method({
  42101. selector: "shouldInline:",
  42102. protocol: "accessing",
  42103. fn: function (anIRSend){
  42104. var self=this,$self=this;
  42105. return $core.withContext(function($ctx1) {
  42106. var $1;
  42107. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  42108. if(!$core.assert($1)){
  42109. return false;
  42110. }
  42111. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  42112. return $core.withContext(function($ctx2) {
  42113. return $recv(each)._isClosure();
  42114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42115. }));
  42116. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  42117. },
  42118. args: ["anIRSend"],
  42119. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  42120. referencedClasses: [],
  42121. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  42122. }),
  42123. $globals.IRSendInliner.a$cls);
  42124. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  42125. $globals.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($core.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};";
  42126. $core.addMethod(
  42127. $core.method({
  42128. selector: "inlineAssignment:",
  42129. protocol: "inlining",
  42130. fn: function (anIRAssignment){
  42131. var self=this,$self=this;
  42132. return $core.withContext(function($ctx1) {
  42133. $self._target_($recv(anIRAssignment)._left());
  42134. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  42135. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  42136. },
  42137. args: ["anIRAssignment"],
  42138. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  42139. referencedClasses: [],
  42140. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  42141. }),
  42142. $globals.IRAssignmentInliner);
  42143. $core.addMethod(
  42144. $core.method({
  42145. selector: "inlineClosure:",
  42146. protocol: "inlining",
  42147. fn: function (anIRClosure){
  42148. var self=this,$self=this;
  42149. var closure,sequence,statements;
  42150. return $core.withContext(function($ctx1) {
  42151. var $1,$2,$3,$5,$4;
  42152. closure=(
  42153. $ctx1.supercall = true,
  42154. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  42155. $ctx1.supercall = false;
  42156. sequence=$recv(closure)._sequence();
  42157. statements=$recv(sequence)._dagChildren();
  42158. $recv(statements)._ifNotEmpty_((function(){
  42159. var final;
  42160. return $core.withContext(function($ctx2) {
  42161. final=$recv(statements)._last();
  42162. final;
  42163. $1=$recv(final)._yieldsValue();
  42164. if($core.assert($1)){
  42165. $2=sequence;
  42166. $3=final;
  42167. $5=$recv($globals.IRAssignment)._new();
  42168. $recv($5)._add_($self._target());
  42169. $ctx2.sendIdx["add:"]=1;
  42170. $recv($5)._add_($recv(final)._copy());
  42171. $4=$recv($5)._yourself();
  42172. return $recv($2)._replace_with_($3,$4);
  42173. }
  42174. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  42175. }));
  42176. return closure;
  42177. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  42178. },
  42179. args: ["anIRClosure"],
  42180. source: "inlineClosure: anIRClosure\x0a\x09| closure sequence statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09sequence := closure sequence.\x0a\x09statements := sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09| final |\x0a\x09\x09final := statements last.\x0a\x09\x09final yieldsValue ifTrue: [\x0a\x09\x09\x09sequence replace: final with: (IRAssignment new\x0a\x09\x09\x09\x09add: self target;\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ closure",
  42181. referencedClasses: ["IRAssignment"],
  42182. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  42183. }),
  42184. $globals.IRAssignmentInliner);
  42185. $core.addMethod(
  42186. $core.method({
  42187. selector: "target",
  42188. protocol: "accessing",
  42189. fn: function (){
  42190. var self=this,$self=this;
  42191. return $self["@target"];
  42192. },
  42193. args: [],
  42194. source: "target\x0a\x09^ target",
  42195. referencedClasses: [],
  42196. messageSends: []
  42197. }),
  42198. $globals.IRAssignmentInliner);
  42199. $core.addMethod(
  42200. $core.method({
  42201. selector: "target:",
  42202. protocol: "accessing",
  42203. fn: function (anObject){
  42204. var self=this,$self=this;
  42205. $self["@target"]=anObject;
  42206. return self;
  42207. },
  42208. args: ["anObject"],
  42209. source: "target: anObject\x0a\x09target := anObject",
  42210. referencedClasses: [],
  42211. messageSends: []
  42212. }),
  42213. $globals.IRAssignmentInliner);
  42214. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  42215. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  42216. $core.addMethod(
  42217. $core.method({
  42218. selector: "inlineClosure:",
  42219. protocol: "inlining",
  42220. fn: function (anIRClosure){
  42221. var self=this,$self=this;
  42222. var closure,sequence,statements;
  42223. return $core.withContext(function($ctx1) {
  42224. var $1,$2,$3,$5,$4;
  42225. closure=(
  42226. $ctx1.supercall = true,
  42227. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  42228. $ctx1.supercall = false;
  42229. sequence=$recv(closure)._sequence();
  42230. statements=$recv(sequence)._dagChildren();
  42231. $recv(statements)._ifNotEmpty_((function(){
  42232. var final;
  42233. return $core.withContext(function($ctx2) {
  42234. final=$recv(statements)._last();
  42235. final;
  42236. $1=$recv(final)._yieldsValue();
  42237. if($core.assert($1)){
  42238. $2=sequence;
  42239. $3=final;
  42240. $5=$recv($globals.IRReturn)._new();
  42241. $recv($5)._add_($recv(final)._copy());
  42242. $4=$recv($5)._yourself();
  42243. return $recv($2)._replace_with_($3,$4);
  42244. }
  42245. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  42246. }));
  42247. return closure;
  42248. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  42249. },
  42250. args: ["anIRClosure"],
  42251. source: "inlineClosure: anIRClosure\x0a\x09| closure sequence statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09sequence := closure sequence.\x0a\x09statements := sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09| final |\x0a\x09\x09final := statements last.\x0a\x09\x09final yieldsValue ifTrue: [\x0a\x09\x09\x09sequence replace: final with: (IRReturn new\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ closure",
  42252. referencedClasses: ["IRReturn"],
  42253. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  42254. }),
  42255. $globals.IRReturnInliner);
  42256. $core.addMethod(
  42257. $core.method({
  42258. selector: "inlineReturn:",
  42259. protocol: "inlining",
  42260. fn: function (anIRReturn){
  42261. var self=this,$self=this;
  42262. return $core.withContext(function($ctx1) {
  42263. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  42264. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  42265. },
  42266. args: ["anIRReturn"],
  42267. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  42268. referencedClasses: [],
  42269. messageSends: ["inlineSend:andReplace:", "expression"]
  42270. }),
  42271. $globals.IRReturnInliner);
  42272. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  42273. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  42274. $core.addMethod(
  42275. $core.method({
  42276. selector: "inliner",
  42277. protocol: "compiling",
  42278. fn: function (){
  42279. var self=this,$self=this;
  42280. return $core.withContext(function($ctx1) {
  42281. return $recv($globals.IRInliner)._new();
  42282. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  42283. },
  42284. args: [],
  42285. source: "inliner\x0a\x09^ IRInliner new",
  42286. referencedClasses: ["IRInliner"],
  42287. messageSends: ["new"]
  42288. }),
  42289. $globals.InliningCodeGenerator);
  42290. $core.addMethod(
  42291. $core.method({
  42292. selector: "irTranslatorClass",
  42293. protocol: "compiling",
  42294. fn: function (){
  42295. var self=this,$self=this;
  42296. return $globals.IRInliningJSTranslator;
  42297. },
  42298. args: [],
  42299. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  42300. referencedClasses: ["IRInliningJSTranslator"],
  42301. messageSends: []
  42302. }),
  42303. $globals.InliningCodeGenerator);
  42304. $core.addMethod(
  42305. $core.method({
  42306. selector: "preInliner",
  42307. protocol: "compiling",
  42308. fn: function (){
  42309. var self=this,$self=this;
  42310. return $core.withContext(function($ctx1) {
  42311. return $recv($globals.ASTPreInliner)._new();
  42312. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  42313. },
  42314. args: [],
  42315. source: "preInliner\x0a\x09^ ASTPreInliner new",
  42316. referencedClasses: ["ASTPreInliner"],
  42317. messageSends: ["new"]
  42318. }),
  42319. $globals.InliningCodeGenerator);
  42320. $core.addMethod(
  42321. $core.method({
  42322. selector: "transformersDictionary",
  42323. protocol: "compiling",
  42324. fn: function (){
  42325. var self=this,$self=this;
  42326. return $core.withContext(function($ctx1) {
  42327. var $1,$2,$receiver;
  42328. $1=$self["@transformersDictionary"];
  42329. if(($receiver = $1) == null || $receiver.a$nil){
  42330. $2=(
  42331. $ctx1.supercall = true,
  42332. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  42333. $ctx1.supercall = false;
  42334. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  42335. $ctx1.sendIdx["at:put:"]=1;
  42336. $recv($2)._at_put_("6000-inliner",$self._inliner());
  42337. $ctx1.sendIdx["at:put:"]=2;
  42338. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  42339. $self["@transformersDictionary"]=$recv($2)._yourself();
  42340. return $self["@transformersDictionary"];
  42341. } else {
  42342. return $1;
  42343. }
  42344. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  42345. },
  42346. args: [],
  42347. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := super transformersDictionary\x0a\x09\x09at: '3000-inlinerTagging' put: self preInliner;\x0a\x09\x09at: '6000-inliner' put: self inliner;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  42348. referencedClasses: [],
  42349. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  42350. }),
  42351. $globals.InliningCodeGenerator);
  42352. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  42353. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  42354. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  42355. $core.addMethod(
  42356. $core.method({
  42357. selector: "visitSendNode:",
  42358. protocol: "visiting",
  42359. fn: function (aNode){
  42360. var self=this,$self=this;
  42361. return $core.withContext(function($ctx1) {
  42362. var $1,$2,$3,$receiver;
  42363. $1=$recv(aNode)._superSend();
  42364. if(!$core.assert($1)){
  42365. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42366. if($core.assert($2)){
  42367. $recv(aNode)._shouldBeInlined_(true);
  42368. $3=$recv(aNode)._receiver();
  42369. if(($receiver = $3) == null || $receiver.a$nil){
  42370. $3;
  42371. } else {
  42372. var receiver;
  42373. receiver=$receiver;
  42374. $recv(receiver)._shouldBeAliased_(true);
  42375. }
  42376. }
  42377. }
  42378. (
  42379. $ctx1.supercall = true,
  42380. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42381. $ctx1.supercall = false;
  42382. return self;
  42383. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  42384. },
  42385. args: ["aNode"],
  42386. source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09super visitSendNode: aNode",
  42387. referencedClasses: ["IRSendInliner"],
  42388. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42389. }),
  42390. $globals.InliningSemanticAnalyzer);
  42391. $core.addMethod(
  42392. $core.method({
  42393. selector: "asInlinedBlockResult",
  42394. protocol: "*Compiler-Inlining",
  42395. fn: function (){
  42396. var self=this,$self=this;
  42397. return $core.withContext(function($ctx1) {
  42398. return $self._expression();
  42399. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  42400. },
  42401. args: [],
  42402. source: "asInlinedBlockResult\x0a\x09^ self expression",
  42403. referencedClasses: [],
  42404. messageSends: ["expression"]
  42405. }),
  42406. $globals.IRBlockReturn);
  42407. $core.addMethod(
  42408. $core.method({
  42409. selector: "asInlinedBlockResult",
  42410. protocol: "*Compiler-Inlining",
  42411. fn: function (){
  42412. var self=this,$self=this;
  42413. return self;
  42414. },
  42415. args: [],
  42416. source: "asInlinedBlockResult\x0a\x09^ self",
  42417. referencedClasses: [],
  42418. messageSends: []
  42419. }),
  42420. $globals.IRInstruction);
  42421. });
  42422. define('amber_core/Compiler-Interpreter',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Semantic", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  42423. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  42424. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42425. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42426. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  42427. $core.addPackage("Compiler-Interpreter");
  42428. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  42429. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42430. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  42431. $globals.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).";
  42432. $core.addMethod(
  42433. $core.method({
  42434. selector: "applyTo:arguments:",
  42435. protocol: "evaluating",
  42436. fn: function (anObject,aCollection){
  42437. var self=this,$self=this;
  42438. return $core.withContext(function($ctx1) {
  42439. $self._interpreterError();
  42440. return self;
  42441. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  42442. },
  42443. args: ["anObject", "aCollection"],
  42444. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  42445. referencedClasses: [],
  42446. messageSends: ["interpreterError"]
  42447. }),
  42448. $globals.AIBlockClosure);
  42449. $core.addMethod(
  42450. $core.method({
  42451. selector: "compiledSource",
  42452. protocol: "accessing",
  42453. fn: function (){
  42454. var self=this,$self=this;
  42455. return "[ AST Block closure ]";
  42456. },
  42457. args: [],
  42458. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  42459. referencedClasses: [],
  42460. messageSends: []
  42461. }),
  42462. $globals.AIBlockClosure);
  42463. $core.addMethod(
  42464. $core.method({
  42465. selector: "currySelf",
  42466. protocol: "converting",
  42467. fn: function (){
  42468. var self=this,$self=this;
  42469. return $core.withContext(function($ctx1) {
  42470. $self._interpreterError();
  42471. return self;
  42472. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  42473. },
  42474. args: [],
  42475. source: "currySelf\x0a\x09self interpreterError",
  42476. referencedClasses: [],
  42477. messageSends: ["interpreterError"]
  42478. }),
  42479. $globals.AIBlockClosure);
  42480. $core.addMethod(
  42481. $core.method({
  42482. selector: "initializeWithContext:node:",
  42483. protocol: "initialization",
  42484. fn: function (aContext,aNode){
  42485. var self=this,$self=this;
  42486. $self["@node"]=aNode;
  42487. $self["@outerContext"]=aContext;
  42488. return self;
  42489. },
  42490. args: ["aContext", "aNode"],
  42491. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  42492. referencedClasses: [],
  42493. messageSends: []
  42494. }),
  42495. $globals.AIBlockClosure);
  42496. $core.addMethod(
  42497. $core.method({
  42498. selector: "interpreterError",
  42499. protocol: "error handling",
  42500. fn: function (){
  42501. var self=this,$self=this;
  42502. return $core.withContext(function($ctx1) {
  42503. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  42504. return self;
  42505. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  42506. },
  42507. args: [],
  42508. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  42509. referencedClasses: ["ASTInterpreterError"],
  42510. messageSends: ["signal:"]
  42511. }),
  42512. $globals.AIBlockClosure);
  42513. $core.addMethod(
  42514. $core.method({
  42515. selector: "numArgs",
  42516. protocol: "accessing",
  42517. fn: function (){
  42518. var self=this,$self=this;
  42519. return $core.withContext(function($ctx1) {
  42520. return $recv($recv($self["@node"])._temps())._size();
  42521. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  42522. },
  42523. args: [],
  42524. source: "numArgs\x0a\x09^ node temps size",
  42525. referencedClasses: [],
  42526. messageSends: ["size", "temps"]
  42527. }),
  42528. $globals.AIBlockClosure);
  42529. $core.addMethod(
  42530. $core.method({
  42531. selector: "value",
  42532. protocol: "evaluating",
  42533. fn: function (){
  42534. var self=this,$self=this;
  42535. return $core.withContext(function($ctx1) {
  42536. return $self._valueWithPossibleArguments_([]);
  42537. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  42538. },
  42539. args: [],
  42540. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  42541. referencedClasses: [],
  42542. messageSends: ["valueWithPossibleArguments:"]
  42543. }),
  42544. $globals.AIBlockClosure);
  42545. $core.addMethod(
  42546. $core.method({
  42547. selector: "value:",
  42548. protocol: "evaluating",
  42549. fn: function (anArgument){
  42550. var self=this,$self=this;
  42551. return $core.withContext(function($ctx1) {
  42552. return $self._valueWithPossibleArguments_([anArgument]);
  42553. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  42554. },
  42555. args: ["anArgument"],
  42556. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  42557. referencedClasses: [],
  42558. messageSends: ["valueWithPossibleArguments:"]
  42559. }),
  42560. $globals.AIBlockClosure);
  42561. $core.addMethod(
  42562. $core.method({
  42563. selector: "value:value:",
  42564. protocol: "evaluating",
  42565. fn: function (firstArgument,secondArgument){
  42566. var self=this,$self=this;
  42567. return $core.withContext(function($ctx1) {
  42568. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  42569. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  42570. },
  42571. args: ["firstArgument", "secondArgument"],
  42572. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  42573. referencedClasses: [],
  42574. messageSends: ["valueWithPossibleArguments:"]
  42575. }),
  42576. $globals.AIBlockClosure);
  42577. $core.addMethod(
  42578. $core.method({
  42579. selector: "value:value:value:",
  42580. protocol: "evaluating",
  42581. fn: function (firstArgument,secondArgument,thirdArgument){
  42582. var self=this,$self=this;
  42583. return $core.withContext(function($ctx1) {
  42584. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  42585. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  42586. },
  42587. args: ["firstArgument", "secondArgument", "thirdArgument"],
  42588. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  42589. referencedClasses: [],
  42590. messageSends: ["valueWithPossibleArguments:"]
  42591. }),
  42592. $globals.AIBlockClosure);
  42593. $core.addMethod(
  42594. $core.method({
  42595. selector: "valueWithPossibleArguments:",
  42596. protocol: "evaluating",
  42597. fn: function (aCollection){
  42598. var self=this,$self=this;
  42599. var context,sequenceNode;
  42600. return $core.withContext(function($ctx1) {
  42601. var $1,$2,$3;
  42602. context=$recv($self["@outerContext"])._newInnerContext();
  42603. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  42604. $recv($1)._parent_(nil);
  42605. sequenceNode=$recv($1)._yourself();
  42606. $recv($recv(sequenceNode)._temps())._do_((function(each){
  42607. return $core.withContext(function($ctx2) {
  42608. return $recv(context)._defineLocal_(each);
  42609. $ctx2.sendIdx["defineLocal:"]=1;
  42610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42611. }));
  42612. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  42613. return $core.withContext(function($ctx2) {
  42614. $recv(context)._defineLocal_(each);
  42615. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  42616. return nil;
  42617. })));
  42618. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  42619. }));
  42620. $2=$recv(context)._interpreter();
  42621. $ctx1.sendIdx["interpreter"]=1;
  42622. $recv($2)._node_(sequenceNode);
  42623. $recv($2)._enterNode();
  42624. $recv($2)._proceed();
  42625. $3=$recv($self["@outerContext"])._interpreter();
  42626. $ctx1.sendIdx["interpreter"]=2;
  42627. $recv($3)._setNonLocalReturnFromContext_(context);
  42628. return $recv($recv(context)._interpreter())._pop();
  42629. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  42630. },
  42631. args: ["aCollection"],
  42632. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node dagChildren first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  42633. referencedClasses: [],
  42634. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  42635. }),
  42636. $globals.AIBlockClosure);
  42637. $core.addMethod(
  42638. $core.method({
  42639. selector: "forContext:node:",
  42640. protocol: "instance creation",
  42641. fn: function (aContext,aNode){
  42642. var self=this,$self=this;
  42643. return $core.withContext(function($ctx1) {
  42644. var $1;
  42645. $1=$self._new();
  42646. $recv($1)._initializeWithContext_node_(aContext,aNode);
  42647. return $recv($1)._yourself();
  42648. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  42649. },
  42650. args: ["aContext", "aNode"],
  42651. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  42652. referencedClasses: [],
  42653. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  42654. }),
  42655. $globals.AIBlockClosure.a$cls);
  42656. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  42657. $globals.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)";
  42658. $core.addMethod(
  42659. $core.method({
  42660. selector: "arguments",
  42661. protocol: "interpreting",
  42662. fn: function (){
  42663. var self=this,$self=this;
  42664. return $core.withContext(function($ctx1) {
  42665. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  42666. return $core.withContext(function($ctx2) {
  42667. return $self._localAt_ifAbsent_(each,(function(){
  42668. return $core.withContext(function($ctx3) {
  42669. return $self._error_("Argument not in context");
  42670. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42671. }));
  42672. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42673. }));
  42674. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  42675. },
  42676. args: [],
  42677. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  42678. referencedClasses: [],
  42679. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  42680. }),
  42681. $globals.AIContext);
  42682. $core.addMethod(
  42683. $core.method({
  42684. selector: "ast",
  42685. protocol: "interpreting",
  42686. fn: function (){
  42687. var self=this,$self=this;
  42688. return $core.withContext(function($ctx1) {
  42689. var $1,$2,$3,$receiver;
  42690. $1=$self._isBlockContext();
  42691. if($core.assert($1)){
  42692. $2=$self._outerContext();
  42693. if(($receiver = $2) == null || $receiver.a$nil){
  42694. return $2;
  42695. } else {
  42696. var context;
  42697. context=$receiver;
  42698. return $recv(context)._ast();
  42699. }
  42700. }
  42701. $3=$self["@ast"];
  42702. if(($receiver = $3) == null || $receiver.a$nil){
  42703. $self._initializeAST();
  42704. } else {
  42705. $3;
  42706. }
  42707. return $self["@ast"];
  42708. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  42709. },
  42710. args: [],
  42711. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  42712. referencedClasses: [],
  42713. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  42714. }),
  42715. $globals.AIContext);
  42716. $core.addMethod(
  42717. $core.method({
  42718. selector: "basicLocalAt:",
  42719. protocol: "private",
  42720. fn: function (aString){
  42721. var self=this,$self=this;
  42722. return $core.withContext(function($ctx1) {
  42723. return $recv($self._locals())._at_(aString);
  42724. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  42725. },
  42726. args: ["aString"],
  42727. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  42728. referencedClasses: [],
  42729. messageSends: ["at:", "locals"]
  42730. }),
  42731. $globals.AIContext);
  42732. $core.addMethod(
  42733. $core.method({
  42734. selector: "basicLocalAt:put:",
  42735. protocol: "private",
  42736. fn: function (aString,anObject){
  42737. var self=this,$self=this;
  42738. return $core.withContext(function($ctx1) {
  42739. $recv($self._locals())._at_put_(aString,anObject);
  42740. return self;
  42741. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  42742. },
  42743. args: ["aString", "anObject"],
  42744. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  42745. referencedClasses: [],
  42746. messageSends: ["at:put:", "locals"]
  42747. }),
  42748. $globals.AIContext);
  42749. $core.addMethod(
  42750. $core.method({
  42751. selector: "basicReceiver",
  42752. protocol: "interpreting",
  42753. fn: function (){
  42754. var self=this,$self=this;
  42755. return $core.withContext(function($ctx1) {
  42756. return $self._localAt_("self");
  42757. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  42758. },
  42759. args: [],
  42760. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  42761. referencedClasses: [],
  42762. messageSends: ["localAt:"]
  42763. }),
  42764. $globals.AIContext);
  42765. $core.addMethod(
  42766. $core.method({
  42767. selector: "defineLocal:",
  42768. protocol: "accessing",
  42769. fn: function (aString){
  42770. var self=this,$self=this;
  42771. return $core.withContext(function($ctx1) {
  42772. $recv($self._locals())._at_put_(aString,nil);
  42773. return self;
  42774. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  42775. },
  42776. args: ["aString"],
  42777. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  42778. referencedClasses: [],
  42779. messageSends: ["at:put:", "locals"]
  42780. }),
  42781. $globals.AIContext);
  42782. $core.addMethod(
  42783. $core.method({
  42784. selector: "evaluate:on:",
  42785. protocol: "evaluating",
  42786. fn: function (aString,anEvaluator){
  42787. var self=this,$self=this;
  42788. return $core.withContext(function($ctx1) {
  42789. return $recv(anEvaluator)._evaluate_context_(aString,self);
  42790. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  42791. },
  42792. args: ["aString", "anEvaluator"],
  42793. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  42794. referencedClasses: [],
  42795. messageSends: ["evaluate:context:"]
  42796. }),
  42797. $globals.AIContext);
  42798. $core.addMethod(
  42799. $core.method({
  42800. selector: "evaluateNode:",
  42801. protocol: "evaluating",
  42802. fn: function (aNode){
  42803. var self=this,$self=this;
  42804. return $core.withContext(function($ctx1) {
  42805. var $1;
  42806. $1=$recv($globals.ASTInterpreter)._new();
  42807. $recv($1)._context_(self);
  42808. $recv($1)._node_(aNode);
  42809. $recv($1)._enterNode();
  42810. $recv($1)._proceed();
  42811. return $recv($1)._result();
  42812. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  42813. },
  42814. args: ["aNode"],
  42815. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  42816. referencedClasses: ["ASTInterpreter"],
  42817. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  42818. }),
  42819. $globals.AIContext);
  42820. $core.addMethod(
  42821. $core.method({
  42822. selector: "evaluatedSelector",
  42823. protocol: "accessing",
  42824. fn: function (){
  42825. var self=this,$self=this;
  42826. return $self["@evaluatedSelector"];
  42827. },
  42828. args: [],
  42829. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  42830. referencedClasses: [],
  42831. messageSends: []
  42832. }),
  42833. $globals.AIContext);
  42834. $core.addMethod(
  42835. $core.method({
  42836. selector: "evaluatedSelector:",
  42837. protocol: "accessing",
  42838. fn: function (aString){
  42839. var self=this,$self=this;
  42840. $self["@evaluatedSelector"]=aString;
  42841. return self;
  42842. },
  42843. args: ["aString"],
  42844. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  42845. referencedClasses: [],
  42846. messageSends: []
  42847. }),
  42848. $globals.AIContext);
  42849. $core.addMethod(
  42850. $core.method({
  42851. selector: "index",
  42852. protocol: "accessing",
  42853. fn: function (){
  42854. var self=this,$self=this;
  42855. return $core.withContext(function($ctx1) {
  42856. var $1,$receiver;
  42857. $1=$self["@index"];
  42858. if(($receiver = $1) == null || $receiver.a$nil){
  42859. return (0);
  42860. } else {
  42861. return $1;
  42862. }
  42863. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  42864. },
  42865. args: [],
  42866. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  42867. referencedClasses: [],
  42868. messageSends: ["ifNil:"]
  42869. }),
  42870. $globals.AIContext);
  42871. $core.addMethod(
  42872. $core.method({
  42873. selector: "index:",
  42874. protocol: "accessing",
  42875. fn: function (anInteger){
  42876. var self=this,$self=this;
  42877. $self["@index"]=anInteger;
  42878. return self;
  42879. },
  42880. args: ["anInteger"],
  42881. source: "index: anInteger\x0a\x09index := anInteger",
  42882. referencedClasses: [],
  42883. messageSends: []
  42884. }),
  42885. $globals.AIContext);
  42886. $core.addMethod(
  42887. $core.method({
  42888. selector: "initializeAST",
  42889. protocol: "initialization",
  42890. fn: function (){
  42891. var self=this,$self=this;
  42892. return $core.withContext(function($ctx1) {
  42893. var $1;
  42894. $1=$self._method();
  42895. $ctx1.sendIdx["method"]=1;
  42896. $self["@ast"]=$recv($1)._ast();
  42897. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  42898. return self;
  42899. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  42900. },
  42901. args: [],
  42902. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  42903. referencedClasses: ["SemanticAnalyzer"],
  42904. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  42905. }),
  42906. $globals.AIContext);
  42907. $core.addMethod(
  42908. $core.method({
  42909. selector: "initializeFromMethodContext:",
  42910. protocol: "initialization",
  42911. fn: function (aMethodContext){
  42912. var self=this,$self=this;
  42913. return $core.withContext(function($ctx1) {
  42914. var $1,$2,$3,$receiver;
  42915. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  42916. $self._index_($recv(aMethodContext)._index());
  42917. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  42918. $self._receiver_($recv(aMethodContext)._receiver());
  42919. $self._supercall_($recv(aMethodContext)._supercall());
  42920. $self._selector_($recv(aMethodContext)._selector());
  42921. $1=$recv(aMethodContext)._outerContext();
  42922. $ctx1.sendIdx["outerContext"]=1;
  42923. if(($receiver = $1) == null || $receiver.a$nil){
  42924. $1;
  42925. } else {
  42926. var outer;
  42927. outer=$receiver;
  42928. $2=$recv(outer)._methodContext();
  42929. if(($receiver = $2) == null || $receiver.a$nil){
  42930. $2;
  42931. } else {
  42932. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  42933. }
  42934. $3=$recv(aMethodContext)._locals();
  42935. $ctx1.sendIdx["locals"]=1;
  42936. $recv($3)._keysAndValuesDo_((function(key,value){
  42937. return $core.withContext(function($ctx2) {
  42938. return $recv($self._locals())._at_put_(key,value);
  42939. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  42940. }));
  42941. }
  42942. return self;
  42943. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  42944. },
  42945. args: ["aMethodContext"],
  42946. source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09supercall: aMethodContext supercall;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
  42947. referencedClasses: [],
  42948. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  42949. }),
  42950. $globals.AIContext);
  42951. $core.addMethod(
  42952. $core.method({
  42953. selector: "initializeInterpreter",
  42954. protocol: "initialization",
  42955. fn: function (){
  42956. var self=this,$self=this;
  42957. return $core.withContext(function($ctx1) {
  42958. var $1,$2,$receiver;
  42959. $1=$recv($globals.ASTInterpreter)._new();
  42960. $recv($1)._context_(self);
  42961. $self["@interpreter"]=$recv($1)._yourself();
  42962. $2=$self._innerContext();
  42963. if(($receiver = $2) == null || $receiver.a$nil){
  42964. $2;
  42965. } else {
  42966. $self._setupInterpreter_($self["@interpreter"]);
  42967. }
  42968. return self;
  42969. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  42970. },
  42971. args: [],
  42972. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  42973. referencedClasses: ["ASTInterpreter"],
  42974. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  42975. }),
  42976. $globals.AIContext);
  42977. $core.addMethod(
  42978. $core.method({
  42979. selector: "initializeLocals",
  42980. protocol: "initialization",
  42981. fn: function (){
  42982. var self=this,$self=this;
  42983. return $core.withContext(function($ctx1) {
  42984. $self["@locals"]=$recv($globals.Dictionary)._new();
  42985. $recv($self["@locals"])._at_put_("thisContext",self);
  42986. return self;
  42987. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  42988. },
  42989. args: [],
  42990. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  42991. referencedClasses: ["Dictionary"],
  42992. messageSends: ["new", "at:put:"]
  42993. }),
  42994. $globals.AIContext);
  42995. $core.addMethod(
  42996. $core.method({
  42997. selector: "innerContext",
  42998. protocol: "accessing",
  42999. fn: function (){
  43000. var self=this,$self=this;
  43001. return $self["@innerContext"];
  43002. },
  43003. args: [],
  43004. source: "innerContext\x0a\x09^ innerContext",
  43005. referencedClasses: [],
  43006. messageSends: []
  43007. }),
  43008. $globals.AIContext);
  43009. $core.addMethod(
  43010. $core.method({
  43011. selector: "innerContext:",
  43012. protocol: "accessing",
  43013. fn: function (anAIContext){
  43014. var self=this,$self=this;
  43015. $self["@innerContext"]=anAIContext;
  43016. return self;
  43017. },
  43018. args: ["anAIContext"],
  43019. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  43020. referencedClasses: [],
  43021. messageSends: []
  43022. }),
  43023. $globals.AIContext);
  43024. $core.addMethod(
  43025. $core.method({
  43026. selector: "interpreter",
  43027. protocol: "interpreting",
  43028. fn: function (){
  43029. var self=this,$self=this;
  43030. return $core.withContext(function($ctx1) {
  43031. var $1,$receiver;
  43032. $1=$self["@interpreter"];
  43033. if(($receiver = $1) == null || $receiver.a$nil){
  43034. $self._initializeInterpreter();
  43035. } else {
  43036. $1;
  43037. }
  43038. return $self["@interpreter"];
  43039. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  43040. },
  43041. args: [],
  43042. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  43043. referencedClasses: [],
  43044. messageSends: ["ifNil:", "initializeInterpreter"]
  43045. }),
  43046. $globals.AIContext);
  43047. $core.addMethod(
  43048. $core.method({
  43049. selector: "interpreter:",
  43050. protocol: "interpreting",
  43051. fn: function (anInterpreter){
  43052. var self=this,$self=this;
  43053. $self["@interpreter"]=anInterpreter;
  43054. return self;
  43055. },
  43056. args: ["anInterpreter"],
  43057. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  43058. referencedClasses: [],
  43059. messageSends: []
  43060. }),
  43061. $globals.AIContext);
  43062. $core.addMethod(
  43063. $core.method({
  43064. selector: "isTopContext",
  43065. protocol: "testing",
  43066. fn: function (){
  43067. var self=this,$self=this;
  43068. return $core.withContext(function($ctx1) {
  43069. return $recv($self._innerContext())._isNil();
  43070. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  43071. },
  43072. args: [],
  43073. source: "isTopContext\x0a\x09^ self innerContext isNil",
  43074. referencedClasses: [],
  43075. messageSends: ["isNil", "innerContext"]
  43076. }),
  43077. $globals.AIContext);
  43078. $core.addMethod(
  43079. $core.method({
  43080. selector: "localAt:",
  43081. protocol: "accessing",
  43082. fn: function (aString){
  43083. var self=this,$self=this;
  43084. var context;
  43085. return $core.withContext(function($ctx1) {
  43086. context=$self._lookupContextForLocal_(aString);
  43087. return $recv(context)._basicLocalAt_(aString);
  43088. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  43089. },
  43090. args: ["aString"],
  43091. source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09^ context basicLocalAt: aString",
  43092. referencedClasses: [],
  43093. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  43094. }),
  43095. $globals.AIContext);
  43096. $core.addMethod(
  43097. $core.method({
  43098. selector: "localAt:ifAbsent:",
  43099. protocol: "accessing",
  43100. fn: function (aString,aBlock){
  43101. var self=this,$self=this;
  43102. var context;
  43103. return $core.withContext(function($ctx1) {
  43104. var $early={};
  43105. try {
  43106. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  43107. return $core.withContext(function($ctx2) {
  43108. throw $early=[$recv(aBlock)._value()];
  43109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43110. }));
  43111. return $recv(context)._basicLocalAt_(aString);
  43112. }
  43113. catch(e) {if(e===$early)return e[0]; throw e}
  43114. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  43115. },
  43116. args: ["aString", "aBlock"],
  43117. source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self \x09\x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ ^ aBlock value ].\x0a\x09\x0a\x09^ context basicLocalAt: aString",
  43118. referencedClasses: [],
  43119. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  43120. }),
  43121. $globals.AIContext);
  43122. $core.addMethod(
  43123. $core.method({
  43124. selector: "localAt:put:",
  43125. protocol: "accessing",
  43126. fn: function (aString,anObject){
  43127. var self=this,$self=this;
  43128. var context;
  43129. return $core.withContext(function($ctx1) {
  43130. context=$self._lookupContextForLocal_(aString);
  43131. $recv(context)._basicLocalAt_put_(aString,anObject);
  43132. return self;
  43133. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  43134. },
  43135. args: ["aString", "anObject"],
  43136. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  43137. referencedClasses: [],
  43138. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  43139. }),
  43140. $globals.AIContext);
  43141. $core.addMethod(
  43142. $core.method({
  43143. selector: "locals",
  43144. protocol: "accessing",
  43145. fn: function (){
  43146. var self=this,$self=this;
  43147. return $core.withContext(function($ctx1) {
  43148. var $1,$receiver;
  43149. $1=$self["@locals"];
  43150. if(($receiver = $1) == null || $receiver.a$nil){
  43151. $self._initializeLocals();
  43152. } else {
  43153. $1;
  43154. }
  43155. return $self["@locals"];
  43156. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  43157. },
  43158. args: [],
  43159. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  43160. referencedClasses: [],
  43161. messageSends: ["ifNil:", "initializeLocals"]
  43162. }),
  43163. $globals.AIContext);
  43164. $core.addMethod(
  43165. $core.method({
  43166. selector: "lookupContextForLocal:",
  43167. protocol: "private",
  43168. fn: function (aString){
  43169. var self=this,$self=this;
  43170. return $core.withContext(function($ctx1) {
  43171. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  43172. return $core.withContext(function($ctx2) {
  43173. return $self._variableNotFound();
  43174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43175. }));
  43176. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  43177. },
  43178. args: ["aString"],
  43179. source: "lookupContextForLocal: aString\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self \x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ self variableNotFound ]",
  43180. referencedClasses: [],
  43181. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  43182. }),
  43183. $globals.AIContext);
  43184. $core.addMethod(
  43185. $core.method({
  43186. selector: "lookupContextForLocal:ifNone:",
  43187. protocol: "private",
  43188. fn: function (aString,aBlock){
  43189. var self=this,$self=this;
  43190. return $core.withContext(function($ctx1) {
  43191. var $1;
  43192. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  43193. return self;
  43194. }),(function(){
  43195. return $core.withContext(function($ctx2) {
  43196. $1=$self._outerContext();
  43197. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  43198. return $core.withContext(function($ctx3) {
  43199. return $recv(context)._lookupContextForLocal_(aString);
  43200. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  43201. }));
  43202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43203. }));
  43204. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  43205. },
  43206. args: ["aString", "aBlock"],
  43207. source: "lookupContextForLocal: aString ifNone: aBlock\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self locals \x0a\x09\x09at: aString\x0a\x09\x09ifPresent: [ self ]\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09self outerContext \x0a\x09\x09\x09\x09ifNil: aBlock\x0a\x09\x09\x09\x09ifNotNil: [ :context | \x0a\x09\x09\x09\x09\x09context lookupContextForLocal: aString ] ]",
  43208. referencedClasses: [],
  43209. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  43210. }),
  43211. $globals.AIContext);
  43212. $core.addMethod(
  43213. $core.method({
  43214. selector: "newInnerContext",
  43215. protocol: "factory",
  43216. fn: function (){
  43217. var self=this,$self=this;
  43218. return $core.withContext(function($ctx1) {
  43219. var $1;
  43220. $1=$recv($self._class())._new();
  43221. $recv($1)._outerContext_(self);
  43222. return $recv($1)._yourself();
  43223. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  43224. },
  43225. args: [],
  43226. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  43227. referencedClasses: [],
  43228. messageSends: ["outerContext:", "new", "class", "yourself"]
  43229. }),
  43230. $globals.AIContext);
  43231. $core.addMethod(
  43232. $core.method({
  43233. selector: "outerContext",
  43234. protocol: "accessing",
  43235. fn: function (){
  43236. var self=this,$self=this;
  43237. return $self["@outerContext"];
  43238. },
  43239. args: [],
  43240. source: "outerContext\x0a\x09^ outerContext",
  43241. referencedClasses: [],
  43242. messageSends: []
  43243. }),
  43244. $globals.AIContext);
  43245. $core.addMethod(
  43246. $core.method({
  43247. selector: "outerContext:",
  43248. protocol: "accessing",
  43249. fn: function (anAIContext){
  43250. var self=this,$self=this;
  43251. return $core.withContext(function($ctx1) {
  43252. var $1,$receiver;
  43253. $self["@outerContext"]=anAIContext;
  43254. $1=$self["@outerContext"];
  43255. if(($receiver = $1) == null || $receiver.a$nil){
  43256. $1;
  43257. } else {
  43258. var context;
  43259. context=$receiver;
  43260. $recv(context)._innerContext_(self);
  43261. }
  43262. return self;
  43263. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  43264. },
  43265. args: ["anAIContext"],
  43266. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  43267. referencedClasses: [],
  43268. messageSends: ["ifNotNil:", "innerContext:"]
  43269. }),
  43270. $globals.AIContext);
  43271. $core.addMethod(
  43272. $core.method({
  43273. selector: "receiver:",
  43274. protocol: "interpreting",
  43275. fn: function (anObject){
  43276. var self=this,$self=this;
  43277. return $core.withContext(function($ctx1) {
  43278. $recv($self._locals())._at_put_("self",anObject);
  43279. return self;
  43280. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  43281. },
  43282. args: ["anObject"],
  43283. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  43284. referencedClasses: [],
  43285. messageSends: ["at:put:", "locals"]
  43286. }),
  43287. $globals.AIContext);
  43288. $core.addMethod(
  43289. $core.method({
  43290. selector: "selector",
  43291. protocol: "accessing",
  43292. fn: function (){
  43293. var self=this,$self=this;
  43294. return $self["@selector"];
  43295. },
  43296. args: [],
  43297. source: "selector\x0a\x09^ selector",
  43298. referencedClasses: [],
  43299. messageSends: []
  43300. }),
  43301. $globals.AIContext);
  43302. $core.addMethod(
  43303. $core.method({
  43304. selector: "selector:",
  43305. protocol: "accessing",
  43306. fn: function (aString){
  43307. var self=this,$self=this;
  43308. $self["@selector"]=aString;
  43309. return self;
  43310. },
  43311. args: ["aString"],
  43312. source: "selector: aString\x0a\x09selector := aString",
  43313. referencedClasses: [],
  43314. messageSends: []
  43315. }),
  43316. $globals.AIContext);
  43317. $core.addMethod(
  43318. $core.method({
  43319. selector: "sendIndexAt:",
  43320. protocol: "accessing",
  43321. fn: function (aString){
  43322. var self=this,$self=this;
  43323. return $core.withContext(function($ctx1) {
  43324. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  43325. return (0);
  43326. }));
  43327. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  43328. },
  43329. args: ["aString"],
  43330. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  43331. referencedClasses: [],
  43332. messageSends: ["at:ifAbsent:", "sendIndexes"]
  43333. }),
  43334. $globals.AIContext);
  43335. $core.addMethod(
  43336. $core.method({
  43337. selector: "sendIndexes",
  43338. protocol: "accessing",
  43339. fn: function (){
  43340. var self=this,$self=this;
  43341. return $core.withContext(function($ctx1) {
  43342. var $1,$receiver;
  43343. $1=$self["@sendIndexes"];
  43344. if(($receiver = $1) == null || $receiver.a$nil){
  43345. return $recv($globals.Dictionary)._new();
  43346. } else {
  43347. return $1;
  43348. }
  43349. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  43350. },
  43351. args: [],
  43352. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  43353. referencedClasses: ["Dictionary"],
  43354. messageSends: ["ifNil:", "new"]
  43355. }),
  43356. $globals.AIContext);
  43357. $core.addMethod(
  43358. $core.method({
  43359. selector: "sendIndexes:",
  43360. protocol: "accessing",
  43361. fn: function (aDictionary){
  43362. var self=this,$self=this;
  43363. $self["@sendIndexes"]=aDictionary;
  43364. return self;
  43365. },
  43366. args: ["aDictionary"],
  43367. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  43368. referencedClasses: [],
  43369. messageSends: []
  43370. }),
  43371. $globals.AIContext);
  43372. $core.addMethod(
  43373. $core.method({
  43374. selector: "setupInterpreter:",
  43375. protocol: "interpreting",
  43376. fn: function (anInterpreter){
  43377. var self=this,$self=this;
  43378. var currentNode;
  43379. return $core.withContext(function($ctx1) {
  43380. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  43381. $1=$recv($globals.ASTPCNodeVisitor)._new();
  43382. $2=$self._evaluatedSelector();
  43383. $ctx1.sendIdx["evaluatedSelector"]=1;
  43384. $recv($1)._selector_($2);
  43385. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  43386. $3=$self._ast();
  43387. $ctx1.sendIdx["ast"]=1;
  43388. $recv($1)._visit_($3);
  43389. currentNode=$recv($1)._currentNode();
  43390. $4=$recv($self._ast())._sequenceNode();
  43391. if(($receiver = $4) == null || $receiver.a$nil){
  43392. $4;
  43393. } else {
  43394. var sequence;
  43395. sequence=$receiver;
  43396. $recv($recv(sequence)._temps())._do_((function(each){
  43397. return $core.withContext(function($ctx2) {
  43398. return $self._defineLocal_(each);
  43399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43400. }));
  43401. $ctx1.sendIdx["do:"]=1;
  43402. }
  43403. $recv(anInterpreter)._node_(currentNode);
  43404. $7=$self._innerContext();
  43405. $ctx1.sendIdx["innerContext"]=1;
  43406. $6=$recv($7)._arguments();
  43407. $5=$recv($6)._reversed();
  43408. $recv($5)._do_((function(each){
  43409. return $core.withContext(function($ctx2) {
  43410. return $recv(anInterpreter)._push_(each);
  43411. $ctx2.sendIdx["push:"]=1;
  43412. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  43413. }));
  43414. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  43415. return self;
  43416. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  43417. },
  43418. args: ["anInterpreter"],
  43419. source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09index: (self sendIndexAt: self evaluatedSelector);\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  43420. referencedClasses: ["ASTPCNodeVisitor"],
  43421. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  43422. }),
  43423. $globals.AIContext);
  43424. $core.addMethod(
  43425. $core.method({
  43426. selector: "supercall",
  43427. protocol: "interpreting",
  43428. fn: function (){
  43429. var self=this,$self=this;
  43430. return $core.withContext(function($ctx1) {
  43431. var $1,$receiver;
  43432. $1=$self["@supercall"];
  43433. if(($receiver = $1) == null || $receiver.a$nil){
  43434. return false;
  43435. } else {
  43436. return $1;
  43437. }
  43438. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  43439. },
  43440. args: [],
  43441. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  43442. referencedClasses: [],
  43443. messageSends: ["ifNil:"]
  43444. }),
  43445. $globals.AIContext);
  43446. $core.addMethod(
  43447. $core.method({
  43448. selector: "supercall:",
  43449. protocol: "interpreting",
  43450. fn: function (aBoolean){
  43451. var self=this,$self=this;
  43452. $self["@supercall"]=aBoolean;
  43453. return self;
  43454. },
  43455. args: ["aBoolean"],
  43456. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  43457. referencedClasses: [],
  43458. messageSends: []
  43459. }),
  43460. $globals.AIContext);
  43461. $core.addMethod(
  43462. $core.method({
  43463. selector: "variableNotFound",
  43464. protocol: "error handling",
  43465. fn: function (){
  43466. var self=this,$self=this;
  43467. return $core.withContext(function($ctx1) {
  43468. $self._error_("Variable missing");
  43469. return self;
  43470. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  43471. },
  43472. args: [],
  43473. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  43474. referencedClasses: [],
  43475. messageSends: ["error:"]
  43476. }),
  43477. $globals.AIContext);
  43478. $core.addMethod(
  43479. $core.method({
  43480. selector: "fromMethodContext:",
  43481. protocol: "instance creation",
  43482. fn: function (aMethodContext){
  43483. var self=this,$self=this;
  43484. return $core.withContext(function($ctx1) {
  43485. var $1;
  43486. $1=$self._new();
  43487. $recv($1)._initializeFromMethodContext_(aMethodContext);
  43488. return $recv($1)._yourself();
  43489. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  43490. },
  43491. args: ["aMethodContext"],
  43492. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  43493. referencedClasses: [],
  43494. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  43495. }),
  43496. $globals.AIContext.a$cls);
  43497. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  43498. $globals.AISemanticAnalyzer.comment="I perform the same semantic analysis than `SemanticAnalyzer`, with the difference that provided an `AIContext` context, variables are bound with the context variables.";
  43499. $core.addMethod(
  43500. $core.method({
  43501. selector: "context",
  43502. protocol: "accessing",
  43503. fn: function (){
  43504. var self=this,$self=this;
  43505. return $self["@context"];
  43506. },
  43507. args: [],
  43508. source: "context\x0a\x09^ context",
  43509. referencedClasses: [],
  43510. messageSends: []
  43511. }),
  43512. $globals.AISemanticAnalyzer);
  43513. $core.addMethod(
  43514. $core.method({
  43515. selector: "context:",
  43516. protocol: "accessing",
  43517. fn: function (anAIContext){
  43518. var self=this,$self=this;
  43519. $self["@context"]=anAIContext;
  43520. return self;
  43521. },
  43522. args: ["anAIContext"],
  43523. source: "context: anAIContext\x0a\x09context := anAIContext",
  43524. referencedClasses: [],
  43525. messageSends: []
  43526. }),
  43527. $globals.AISemanticAnalyzer);
  43528. $core.addMethod(
  43529. $core.method({
  43530. selector: "visitVariableNode:",
  43531. protocol: "visiting",
  43532. fn: function (aNode){
  43533. var self=this,$self=this;
  43534. return $core.withContext(function($ctx1) {
  43535. var $1;
  43536. var $early={};
  43537. try {
  43538. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  43539. return $core.withContext(function($ctx2) {
  43540. $1=(
  43541. $ctx2.supercall = true,
  43542. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  43543. $ctx2.supercall = false;
  43544. throw $early=[$1];
  43545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43546. }));
  43547. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  43548. return self;
  43549. }
  43550. catch(e) {if(e===$early)return e[0]; throw e}
  43551. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  43552. },
  43553. args: ["aNode"],
  43554. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  43555. referencedClasses: ["ASTContextVar"],
  43556. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  43557. }),
  43558. $globals.AISemanticAnalyzer);
  43559. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  43560. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  43561. $core.addMethod(
  43562. $core.method({
  43563. selector: "context",
  43564. protocol: "accessing",
  43565. fn: function (){
  43566. var self=this,$self=this;
  43567. return $self["@context"];
  43568. },
  43569. args: [],
  43570. source: "context\x0a\x09^ context",
  43571. referencedClasses: [],
  43572. messageSends: []
  43573. }),
  43574. $globals.ASTContextVar);
  43575. $core.addMethod(
  43576. $core.method({
  43577. selector: "context:",
  43578. protocol: "accessing",
  43579. fn: function (anObject){
  43580. var self=this,$self=this;
  43581. $self["@context"]=anObject;
  43582. return self;
  43583. },
  43584. args: ["anObject"],
  43585. source: "context: anObject\x0a\x09context := anObject",
  43586. referencedClasses: [],
  43587. messageSends: []
  43588. }),
  43589. $globals.ASTContextVar);
  43590. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  43591. $globals.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from an `AIContext` 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.";
  43592. $core.addMethod(
  43593. $core.method({
  43594. selector: "atEnd",
  43595. protocol: "testing",
  43596. fn: function (){
  43597. var self=this,$self=this;
  43598. return $core.withContext(function($ctx1) {
  43599. var $1,$receiver;
  43600. $1=$self._context();
  43601. $ctx1.sendIdx["context"]=1;
  43602. if(($receiver = $1) == null || $receiver.a$nil){
  43603. return true;
  43604. } else {
  43605. $1;
  43606. }
  43607. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  43608. return $core.withContext(function($ctx2) {
  43609. return $recv($self._context())._isTopContext();
  43610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43611. }));
  43612. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  43613. },
  43614. args: [],
  43615. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  43616. referencedClasses: [],
  43617. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  43618. }),
  43619. $globals.ASTDebugger);
  43620. $core.addMethod(
  43621. $core.method({
  43622. selector: "context",
  43623. protocol: "accessing",
  43624. fn: function (){
  43625. var self=this,$self=this;
  43626. return $self["@context"];
  43627. },
  43628. args: [],
  43629. source: "context\x0a\x09^ context",
  43630. referencedClasses: [],
  43631. messageSends: []
  43632. }),
  43633. $globals.ASTDebugger);
  43634. $core.addMethod(
  43635. $core.method({
  43636. selector: "context:",
  43637. protocol: "accessing",
  43638. fn: function (aContext){
  43639. var self=this,$self=this;
  43640. $self["@context"]=aContext;
  43641. return self;
  43642. },
  43643. args: ["aContext"],
  43644. source: "context: aContext\x0a\x09context := aContext",
  43645. referencedClasses: [],
  43646. messageSends: []
  43647. }),
  43648. $globals.ASTDebugger);
  43649. $core.addMethod(
  43650. $core.method({
  43651. selector: "flushInnerContexts",
  43652. protocol: "actions",
  43653. fn: function (){
  43654. var self=this,$self=this;
  43655. return $core.withContext(function($ctx1) {
  43656. var $1,$receiver;
  43657. $1=$self._context();
  43658. if(($receiver = $1) == null || $receiver.a$nil){
  43659. $1;
  43660. } else {
  43661. var cxt;
  43662. cxt=$receiver;
  43663. $recv(cxt)._innerContext_(nil);
  43664. }
  43665. return self;
  43666. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  43667. },
  43668. args: [],
  43669. source: "flushInnerContexts\x0a\x09\x22When stepping, the inner contexts are not relevent anymore,\x0a\x09and can be flushed\x22\x0a\x09\x0a\x09self context ifNotNil: [ :cxt | \x0a\x09\x09cxt innerContext: nil ]",
  43670. referencedClasses: [],
  43671. messageSends: ["ifNotNil:", "context", "innerContext:"]
  43672. }),
  43673. $globals.ASTDebugger);
  43674. $core.addMethod(
  43675. $core.method({
  43676. selector: "interpreter",
  43677. protocol: "accessing",
  43678. fn: function (){
  43679. var self=this,$self=this;
  43680. return $core.withContext(function($ctx1) {
  43681. var $1,$receiver;
  43682. $1=$self._context();
  43683. if(($receiver = $1) == null || $receiver.a$nil){
  43684. return $1;
  43685. } else {
  43686. var ctx;
  43687. ctx=$receiver;
  43688. return $recv(ctx)._interpreter();
  43689. }
  43690. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  43691. },
  43692. args: [],
  43693. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  43694. referencedClasses: [],
  43695. messageSends: ["ifNotNil:", "context", "interpreter"]
  43696. }),
  43697. $globals.ASTDebugger);
  43698. $core.addMethod(
  43699. $core.method({
  43700. selector: "method",
  43701. protocol: "accessing",
  43702. fn: function (){
  43703. var self=this,$self=this;
  43704. return $core.withContext(function($ctx1) {
  43705. return $recv($self._context())._method();
  43706. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  43707. },
  43708. args: [],
  43709. source: "method\x0a\x09^ self context method",
  43710. referencedClasses: [],
  43711. messageSends: ["method", "context"]
  43712. }),
  43713. $globals.ASTDebugger);
  43714. $core.addMethod(
  43715. $core.method({
  43716. selector: "node",
  43717. protocol: "accessing",
  43718. fn: function (){
  43719. var self=this,$self=this;
  43720. return $core.withContext(function($ctx1) {
  43721. var $1,$receiver;
  43722. $1=$self._interpreter();
  43723. $ctx1.sendIdx["interpreter"]=1;
  43724. if(($receiver = $1) == null || $receiver.a$nil){
  43725. return $1;
  43726. } else {
  43727. return $recv($self._interpreter())._node();
  43728. }
  43729. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  43730. },
  43731. args: [],
  43732. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  43733. referencedClasses: [],
  43734. messageSends: ["ifNotNil:", "interpreter", "node"]
  43735. }),
  43736. $globals.ASTDebugger);
  43737. $core.addMethod(
  43738. $core.method({
  43739. selector: "onStep",
  43740. protocol: "private",
  43741. fn: function (){
  43742. var self=this,$self=this;
  43743. return $core.withContext(function($ctx1) {
  43744. var $1,$3,$2,$4,$6,$5,$receiver;
  43745. $1=$self._interpreter();
  43746. $ctx1.sendIdx["interpreter"]=1;
  43747. $self["@result"]=$recv($1)._result();
  43748. $3=$self._interpreter();
  43749. $ctx1.sendIdx["interpreter"]=2;
  43750. $2=$recv($3)._atEnd();
  43751. $ctx1.sendIdx["atEnd"]=1;
  43752. if($core.assert($2)){
  43753. $4=$recv($self._context())._outerContext();
  43754. if(($receiver = $4) == null || $receiver.a$nil){
  43755. $4;
  43756. } else {
  43757. var outerContext;
  43758. outerContext=$receiver;
  43759. $self._context_(outerContext);
  43760. }
  43761. $6=$self._interpreter();
  43762. $ctx1.sendIdx["interpreter"]=3;
  43763. $5=$recv($6)._atEnd();
  43764. if(!$core.assert($5)){
  43765. $recv($self._interpreter())._skip();
  43766. }
  43767. }
  43768. $self._flushInnerContexts();
  43769. return self;
  43770. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  43771. },
  43772. args: [],
  43773. source: "onStep\x0a\x09\x22After each step, check if the interpreter is at the end,\x0a\x09and if it is move to its outer context if any, skipping its \x0a\x09current node (which was just evaluated by the current \x0a\x09interpreter).\x0a\x09\x0a\x09After each step we also flush inner contexts.\x22\x0a\x09\x0a\x09result := self interpreter result.\x0a\x09\x0a\x09self interpreter atEnd ifTrue: [\x0a\x09\x09self context outerContext ifNotNil: [ :outerContext | \x0a\x09\x09\x09self context: outerContext ].\x0a\x09\x09self interpreter atEnd ifFalse: [ self interpreter skip ] ].\x0a\x09\x09\x0a\x09self flushInnerContexts",
  43774. referencedClasses: [],
  43775. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  43776. }),
  43777. $globals.ASTDebugger);
  43778. $core.addMethod(
  43779. $core.method({
  43780. selector: "proceed",
  43781. protocol: "stepping",
  43782. fn: function (){
  43783. var self=this,$self=this;
  43784. return $core.withContext(function($ctx1) {
  43785. $recv((function(){
  43786. return $core.withContext(function($ctx2) {
  43787. return $self._atEnd();
  43788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43789. }))._whileFalse_((function(){
  43790. return $core.withContext(function($ctx2) {
  43791. return $self._stepOver();
  43792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43793. }));
  43794. return self;
  43795. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  43796. },
  43797. args: [],
  43798. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  43799. referencedClasses: [],
  43800. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  43801. }),
  43802. $globals.ASTDebugger);
  43803. $core.addMethod(
  43804. $core.method({
  43805. selector: "restart",
  43806. protocol: "stepping",
  43807. fn: function (){
  43808. var self=this,$self=this;
  43809. return $core.withContext(function($ctx1) {
  43810. $recv($self._interpreter())._restart();
  43811. $self._flushInnerContexts();
  43812. return self;
  43813. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  43814. },
  43815. args: [],
  43816. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  43817. referencedClasses: [],
  43818. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  43819. }),
  43820. $globals.ASTDebugger);
  43821. $core.addMethod(
  43822. $core.method({
  43823. selector: "result",
  43824. protocol: "accessing",
  43825. fn: function (){
  43826. var self=this,$self=this;
  43827. return $self["@result"];
  43828. },
  43829. args: [],
  43830. source: "result\x0a\x09^ result",
  43831. referencedClasses: [],
  43832. messageSends: []
  43833. }),
  43834. $globals.ASTDebugger);
  43835. $core.addMethod(
  43836. $core.method({
  43837. selector: "stepInto",
  43838. protocol: "stepping",
  43839. fn: function (){
  43840. var self=this,$self=this;
  43841. return $core.withContext(function($ctx1) {
  43842. $self._shouldBeImplemented();
  43843. return self;
  43844. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  43845. },
  43846. args: [],
  43847. source: "stepInto\x0a\x09self shouldBeImplemented",
  43848. referencedClasses: [],
  43849. messageSends: ["shouldBeImplemented"]
  43850. }),
  43851. $globals.ASTDebugger);
  43852. $core.addMethod(
  43853. $core.method({
  43854. selector: "stepOver",
  43855. protocol: "stepping",
  43856. fn: function (){
  43857. var self=this,$self=this;
  43858. return $core.withContext(function($ctx1) {
  43859. var $1,$2;
  43860. $1=$recv($self._context())._isTopContext();
  43861. if($core.assert($1)){
  43862. $recv($self._interpreter())._stepOver();
  43863. } else {
  43864. $2=$self._interpreter();
  43865. $ctx1.sendIdx["interpreter"]=1;
  43866. $recv($2)._skip();
  43867. }
  43868. $self._onStep();
  43869. return self;
  43870. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  43871. },
  43872. args: [],
  43873. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  43874. referencedClasses: [],
  43875. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  43876. }),
  43877. $globals.ASTDebugger);
  43878. $core.addMethod(
  43879. $core.method({
  43880. selector: "context:",
  43881. protocol: "instance creation",
  43882. fn: function (aContext){
  43883. var self=this,$self=this;
  43884. return $core.withContext(function($ctx1) {
  43885. var $1;
  43886. $1=$self._new();
  43887. $recv($1)._context_(aContext);
  43888. return $recv($1)._yourself();
  43889. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  43890. },
  43891. args: ["aContext"],
  43892. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  43893. referencedClasses: [],
  43894. messageSends: ["context:", "new", "yourself"]
  43895. }),
  43896. $globals.ASTDebugger.a$cls);
  43897. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  43898. $core.addMethod(
  43899. $core.method({
  43900. selector: "interpreter",
  43901. protocol: "accessing",
  43902. fn: function (){
  43903. var self=this,$self=this;
  43904. return $self["@interpreter"];
  43905. },
  43906. args: [],
  43907. source: "interpreter\x0a\x09^ interpreter",
  43908. referencedClasses: [],
  43909. messageSends: []
  43910. }),
  43911. $globals.ASTEnterNode);
  43912. $core.addMethod(
  43913. $core.method({
  43914. selector: "interpreter:",
  43915. protocol: "accessing",
  43916. fn: function (anObject){
  43917. var self=this,$self=this;
  43918. $self["@interpreter"]=anObject;
  43919. return self;
  43920. },
  43921. args: ["anObject"],
  43922. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  43923. referencedClasses: [],
  43924. messageSends: []
  43925. }),
  43926. $globals.ASTEnterNode);
  43927. $core.addMethod(
  43928. $core.method({
  43929. selector: "visitBlockNode:",
  43930. protocol: "visiting",
  43931. fn: function (aNode){
  43932. var self=this,$self=this;
  43933. return aNode;
  43934. },
  43935. args: ["aNode"],
  43936. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  43937. referencedClasses: [],
  43938. messageSends: []
  43939. }),
  43940. $globals.ASTEnterNode);
  43941. $core.addMethod(
  43942. $core.method({
  43943. selector: "visitDagNode:",
  43944. protocol: "visiting",
  43945. fn: function (aNode){
  43946. var self=this,$self=this;
  43947. return $core.withContext(function($ctx1) {
  43948. var $early={};
  43949. try {
  43950. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  43951. throw $early=[aNode];
  43952. }),(function(nodes){
  43953. return $core.withContext(function($ctx2) {
  43954. throw $early=[$self._visit_($recv(nodes)._first())];
  43955. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  43956. }));
  43957. return self;
  43958. }
  43959. catch(e) {if(e===$early)return e[0]; throw e}
  43960. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  43961. },
  43962. args: ["aNode"],
  43963. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  43964. referencedClasses: [],
  43965. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  43966. }),
  43967. $globals.ASTEnterNode);
  43968. $core.addMethod(
  43969. $core.method({
  43970. selector: "visitSequenceNode:",
  43971. protocol: "visiting",
  43972. fn: function (aNode){
  43973. var self=this,$self=this;
  43974. return $core.withContext(function($ctx1) {
  43975. var $1;
  43976. $recv($recv(aNode)._temps())._do_((function(each){
  43977. return $core.withContext(function($ctx2) {
  43978. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  43979. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43980. }));
  43981. $1=(
  43982. $ctx1.supercall = true,
  43983. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  43984. $ctx1.supercall = false;
  43985. return $1;
  43986. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  43987. },
  43988. args: ["aNode"],
  43989. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  43990. referencedClasses: [],
  43991. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  43992. }),
  43993. $globals.ASTEnterNode);
  43994. $core.addMethod(
  43995. $core.method({
  43996. selector: "on:",
  43997. protocol: "instance creation",
  43998. fn: function (anInterpreter){
  43999. var self=this,$self=this;
  44000. return $core.withContext(function($ctx1) {
  44001. var $1;
  44002. $1=$self._new();
  44003. $recv($1)._interpreter_(anInterpreter);
  44004. return $recv($1)._yourself();
  44005. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  44006. },
  44007. args: ["anInterpreter"],
  44008. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  44009. referencedClasses: [],
  44010. messageSends: ["interpreter:", "new", "yourself"]
  44011. }),
  44012. $globals.ASTEnterNode.a$cls);
  44013. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  44014. $globals.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any";
  44015. $core.addMethod(
  44016. $core.method({
  44017. selector: "assign:to:",
  44018. protocol: "private",
  44019. fn: function (aNode,anObject){
  44020. var self=this,$self=this;
  44021. return $core.withContext(function($ctx1) {
  44022. var $1,$3,$2,$4;
  44023. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  44024. if($core.assert($1)){
  44025. $3=$self._context();
  44026. $ctx1.sendIdx["context"]=1;
  44027. $2=$recv($3)._receiver();
  44028. $4=$recv(aNode)._value();
  44029. $ctx1.sendIdx["value"]=1;
  44030. $recv($2)._instVarAt_put_($4,anObject);
  44031. } else {
  44032. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  44033. }
  44034. return self;
  44035. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  44036. },
  44037. args: ["aNode", "anObject"],
  44038. source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  44039. referencedClasses: [],
  44040. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  44041. }),
  44042. $globals.ASTInterpreter);
  44043. $core.addMethod(
  44044. $core.method({
  44045. selector: "atEnd",
  44046. protocol: "testing",
  44047. fn: function (){
  44048. var self=this,$self=this;
  44049. return $core.withContext(function($ctx1) {
  44050. var $1;
  44051. $1=$self["@forceAtEnd"];
  44052. if($core.assert($1)){
  44053. return true;
  44054. }
  44055. return $recv($self._hasReturned())._or_((function(){
  44056. return $core.withContext(function($ctx2) {
  44057. return $recv($self._node())._isNil();
  44058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44059. }));
  44060. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  44061. },
  44062. args: [],
  44063. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  44064. referencedClasses: [],
  44065. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  44066. }),
  44067. $globals.ASTInterpreter);
  44068. $core.addMethod(
  44069. $core.method({
  44070. selector: "context",
  44071. protocol: "accessing",
  44072. fn: function (){
  44073. var self=this,$self=this;
  44074. return $self["@context"];
  44075. },
  44076. args: [],
  44077. source: "context\x0a\x09^ context",
  44078. referencedClasses: [],
  44079. messageSends: []
  44080. }),
  44081. $globals.ASTInterpreter);
  44082. $core.addMethod(
  44083. $core.method({
  44084. selector: "context:",
  44085. protocol: "accessing",
  44086. fn: function (aContext){
  44087. var self=this,$self=this;
  44088. $self["@context"]=aContext;
  44089. return self;
  44090. },
  44091. args: ["aContext"],
  44092. source: "context: aContext\x0a\x09context := aContext",
  44093. referencedClasses: [],
  44094. messageSends: []
  44095. }),
  44096. $globals.ASTInterpreter);
  44097. $core.addMethod(
  44098. $core.method({
  44099. selector: "enterNode",
  44100. protocol: "interpreting",
  44101. fn: function (){
  44102. var self=this,$self=this;
  44103. return $core.withContext(function($ctx1) {
  44104. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  44105. return self;
  44106. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  44107. },
  44108. args: [],
  44109. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  44110. referencedClasses: ["ASTEnterNode"],
  44111. messageSends: ["node:", "visit:", "on:", "node"]
  44112. }),
  44113. $globals.ASTInterpreter);
  44114. $core.addMethod(
  44115. $core.method({
  44116. selector: "eval:",
  44117. protocol: "private",
  44118. fn: function (aString){
  44119. var self=this,$self=this;
  44120. var source,function_;
  44121. return $core.withContext(function($ctx1) {
  44122. var $3,$2,$1;
  44123. source=$recv($globals.String)._streamContents_((function(str){
  44124. return $core.withContext(function($ctx2) {
  44125. $recv(str)._nextPutAll_("0,(function(");
  44126. $ctx2.sendIdx["nextPutAll:"]=1;
  44127. $3=$self._context();
  44128. $ctx2.sendIdx["context"]=1;
  44129. $2=$recv($3)._locals();
  44130. $ctx2.sendIdx["locals"]=1;
  44131. $1=$recv($2)._keys();
  44132. $recv($1)._do_separatedBy_((function(each){
  44133. return $core.withContext(function($ctx3) {
  44134. return $recv(str)._nextPutAll_(each);
  44135. $ctx3.sendIdx["nextPutAll:"]=2;
  44136. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  44137. }),(function(){
  44138. return $core.withContext(function($ctx3) {
  44139. return $recv(str)._nextPutAll_(",");
  44140. $ctx3.sendIdx["nextPutAll:"]=3;
  44141. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44142. }));
  44143. $recv(str)._nextPutAll_("){ return (function() {");
  44144. $ctx2.sendIdx["nextPutAll:"]=4;
  44145. $recv(str)._nextPutAll_(aString);
  44146. $ctx2.sendIdx["nextPutAll:"]=5;
  44147. return $recv(str)._nextPutAll_("})()})");
  44148. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  44149. }));
  44150. function_=$recv($recv($globals.Compiler)._new())._eval_(source);
  44151. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  44152. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  44153. },
  44154. args: ["aString"],
  44155. 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: '0,(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",
  44156. referencedClasses: ["String", "Compiler"],
  44157. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  44158. }),
  44159. $globals.ASTInterpreter);
  44160. $core.addMethod(
  44161. $core.method({
  44162. selector: "hasReturned",
  44163. protocol: "testing",
  44164. fn: function (){
  44165. var self=this,$self=this;
  44166. return $core.withContext(function($ctx1) {
  44167. var $1,$receiver;
  44168. $1=$self["@returned"];
  44169. if(($receiver = $1) == null || $receiver.a$nil){
  44170. return false;
  44171. } else {
  44172. return $1;
  44173. }
  44174. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  44175. },
  44176. args: [],
  44177. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  44178. referencedClasses: [],
  44179. messageSends: ["ifNil:"]
  44180. }),
  44181. $globals.ASTInterpreter);
  44182. $core.addMethod(
  44183. $core.method({
  44184. selector: "initialize",
  44185. protocol: "initialization",
  44186. fn: function (){
  44187. var self=this,$self=this;
  44188. return $core.withContext(function($ctx1) {
  44189. (
  44190. $ctx1.supercall = true,
  44191. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  44192. $ctx1.supercall = false;
  44193. $self["@forceAtEnd"]=false;
  44194. return self;
  44195. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  44196. },
  44197. args: [],
  44198. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  44199. referencedClasses: [],
  44200. messageSends: ["initialize"]
  44201. }),
  44202. $globals.ASTInterpreter);
  44203. $core.addMethod(
  44204. $core.method({
  44205. selector: "interpret",
  44206. protocol: "interpreting",
  44207. fn: function (){
  44208. var self=this,$self=this;
  44209. return $core.withContext(function($ctx1) {
  44210. $self._visit_($self._node());
  44211. return self;
  44212. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  44213. },
  44214. args: [],
  44215. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  44216. referencedClasses: [],
  44217. messageSends: ["visit:", "node"]
  44218. }),
  44219. $globals.ASTInterpreter);
  44220. $core.addMethod(
  44221. $core.method({
  44222. selector: "messageFromSendNode:arguments:",
  44223. protocol: "private",
  44224. fn: function (aSendNode,aCollection){
  44225. var self=this,$self=this;
  44226. return $core.withContext(function($ctx1) {
  44227. var $1;
  44228. $1=$recv($globals.Message)._new();
  44229. $recv($1)._selector_($recv(aSendNode)._selector());
  44230. $recv($1)._arguments_(aCollection);
  44231. return $recv($1)._yourself();
  44232. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  44233. },
  44234. args: ["aSendNode", "aCollection"],
  44235. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  44236. referencedClasses: ["Message"],
  44237. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  44238. }),
  44239. $globals.ASTInterpreter);
  44240. $core.addMethod(
  44241. $core.method({
  44242. selector: "messageNotUnderstood:receiver:",
  44243. protocol: "private",
  44244. fn: function (aMessage,anObject){
  44245. var self=this,$self=this;
  44246. return $core.withContext(function($ctx1) {
  44247. var $1;
  44248. $1=$recv($globals.MessageNotUnderstood)._new();
  44249. $recv($1)._message_(aMessage);
  44250. $recv($1)._receiver_(anObject);
  44251. $recv($1)._signal();
  44252. return self;
  44253. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  44254. },
  44255. args: ["aMessage", "anObject"],
  44256. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  44257. referencedClasses: ["MessageNotUnderstood"],
  44258. messageSends: ["message:", "new", "receiver:", "signal"]
  44259. }),
  44260. $globals.ASTInterpreter);
  44261. $core.addMethod(
  44262. $core.method({
  44263. selector: "next",
  44264. protocol: "interpreting",
  44265. fn: function (){
  44266. var self=this,$self=this;
  44267. var nd,nextNode;
  44268. return $core.withContext(function($ctx1) {
  44269. var $1,$2,$receiver;
  44270. nd=$self._node();
  44271. $1=$recv(nd)._parent();
  44272. if(($receiver = $1) == null || $receiver.a$nil){
  44273. nextNode=$1;
  44274. } else {
  44275. var parent;
  44276. parent=$receiver;
  44277. $2=$recv(parent)._nextSiblingNode_(nd);
  44278. if(($receiver = $2) == null || $receiver.a$nil){
  44279. nextNode=parent;
  44280. } else {
  44281. var sibling;
  44282. sibling=$receiver;
  44283. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  44284. }
  44285. }
  44286. $self._node_(nextNode);
  44287. return self;
  44288. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  44289. },
  44290. args: [],
  44291. source: "next\x0a\x09| nd nextNode |\x0a\x09nd := self node.\x0a\x09nextNode := nd parent ifNotNil: [ :parent |\x0a\x09\x09(parent nextSiblingNode: nd)\x0a\x09\x09\x09ifNil: [ parent ]\x0a\x09\x09\x09ifNotNil: [ :sibling | (ASTEnterNode on: self) visit: sibling ] ].\x0a\x09self node: nextNode",
  44292. referencedClasses: ["ASTEnterNode"],
  44293. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  44294. }),
  44295. $globals.ASTInterpreter);
  44296. $core.addMethod(
  44297. $core.method({
  44298. selector: "node",
  44299. protocol: "accessing",
  44300. fn: function (){
  44301. var self=this,$self=this;
  44302. return $self["@node"];
  44303. },
  44304. args: [],
  44305. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  44306. referencedClasses: [],
  44307. messageSends: []
  44308. }),
  44309. $globals.ASTInterpreter);
  44310. $core.addMethod(
  44311. $core.method({
  44312. selector: "node:",
  44313. protocol: "accessing",
  44314. fn: function (aNode){
  44315. var self=this,$self=this;
  44316. $self["@node"]=aNode;
  44317. return self;
  44318. },
  44319. args: ["aNode"],
  44320. source: "node: aNode\x0a\x09node := aNode",
  44321. referencedClasses: [],
  44322. messageSends: []
  44323. }),
  44324. $globals.ASTInterpreter);
  44325. $core.addMethod(
  44326. $core.method({
  44327. selector: "peek",
  44328. protocol: "stack",
  44329. fn: function (){
  44330. var self=this,$self=this;
  44331. return $core.withContext(function($ctx1) {
  44332. var $1;
  44333. var $early={};
  44334. try {
  44335. $1=$self._stack();
  44336. $ctx1.sendIdx["stack"]=1;
  44337. $recv($1)._ifEmpty_((function(){
  44338. throw $early=[nil];
  44339. }));
  44340. return $recv($self._stack())._last();
  44341. }
  44342. catch(e) {if(e===$early)return e[0]; throw e}
  44343. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  44344. },
  44345. args: [],
  44346. source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last",
  44347. referencedClasses: [],
  44348. messageSends: ["ifEmpty:", "stack", "last"]
  44349. }),
  44350. $globals.ASTInterpreter);
  44351. $core.addMethod(
  44352. $core.method({
  44353. selector: "pop",
  44354. protocol: "stack",
  44355. fn: function (){
  44356. var self=this,$self=this;
  44357. var peekedValue;
  44358. return $core.withContext(function($ctx1) {
  44359. peekedValue=$self._peek();
  44360. $recv($self._stack())._removeLast();
  44361. return peekedValue;
  44362. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  44363. },
  44364. args: [],
  44365. source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue",
  44366. referencedClasses: [],
  44367. messageSends: ["peek", "removeLast", "stack"]
  44368. }),
  44369. $globals.ASTInterpreter);
  44370. $core.addMethod(
  44371. $core.method({
  44372. selector: "proceed",
  44373. protocol: "interpreting",
  44374. fn: function (){
  44375. var self=this,$self=this;
  44376. return $core.withContext(function($ctx1) {
  44377. $recv((function(){
  44378. return $core.withContext(function($ctx2) {
  44379. return $self._atEnd();
  44380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44381. }))._whileFalse_((function(){
  44382. return $core.withContext(function($ctx2) {
  44383. return $self._step();
  44384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44385. }));
  44386. return self;
  44387. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  44388. },
  44389. args: [],
  44390. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  44391. referencedClasses: [],
  44392. messageSends: ["whileFalse:", "atEnd", "step"]
  44393. }),
  44394. $globals.ASTInterpreter);
  44395. $core.addMethod(
  44396. $core.method({
  44397. selector: "push:",
  44398. protocol: "stack",
  44399. fn: function (anObject){
  44400. var self=this,$self=this;
  44401. return $core.withContext(function($ctx1) {
  44402. return $recv($self._stack())._add_(anObject);
  44403. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  44404. },
  44405. args: ["anObject"],
  44406. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  44407. referencedClasses: [],
  44408. messageSends: ["add:", "stack"]
  44409. }),
  44410. $globals.ASTInterpreter);
  44411. $core.addMethod(
  44412. $core.method({
  44413. selector: "restart",
  44414. protocol: "interpreting",
  44415. fn: function (){
  44416. var self=this,$self=this;
  44417. return $core.withContext(function($ctx1) {
  44418. $self._node_($recv($self._context())._ast());
  44419. $self._enterNode();
  44420. return self;
  44421. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  44422. },
  44423. args: [],
  44424. source: "restart\x0a\x09self node: self context ast; enterNode",
  44425. referencedClasses: [],
  44426. messageSends: ["node:", "ast", "context", "enterNode"]
  44427. }),
  44428. $globals.ASTInterpreter);
  44429. $core.addMethod(
  44430. $core.method({
  44431. selector: "result",
  44432. protocol: "accessing",
  44433. fn: function (){
  44434. var self=this,$self=this;
  44435. return $core.withContext(function($ctx1) {
  44436. var $1;
  44437. $1=$self._hasReturned();
  44438. if($core.assert($1)){
  44439. return $self._returnValue();
  44440. } else {
  44441. return $recv($self._context())._receiver();
  44442. }
  44443. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  44444. },
  44445. args: [],
  44446. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  44447. referencedClasses: [],
  44448. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  44449. }),
  44450. $globals.ASTInterpreter);
  44451. $core.addMethod(
  44452. $core.method({
  44453. selector: "returnValue",
  44454. protocol: "accessing",
  44455. fn: function (){
  44456. var self=this,$self=this;
  44457. return $self["@returnValue"];
  44458. },
  44459. args: [],
  44460. source: "returnValue\x0a\x09^ returnValue",
  44461. referencedClasses: [],
  44462. messageSends: []
  44463. }),
  44464. $globals.ASTInterpreter);
  44465. $core.addMethod(
  44466. $core.method({
  44467. selector: "returnValue:",
  44468. protocol: "accessing",
  44469. fn: function (anObject){
  44470. var self=this,$self=this;
  44471. $self["@returnValue"]=anObject;
  44472. return self;
  44473. },
  44474. args: ["anObject"],
  44475. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  44476. referencedClasses: [],
  44477. messageSends: []
  44478. }),
  44479. $globals.ASTInterpreter);
  44480. $core.addMethod(
  44481. $core.method({
  44482. selector: "sendMessage:to:superSend:",
  44483. protocol: "private",
  44484. fn: function (aMessage,anObject,aBoolean){
  44485. var self=this,$self=this;
  44486. var method;
  44487. return $core.withContext(function($ctx1) {
  44488. var $2,$1,$3,$receiver;
  44489. var $early={};
  44490. try {
  44491. if(!$core.assert(aBoolean)){
  44492. return $recv(aMessage)._sendTo_(anObject);
  44493. }
  44494. $2=$recv(anObject)._class();
  44495. $ctx1.sendIdx["class"]=1;
  44496. $1=$recv($2)._superclass();
  44497. $ctx1.sendIdx["superclass"]=1;
  44498. if(($receiver = $1) == null || $receiver.a$nil){
  44499. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  44500. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  44501. return $3;
  44502. } else {
  44503. $1;
  44504. }
  44505. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  44506. return $core.withContext(function($ctx2) {
  44507. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  44508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44509. }));
  44510. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  44511. }
  44512. catch(e) {if(e===$early)return e[0]; throw e}
  44513. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  44514. },
  44515. args: ["aMessage", "anObject", "aBoolean"],
  44516. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  44517. referencedClasses: [],
  44518. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  44519. }),
  44520. $globals.ASTInterpreter);
  44521. $core.addMethod(
  44522. $core.method({
  44523. selector: "setNonLocalReturnFromContext:",
  44524. protocol: "interpreting",
  44525. fn: function (aContext){
  44526. var self=this,$self=this;
  44527. return $core.withContext(function($ctx1) {
  44528. var $2,$1;
  44529. $2=$recv(aContext)._interpreter();
  44530. $ctx1.sendIdx["interpreter"]=1;
  44531. $1=$recv($2)._hasReturned();
  44532. if($core.assert($1)){
  44533. $self["@returned"]=true;
  44534. $self["@returned"];
  44535. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  44536. }
  44537. return self;
  44538. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  44539. },
  44540. args: ["aContext"],
  44541. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  44542. referencedClasses: [],
  44543. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  44544. }),
  44545. $globals.ASTInterpreter);
  44546. $core.addMethod(
  44547. $core.method({
  44548. selector: "skip",
  44549. protocol: "interpreting",
  44550. fn: function (){
  44551. var self=this,$self=this;
  44552. return $core.withContext(function($ctx1) {
  44553. $self._next();
  44554. return self;
  44555. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  44556. },
  44557. args: [],
  44558. source: "skip\x0a\x09self next",
  44559. referencedClasses: [],
  44560. messageSends: ["next"]
  44561. }),
  44562. $globals.ASTInterpreter);
  44563. $core.addMethod(
  44564. $core.method({
  44565. selector: "stack",
  44566. protocol: "accessing",
  44567. fn: function (){
  44568. var self=this,$self=this;
  44569. return $core.withContext(function($ctx1) {
  44570. var $1,$receiver;
  44571. $1=$self["@stack"];
  44572. if(($receiver = $1) == null || $receiver.a$nil){
  44573. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  44574. return $self["@stack"];
  44575. } else {
  44576. return $1;
  44577. }
  44578. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  44579. },
  44580. args: [],
  44581. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  44582. referencedClasses: ["OrderedCollection"],
  44583. messageSends: ["ifNil:", "new"]
  44584. }),
  44585. $globals.ASTInterpreter);
  44586. $core.addMethod(
  44587. $core.method({
  44588. selector: "step",
  44589. protocol: "interpreting",
  44590. fn: function (){
  44591. var self=this,$self=this;
  44592. return $core.withContext(function($ctx1) {
  44593. $self._interpret();
  44594. $self._next();
  44595. return self;
  44596. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  44597. },
  44598. args: [],
  44599. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  44600. referencedClasses: [],
  44601. messageSends: ["interpret", "next"]
  44602. }),
  44603. $globals.ASTInterpreter);
  44604. $core.addMethod(
  44605. $core.method({
  44606. selector: "stepOver",
  44607. protocol: "interpreting",
  44608. fn: function (){
  44609. var self=this,$self=this;
  44610. return $core.withContext(function($ctx1) {
  44611. var $2,$1;
  44612. $self._step();
  44613. $ctx1.sendIdx["step"]=1;
  44614. $recv((function(){
  44615. return $core.withContext(function($ctx2) {
  44616. $2=$self._node();
  44617. $ctx2.sendIdx["node"]=1;
  44618. $1=$recv($2)._isNil();
  44619. return $recv($1)._or_((function(){
  44620. return $core.withContext(function($ctx3) {
  44621. return $recv($self._node())._isSteppingNode();
  44622. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44623. }));
  44624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44625. }))._whileFalse_((function(){
  44626. return $core.withContext(function($ctx2) {
  44627. return $self._step();
  44628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44629. }));
  44630. return self;
  44631. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  44632. },
  44633. args: [],
  44634. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  44635. referencedClasses: [],
  44636. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  44637. }),
  44638. $globals.ASTInterpreter);
  44639. $core.addMethod(
  44640. $core.method({
  44641. selector: "visit:",
  44642. protocol: "visiting",
  44643. fn: function (aNode){
  44644. var self=this,$self=this;
  44645. return $core.withContext(function($ctx1) {
  44646. var $1;
  44647. $1=$self._hasReturned();
  44648. if(!$core.assert($1)){
  44649. (
  44650. $ctx1.supercall = true,
  44651. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  44652. $ctx1.supercall = false;
  44653. }
  44654. return self;
  44655. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  44656. },
  44657. args: ["aNode"],
  44658. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  44659. referencedClasses: [],
  44660. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  44661. }),
  44662. $globals.ASTInterpreter);
  44663. $core.addMethod(
  44664. $core.method({
  44665. selector: "visitAssignmentNode:",
  44666. protocol: "visiting",
  44667. fn: function (aNode){
  44668. var self=this,$self=this;
  44669. var poppedValue;
  44670. return $core.withContext(function($ctx1) {
  44671. poppedValue=$self._pop();
  44672. $ctx1.sendIdx["pop"]=1;
  44673. $self._pop();
  44674. $self._push_(poppedValue);
  44675. $self._assign_to_($recv(aNode)._left(),poppedValue);
  44676. return self;
  44677. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  44678. },
  44679. args: ["aNode"],
  44680. source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue",
  44681. referencedClasses: [],
  44682. messageSends: ["pop", "push:", "assign:to:", "left"]
  44683. }),
  44684. $globals.ASTInterpreter);
  44685. $core.addMethod(
  44686. $core.method({
  44687. selector: "visitBlockNode:",
  44688. protocol: "visiting",
  44689. fn: function (aNode){
  44690. var self=this,$self=this;
  44691. var block;
  44692. return $core.withContext(function($ctx1) {
  44693. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  44694. $self._push_(block);
  44695. return self;
  44696. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  44697. },
  44698. args: ["aNode"],
  44699. source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block",
  44700. referencedClasses: ["AIBlockClosure"],
  44701. messageSends: ["forContext:node:", "context", "push:"]
  44702. }),
  44703. $globals.ASTInterpreter);
  44704. $core.addMethod(
  44705. $core.method({
  44706. selector: "visitBlockSequenceNode:",
  44707. protocol: "visiting",
  44708. fn: function (aNode){
  44709. var self=this,$self=this;
  44710. return $core.withContext(function($ctx1) {
  44711. (
  44712. $ctx1.supercall = true,
  44713. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  44714. $ctx1.supercall = false;
  44715. $self["@forceAtEnd"]=true;
  44716. return self;
  44717. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44718. },
  44719. args: ["aNode"],
  44720. source: "visitBlockSequenceNode: aNode\x0a\x09\x22If the receiver is actually visiting a BlockSequenceNode,\x0a\x09it means the the context is a block context. Evaluation should \x0a\x09stop right after evaluating the block sequence and the outer\x0a\x09context's interpreter should take over. \x0a\x09Therefore we force #atEnd.\x22\x0a\x09\x0a\x09super visitBlockSequenceNode: aNode.\x0a\x09forceAtEnd := true",
  44721. referencedClasses: [],
  44722. messageSends: ["visitBlockSequenceNode:"]
  44723. }),
  44724. $globals.ASTInterpreter);
  44725. $core.addMethod(
  44726. $core.method({
  44727. selector: "visitDagNode:",
  44728. protocol: "visiting",
  44729. fn: function (aNode){
  44730. var self=this,$self=this;
  44731. return self;
  44732. },
  44733. args: ["aNode"],
  44734. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  44735. referencedClasses: [],
  44736. messageSends: []
  44737. }),
  44738. $globals.ASTInterpreter);
  44739. $core.addMethod(
  44740. $core.method({
  44741. selector: "visitDynamicArrayNode:",
  44742. protocol: "visiting",
  44743. fn: function (aNode){
  44744. var self=this,$self=this;
  44745. var array;
  44746. return $core.withContext(function($ctx1) {
  44747. array=[];
  44748. $recv($recv(aNode)._dagChildren())._do_((function(each){
  44749. return $core.withContext(function($ctx2) {
  44750. return $recv(array)._addFirst_($self._pop());
  44751. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44752. }));
  44753. $self._push_(array);
  44754. return self;
  44755. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  44756. },
  44757. args: ["aNode"],
  44758. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode dagChildren do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  44759. referencedClasses: [],
  44760. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  44761. }),
  44762. $globals.ASTInterpreter);
  44763. $core.addMethod(
  44764. $core.method({
  44765. selector: "visitDynamicDictionaryNode:",
  44766. protocol: "visiting",
  44767. fn: function (aNode){
  44768. var self=this,$self=this;
  44769. var keyValueList;
  44770. return $core.withContext(function($ctx1) {
  44771. keyValueList=$recv($globals.OrderedCollection)._new();
  44772. $recv($recv(aNode)._dagChildren())._do_((function(each){
  44773. return $core.withContext(function($ctx2) {
  44774. return $recv(keyValueList)._add_($self._pop());
  44775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44776. }));
  44777. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  44778. return self;
  44779. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  44780. },
  44781. args: ["aNode"],
  44782. source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode dagChildren do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
  44783. referencedClasses: ["OrderedCollection", "HashedCollection"],
  44784. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  44785. }),
  44786. $globals.ASTInterpreter);
  44787. $core.addMethod(
  44788. $core.method({
  44789. selector: "visitJSStatementNode:",
  44790. protocol: "visiting",
  44791. fn: function (aNode){
  44792. var self=this,$self=this;
  44793. return $core.withContext(function($ctx1) {
  44794. $self["@returned"]=true;
  44795. $self._returnValue_($self._eval_($recv(aNode)._source()));
  44796. return self;
  44797. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44798. },
  44799. args: ["aNode"],
  44800. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  44801. referencedClasses: [],
  44802. messageSends: ["returnValue:", "eval:", "source"]
  44803. }),
  44804. $globals.ASTInterpreter);
  44805. $core.addMethod(
  44806. $core.method({
  44807. selector: "visitReturnNode:",
  44808. protocol: "visiting",
  44809. fn: function (aNode){
  44810. var self=this,$self=this;
  44811. return $core.withContext(function($ctx1) {
  44812. $self["@returned"]=true;
  44813. $self._returnValue_($self._pop());
  44814. return self;
  44815. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44816. },
  44817. args: ["aNode"],
  44818. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  44819. referencedClasses: [],
  44820. messageSends: ["returnValue:", "pop"]
  44821. }),
  44822. $globals.ASTInterpreter);
  44823. $core.addMethod(
  44824. $core.method({
  44825. selector: "visitSendNode:",
  44826. protocol: "visiting",
  44827. fn: function (aNode){
  44828. var self=this,$self=this;
  44829. var receiver,args,message,result;
  44830. return $core.withContext(function($ctx1) {
  44831. var $1;
  44832. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  44833. return $core.withContext(function($ctx2) {
  44834. return $self._pop();
  44835. $ctx2.sendIdx["pop"]=1;
  44836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44837. }));
  44838. receiver=$self._peek();
  44839. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  44840. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  44841. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  44842. return $core.withContext(function($ctx2) {
  44843. return $recv($recv(aNode)._isLastChild())._not();
  44844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44845. }));
  44846. if(!$core.assert($1)){
  44847. $self._pop();
  44848. $self._push_(result);
  44849. }
  44850. return self;
  44851. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  44852. },
  44853. args: ["aNode"],
  44854. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self peek.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifFalse: [ self pop; push: result ]",
  44855. referencedClasses: [],
  44856. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  44857. }),
  44858. $globals.ASTInterpreter);
  44859. $core.addMethod(
  44860. $core.method({
  44861. selector: "visitValueNode:",
  44862. protocol: "visiting",
  44863. fn: function (aNode){
  44864. var self=this,$self=this;
  44865. return $core.withContext(function($ctx1) {
  44866. $self._push_($recv(aNode)._value());
  44867. return self;
  44868. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44869. },
  44870. args: ["aNode"],
  44871. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  44872. referencedClasses: [],
  44873. messageSends: ["push:", "value"]
  44874. }),
  44875. $globals.ASTInterpreter);
  44876. $core.addMethod(
  44877. $core.method({
  44878. selector: "visitVariableNode:",
  44879. protocol: "visiting",
  44880. fn: function (aNode){
  44881. var self=this,$self=this;
  44882. return $core.withContext(function($ctx1) {
  44883. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  44884. $2=$recv(aNode)._binding();
  44885. $ctx1.sendIdx["binding"]=1;
  44886. $1=$recv($2)._isUnknownVar();
  44887. if($core.assert($1)){
  44888. $5=$recv($globals.Platform)._globals();
  44889. $ctx1.sendIdx["globals"]=1;
  44890. $6=$recv(aNode)._value();
  44891. $ctx1.sendIdx["value"]=1;
  44892. $4=$recv($5)._at_ifAbsent_($6,(function(){
  44893. return $core.withContext(function($ctx2) {
  44894. return $self._error_("Unknown variable");
  44895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44896. }));
  44897. $ctx1.sendIdx["at:ifAbsent:"]=1;
  44898. $3=$self._push_($4);
  44899. $ctx1.sendIdx["push:"]=1;
  44900. return $3;
  44901. }
  44902. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  44903. if($core.assert($8)){
  44904. $10=$self._context();
  44905. $ctx1.sendIdx["context"]=1;
  44906. $9=$recv($10)._receiver();
  44907. $11=$recv(aNode)._value();
  44908. $ctx1.sendIdx["value"]=2;
  44909. $7=$recv($9)._instVarAt_($11);
  44910. } else {
  44911. $12=$self._context();
  44912. $13=$recv(aNode)._value();
  44913. $ctx1.sendIdx["value"]=3;
  44914. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  44915. return $core.withContext(function($ctx2) {
  44916. $15=$recv(aNode)._value();
  44917. $ctx2.sendIdx["value"]=4;
  44918. $14=$recv($15)._isCapitalized();
  44919. if($core.assert($14)){
  44920. $16=$recv($globals.Smalltalk)._globals();
  44921. $ctx2.sendIdx["globals"]=2;
  44922. $17=$recv(aNode)._value();
  44923. $ctx2.sendIdx["value"]=5;
  44924. return $recv($16)._at_ifAbsent_($17,(function(){
  44925. return $core.withContext(function($ctx3) {
  44926. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  44927. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  44928. }));
  44929. }
  44930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  44931. }));
  44932. }
  44933. $self._push_($7);
  44934. return self;
  44935. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44936. },
  44937. args: ["aNode"],
  44938. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (Platform globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ Platform globals at: aNode value ] ] ] ])",
  44939. referencedClasses: ["Platform", "Smalltalk"],
  44940. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  44941. }),
  44942. $globals.ASTInterpreter);
  44943. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  44944. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  44945. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  44946. $globals.ASTPCNodeVisitor.comment="I visit an AST until I get to the current node for the `context` 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 is answered by `#currentNode`";
  44947. $core.addMethod(
  44948. $core.method({
  44949. selector: "currentNode",
  44950. protocol: "accessing",
  44951. fn: function (){
  44952. var self=this,$self=this;
  44953. return $self["@currentNode"];
  44954. },
  44955. args: [],
  44956. source: "currentNode\x0a\x09^ currentNode",
  44957. referencedClasses: [],
  44958. messageSends: []
  44959. }),
  44960. $globals.ASTPCNodeVisitor);
  44961. $core.addMethod(
  44962. $core.method({
  44963. selector: "increaseTrackedIndex",
  44964. protocol: "accessing",
  44965. fn: function (){
  44966. var self=this,$self=this;
  44967. return $core.withContext(function($ctx1) {
  44968. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  44969. return self;
  44970. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  44971. },
  44972. args: [],
  44973. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  44974. referencedClasses: [],
  44975. messageSends: ["+", "trackedIndex"]
  44976. }),
  44977. $globals.ASTPCNodeVisitor);
  44978. $core.addMethod(
  44979. $core.method({
  44980. selector: "index",
  44981. protocol: "accessing",
  44982. fn: function (){
  44983. var self=this,$self=this;
  44984. return $self["@index"];
  44985. },
  44986. args: [],
  44987. source: "index\x0a\x09^ index",
  44988. referencedClasses: [],
  44989. messageSends: []
  44990. }),
  44991. $globals.ASTPCNodeVisitor);
  44992. $core.addMethod(
  44993. $core.method({
  44994. selector: "index:",
  44995. protocol: "accessing",
  44996. fn: function (aNumber){
  44997. var self=this,$self=this;
  44998. $self["@index"]=aNumber;
  44999. return self;
  45000. },
  45001. args: ["aNumber"],
  45002. source: "index: aNumber\x0a\x09index := aNumber",
  45003. referencedClasses: [],
  45004. messageSends: []
  45005. }),
  45006. $globals.ASTPCNodeVisitor);
  45007. $core.addMethod(
  45008. $core.method({
  45009. selector: "selector",
  45010. protocol: "accessing",
  45011. fn: function (){
  45012. var self=this,$self=this;
  45013. return $self["@selector"];
  45014. },
  45015. args: [],
  45016. source: "selector\x0a\x09^ selector",
  45017. referencedClasses: [],
  45018. messageSends: []
  45019. }),
  45020. $globals.ASTPCNodeVisitor);
  45021. $core.addMethod(
  45022. $core.method({
  45023. selector: "selector:",
  45024. protocol: "accessing",
  45025. fn: function (aString){
  45026. var self=this,$self=this;
  45027. $self["@selector"]=aString;
  45028. return self;
  45029. },
  45030. args: ["aString"],
  45031. source: "selector: aString\x0a\x09selector := aString",
  45032. referencedClasses: [],
  45033. messageSends: []
  45034. }),
  45035. $globals.ASTPCNodeVisitor);
  45036. $core.addMethod(
  45037. $core.method({
  45038. selector: "trackedIndex",
  45039. protocol: "accessing",
  45040. fn: function (){
  45041. var self=this,$self=this;
  45042. return $core.withContext(function($ctx1) {
  45043. var $1,$receiver;
  45044. $1=$self["@trackedIndex"];
  45045. if(($receiver = $1) == null || $receiver.a$nil){
  45046. $self["@trackedIndex"]=(0);
  45047. return $self["@trackedIndex"];
  45048. } else {
  45049. return $1;
  45050. }
  45051. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  45052. },
  45053. args: [],
  45054. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  45055. referencedClasses: [],
  45056. messageSends: ["ifNil:"]
  45057. }),
  45058. $globals.ASTPCNodeVisitor);
  45059. $core.addMethod(
  45060. $core.method({
  45061. selector: "visitJSStatementNode:",
  45062. protocol: "visiting",
  45063. fn: function (aNode){
  45064. var self=this,$self=this;
  45065. $self["@currentNode"]=aNode;
  45066. return self;
  45067. },
  45068. args: ["aNode"],
  45069. source: "visitJSStatementNode: aNode\x0a\x09\x22If a JSStatementNode is encountered, it always is the current node.\x0a\x09Stop visiting the AST there\x22\x0a\x09\x0a\x09currentNode := aNode",
  45070. referencedClasses: [],
  45071. messageSends: []
  45072. }),
  45073. $globals.ASTPCNodeVisitor);
  45074. $core.addMethod(
  45075. $core.method({
  45076. selector: "visitSendNode:",
  45077. protocol: "visiting",
  45078. fn: function (aNode){
  45079. var self=this,$self=this;
  45080. return $core.withContext(function($ctx1) {
  45081. var $2,$1,$3;
  45082. (
  45083. $ctx1.supercall = true,
  45084. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  45085. $ctx1.supercall = false;
  45086. $2=$self._selector();
  45087. $ctx1.sendIdx["selector"]=1;
  45088. $1=$recv($2).__eq($recv(aNode)._selector());
  45089. $ctx1.sendIdx["="]=1;
  45090. if($core.assert($1)){
  45091. $3=$recv($self._trackedIndex()).__eq($self._index());
  45092. if($core.assert($3)){
  45093. $self["@currentNode"]=aNode;
  45094. $self["@currentNode"];
  45095. }
  45096. $self._increaseTrackedIndex();
  45097. }
  45098. return self;
  45099. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  45100. },
  45101. args: ["aNode"],
  45102. source: "visitSendNode: aNode\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self trackedIndex = self index ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseTrackedIndex ]",
  45103. referencedClasses: [],
  45104. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  45105. }),
  45106. $globals.ASTPCNodeVisitor);
  45107. $core.addMethod(
  45108. $core.method({
  45109. selector: "isLastChild",
  45110. protocol: "*Compiler-Interpreter",
  45111. fn: function (){
  45112. var self=this,$self=this;
  45113. return $core.withContext(function($ctx1) {
  45114. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  45115. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  45116. },
  45117. args: [],
  45118. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  45119. referencedClasses: [],
  45120. messageSends: ["=", "last", "dagChildren", "parent"]
  45121. }),
  45122. $globals.ASTNode);
  45123. $core.addMethod(
  45124. $core.method({
  45125. selector: "isSteppingNode",
  45126. protocol: "*Compiler-Interpreter",
  45127. fn: function (){
  45128. var self=this,$self=this;
  45129. return false;
  45130. },
  45131. args: [],
  45132. source: "isSteppingNode\x0a\x09^ false",
  45133. referencedClasses: [],
  45134. messageSends: []
  45135. }),
  45136. $globals.ASTNode);
  45137. $core.addMethod(
  45138. $core.method({
  45139. selector: "nextSiblingNode:",
  45140. protocol: "*Compiler-Interpreter",
  45141. fn: function (aNode){
  45142. var self=this,$self=this;
  45143. return $core.withContext(function($ctx1) {
  45144. var $1;
  45145. var $early={};
  45146. try {
  45147. $1=$self._dagChildren();
  45148. $ctx1.sendIdx["dagChildren"]=1;
  45149. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  45150. throw $early=[nil];
  45151. }));
  45152. }
  45153. catch(e) {if(e===$early)return e[0]; throw e}
  45154. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  45155. },
  45156. args: ["aNode"],
  45157. source: "nextSiblingNode: aNode\x0a\x09\x22Answer the next node after aNode or nil\x22\x0a\x09\x0a\x09^ self dagChildren \x0a\x09\x09at: (self dagChildren indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ nil ]",
  45158. referencedClasses: [],
  45159. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  45160. }),
  45161. $globals.ASTNode);
  45162. $core.addMethod(
  45163. $core.method({
  45164. selector: "isSteppingNode",
  45165. protocol: "*Compiler-Interpreter",
  45166. fn: function (){
  45167. var self=this,$self=this;
  45168. return true;
  45169. },
  45170. args: [],
  45171. source: "isSteppingNode\x0a\x09^ true",
  45172. referencedClasses: [],
  45173. messageSends: []
  45174. }),
  45175. $globals.AssignmentNode);
  45176. $core.addMethod(
  45177. $core.method({
  45178. selector: "isSteppingNode",
  45179. protocol: "*Compiler-Interpreter",
  45180. fn: function (){
  45181. var self=this,$self=this;
  45182. return true;
  45183. },
  45184. args: [],
  45185. source: "isSteppingNode\x0a\x09^ true",
  45186. referencedClasses: [],
  45187. messageSends: []
  45188. }),
  45189. $globals.BlockNode);
  45190. $core.addMethod(
  45191. $core.method({
  45192. selector: "nextSiblingNode:",
  45193. protocol: "*Compiler-Interpreter",
  45194. fn: function (aNode){
  45195. var self=this,$self=this;
  45196. return nil;
  45197. },
  45198. args: ["aNode"],
  45199. source: "nextSiblingNode: aNode\x0a\x09\x22Answer nil as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09\x22In fact, this should not have been called, ever. IMO. -- herby\x22\x0a\x09\x0a\x09^ nil",
  45200. referencedClasses: [],
  45201. messageSends: []
  45202. }),
  45203. $globals.BlockNode);
  45204. $core.addMethod(
  45205. $core.method({
  45206. selector: "isSteppingNode",
  45207. protocol: "*Compiler-Interpreter",
  45208. fn: function (){
  45209. var self=this,$self=this;
  45210. return true;
  45211. },
  45212. args: [],
  45213. source: "isSteppingNode\x0a\x09^ true",
  45214. referencedClasses: [],
  45215. messageSends: []
  45216. }),
  45217. $globals.DynamicArrayNode);
  45218. $core.addMethod(
  45219. $core.method({
  45220. selector: "isSteppingNode",
  45221. protocol: "*Compiler-Interpreter",
  45222. fn: function (){
  45223. var self=this,$self=this;
  45224. return true;
  45225. },
  45226. args: [],
  45227. source: "isSteppingNode\x0a\x09^ true",
  45228. referencedClasses: [],
  45229. messageSends: []
  45230. }),
  45231. $globals.DynamicDictionaryNode);
  45232. $core.addMethod(
  45233. $core.method({
  45234. selector: "isSteppingNode",
  45235. protocol: "*Compiler-Interpreter",
  45236. fn: function (){
  45237. var self=this,$self=this;
  45238. return true;
  45239. },
  45240. args: [],
  45241. source: "isSteppingNode\x0a\x09^ true",
  45242. referencedClasses: [],
  45243. messageSends: []
  45244. }),
  45245. $globals.JSStatementNode);
  45246. $core.addMethod(
  45247. $core.method({
  45248. selector: "isCascadeSendNode",
  45249. protocol: "*Compiler-Interpreter",
  45250. fn: function (){
  45251. var self=this,$self=this;
  45252. return $core.withContext(function($ctx1) {
  45253. return $recv($self._parent())._isCascadeNode();
  45254. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  45255. },
  45256. args: [],
  45257. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  45258. referencedClasses: [],
  45259. messageSends: ["isCascadeNode", "parent"]
  45260. }),
  45261. $globals.SendNode);
  45262. $core.addMethod(
  45263. $core.method({
  45264. selector: "isSteppingNode",
  45265. protocol: "*Compiler-Interpreter",
  45266. fn: function (){
  45267. var self=this,$self=this;
  45268. return true;
  45269. },
  45270. args: [],
  45271. source: "isSteppingNode\x0a\x09^ true",
  45272. referencedClasses: [],
  45273. messageSends: []
  45274. }),
  45275. $globals.SendNode);
  45276. });
  45277. define('amber/lang',[
  45278. './deploy',
  45279. './compatibility', // pre-fetch, dep of ./boot
  45280. './boot', // pre-fetch, dep of ./helpers
  45281. './helpers', // pre-fetch, dep of ./deploy
  45282. './parser',
  45283. // --- packages for the Amber reflection begin here ---
  45284. 'amber_core/Platform-ImportExport',
  45285. 'amber_core/Compiler-Core',
  45286. 'amber_core/Compiler-AST',
  45287. 'amber_core/Compiler-Semantic',
  45288. 'amber_core/Compiler-IR',
  45289. 'amber_core/Compiler-Inlining',
  45290. 'amber_core/Compiler-Interpreter'
  45291. // --- packages for the Amber reflection end here ---
  45292. ], function (amber) {
  45293. return amber;
  45294. });
  45295. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  45296. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  45297. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  45298. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  45299. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  45300. $core.addPackage("Platform-DOM");
  45301. $core.packages["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  45302. $core.packages["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45303. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  45304. $core.addMethod(
  45305. $core.method({
  45306. selector: "isDomNode:",
  45307. protocol: "testing",
  45308. fn: function (anObject){
  45309. var self=this,$self=this;
  45310. return $core.withContext(function($ctx1) {
  45311. return anObject.nodeType > 0 &&
  45312. Object.prototype.toString.call(anObject) !== "[object Object]";
  45313. return self;
  45314. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  45315. },
  45316. args: ["anObject"],
  45317. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  45318. referencedClasses: [],
  45319. messageSends: []
  45320. }),
  45321. $globals.PlatformDom.a$cls);
  45322. $core.addMethod(
  45323. $core.method({
  45324. selector: "isFeasible",
  45325. protocol: "testing",
  45326. fn: function (){
  45327. var self=this,$self=this;
  45328. return $core.withContext(function($ctx1) {
  45329. if (typeof document === "undefined") return false;
  45330. try {
  45331. var d = document.createElement("div"),
  45332. f = document.createDocumentFragment(),
  45333. t = document.createTextNode("Hello, Amber!");
  45334. f.appendChild(t);
  45335. d.insertBefore(f, null);
  45336. return d.innerHTML === "Hello, Amber!";
  45337. } catch (e) {
  45338. return false;
  45339. };
  45340. return self;
  45341. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  45342. },
  45343. args: [],
  45344. source: "isFeasible\x0a<inlineJS: '\x0a if (typeof document === \x22undefined\x22) return false;\x0a try {\x0a var d = document.createElement(\x22div\x22),\x0a\x09 f = document.createDocumentFragment(),\x0a\x09 t = document.createTextNode(\x22Hello, Amber!\x22);\x0a\x09f.appendChild(t);\x0a\x09d.insertBefore(f, null);\x0a\x09return d.innerHTML === \x22Hello, Amber!\x22;\x0a } catch (e) {\x0a return false;\x0a }\x0a'>",
  45345. referencedClasses: [],
  45346. messageSends: []
  45347. }),
  45348. $globals.PlatformDom.a$cls);
  45349. $core.addMethod(
  45350. $core.method({
  45351. selector: "newCustomEvent:detail:",
  45352. protocol: "creation",
  45353. fn: function (aString,anObject){
  45354. var self=this,$self=this;
  45355. return $core.withContext(function($ctx1) {
  45356. return new CustomEvent(aString, {detail: anObject});
  45357. return self;
  45358. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  45359. },
  45360. args: ["aString", "anObject"],
  45361. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  45362. referencedClasses: [],
  45363. messageSends: []
  45364. }),
  45365. $globals.PlatformDom.a$cls);
  45366. $core.addMethod(
  45367. $core.method({
  45368. selector: "toArray:",
  45369. protocol: "converting",
  45370. fn: function (aDomList){
  45371. var self=this,$self=this;
  45372. return $core.withContext(function($ctx1) {
  45373. return Array.prototype.slice.call(aDomList);
  45374. return self;
  45375. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  45376. },
  45377. args: ["aDomList"],
  45378. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  45379. referencedClasses: [],
  45380. messageSends: []
  45381. }),
  45382. $globals.PlatformDom.a$cls);
  45383. $core.addMethod(
  45384. $core.method({
  45385. selector: "asDomNode",
  45386. protocol: "*Platform-DOM",
  45387. fn: function (){
  45388. var self=this,$self=this;
  45389. return $core.withContext(function($ctx1) {
  45390. return $recv(document)._createTextNode_($self._asString());
  45391. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  45392. },
  45393. args: [],
  45394. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  45395. referencedClasses: [],
  45396. messageSends: ["createTextNode:", "asString"]
  45397. }),
  45398. $globals.CharacterArray);
  45399. $core.addMethod(
  45400. $core.method({
  45401. selector: "asDomNode",
  45402. protocol: "*Platform-DOM",
  45403. fn: function (){
  45404. var self=this,$self=this;
  45405. var fragment;
  45406. return $core.withContext(function($ctx1) {
  45407. fragment=$recv(document)._createDocumentFragment();
  45408. $self._do_((function(each){
  45409. return $core.withContext(function($ctx2) {
  45410. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  45411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45412. }));
  45413. return fragment;
  45414. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  45415. },
  45416. args: [],
  45417. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  45418. referencedClasses: [],
  45419. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  45420. }),
  45421. $globals.Collection);
  45422. $core.addMethod(
  45423. $core.method({
  45424. selector: "asDomNode",
  45425. protocol: "*Platform-DOM",
  45426. fn: function (){
  45427. var self=this,$self=this;
  45428. return $core.withContext(function($ctx1) {
  45429. var $1,$2;
  45430. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  45431. if($core.assert($1)){
  45432. return $self["@jsObject"];
  45433. } else {
  45434. $2=(
  45435. $ctx1.supercall = true,
  45436. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  45437. $ctx1.supercall = false;
  45438. return $2;
  45439. }
  45440. return self;
  45441. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  45442. },
  45443. args: [],
  45444. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  45445. referencedClasses: ["PlatformDom"],
  45446. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  45447. }),
  45448. $globals.JSObjectProxy);
  45449. $core.addMethod(
  45450. $core.method({
  45451. selector: "htmlTextContent",
  45452. protocol: "*Platform-DOM",
  45453. fn: function (){
  45454. var self=this,$self=this;
  45455. return $core.withContext(function($ctx1) {
  45456. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  45457. return self;
  45458. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  45459. },
  45460. args: [],
  45461. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  45462. referencedClasses: [],
  45463. messageSends: []
  45464. }),
  45465. $globals.String);
  45466. });
  45467. define('amber_core/SUnit',["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  45468. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  45469. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  45470. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  45471. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  45472. $core.addPackage("SUnit");
  45473. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  45474. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45475. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  45476. $globals.ResultAnnouncement.comment="I get signaled when a `TestCase` has been run.\x0a\x0aMy instances hold the result (instance of `TestResult`) of the test run.";
  45477. $core.addMethod(
  45478. $core.method({
  45479. selector: "result",
  45480. protocol: "accessing",
  45481. fn: function (){
  45482. var self=this,$self=this;
  45483. return $self["@result"];
  45484. },
  45485. args: [],
  45486. source: "result\x0a\x09^ result",
  45487. referencedClasses: [],
  45488. messageSends: []
  45489. }),
  45490. $globals.ResultAnnouncement);
  45491. $core.addMethod(
  45492. $core.method({
  45493. selector: "result:",
  45494. protocol: "accessing",
  45495. fn: function (aTestResult){
  45496. var self=this,$self=this;
  45497. $self["@result"]=aTestResult;
  45498. return self;
  45499. },
  45500. args: ["aTestResult"],
  45501. source: "result: aTestResult\x0a\x09result := aTestResult",
  45502. referencedClasses: [],
  45503. messageSends: []
  45504. }),
  45505. $globals.ResultAnnouncement);
  45506. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  45507. $globals.TestCase.comment="I am an implementation of the command pattern to run a test.\x0a\x0a## API\x0a\x0aMy instances are created with the class method `#selector:`,\x0apassing the symbol that names the method to be executed when the test case runs.\x0a\x0aWhen you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test.\x0aAs that method develops and more `#test...` methods are added, you will find yourself refactoring temps\x0ainto instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.\x0aAs required, override `#tearDown` to nil references, release objects and deallocate.";
  45508. $core.addMethod(
  45509. $core.method({
  45510. selector: "assert:",
  45511. protocol: "testing",
  45512. fn: function (aBoolean){
  45513. var self=this,$self=this;
  45514. return $core.withContext(function($ctx1) {
  45515. $self._assert_description_(aBoolean,"Assertion failed");
  45516. return self;
  45517. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  45518. },
  45519. args: ["aBoolean"],
  45520. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  45521. referencedClasses: [],
  45522. messageSends: ["assert:description:"]
  45523. }),
  45524. $globals.TestCase);
  45525. $core.addMethod(
  45526. $core.method({
  45527. selector: "assert:description:",
  45528. protocol: "testing",
  45529. fn: function (aBoolean,aString){
  45530. var self=this,$self=this;
  45531. return $core.withContext(function($ctx1) {
  45532. if(!$core.assert(aBoolean)){
  45533. $self._signalFailure_(aString);
  45534. }
  45535. return self;
  45536. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  45537. },
  45538. args: ["aBoolean", "aString"],
  45539. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  45540. referencedClasses: [],
  45541. messageSends: ["ifFalse:", "signalFailure:"]
  45542. }),
  45543. $globals.TestCase);
  45544. $core.addMethod(
  45545. $core.method({
  45546. selector: "assert:equals:",
  45547. protocol: "testing",
  45548. fn: function (actual,expected){
  45549. var self=this,$self=this;
  45550. return $core.withContext(function($ctx1) {
  45551. var $1,$5,$4,$3,$2;
  45552. $1=$recv(actual).__eq(expected);
  45553. $5=$recv(expected)._printString();
  45554. $ctx1.sendIdx["printString"]=1;
  45555. $4="Expected: ".__comma($5);
  45556. $3=$recv($4).__comma(" but was: ");
  45557. $ctx1.sendIdx[","]=2;
  45558. $2=$recv($3).__comma($recv(actual)._printString());
  45559. $ctx1.sendIdx[","]=1;
  45560. return $self._assert_description_($1,$2);
  45561. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  45562. },
  45563. args: ["actual", "expected"],
  45564. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  45565. referencedClasses: [],
  45566. messageSends: ["assert:description:", "=", ",", "printString"]
  45567. }),
  45568. $globals.TestCase);
  45569. $core.addMethod(
  45570. $core.method({
  45571. selector: "async:",
  45572. protocol: "async",
  45573. fn: function (aBlock){
  45574. var self=this,$self=this;
  45575. var c;
  45576. return $core.withContext(function($ctx1) {
  45577. var $1;
  45578. $self._errorIfNotAsync_("#async");
  45579. c=$self["@context"];
  45580. return (function(){
  45581. return $core.withContext(function($ctx2) {
  45582. $1=$self._isAsync();
  45583. if($core.assert($1)){
  45584. return $recv(c)._execute_(aBlock);
  45585. }
  45586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45587. });
  45588. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  45589. },
  45590. args: ["aBlock"],
  45591. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  45592. referencedClasses: [],
  45593. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  45594. }),
  45595. $globals.TestCase);
  45596. $core.addMethod(
  45597. $core.method({
  45598. selector: "context:",
  45599. protocol: "accessing",
  45600. fn: function (aRunningTestContext){
  45601. var self=this,$self=this;
  45602. $self["@context"]=aRunningTestContext;
  45603. return self;
  45604. },
  45605. args: ["aRunningTestContext"],
  45606. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  45607. referencedClasses: [],
  45608. messageSends: []
  45609. }),
  45610. $globals.TestCase);
  45611. $core.addMethod(
  45612. $core.method({
  45613. selector: "deny:",
  45614. protocol: "testing",
  45615. fn: function (aBoolean){
  45616. var self=this,$self=this;
  45617. return $core.withContext(function($ctx1) {
  45618. $self._assert_($recv(aBoolean)._not());
  45619. return self;
  45620. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  45621. },
  45622. args: ["aBoolean"],
  45623. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  45624. referencedClasses: [],
  45625. messageSends: ["assert:", "not"]
  45626. }),
  45627. $globals.TestCase);
  45628. $core.addMethod(
  45629. $core.method({
  45630. selector: "errorIfNotAsync:",
  45631. protocol: "error handling",
  45632. fn: function (aString){
  45633. var self=this,$self=this;
  45634. return $core.withContext(function($ctx1) {
  45635. var $1;
  45636. $1=$self._isAsync();
  45637. if(!$core.assert($1)){
  45638. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  45639. }
  45640. return self;
  45641. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  45642. },
  45643. args: ["aString"],
  45644. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  45645. referencedClasses: [],
  45646. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  45647. }),
  45648. $globals.TestCase);
  45649. $core.addMethod(
  45650. $core.method({
  45651. selector: "finished",
  45652. protocol: "async",
  45653. fn: function (){
  45654. var self=this,$self=this;
  45655. return $core.withContext(function($ctx1) {
  45656. $self._errorIfNotAsync_("#finished");
  45657. $self["@asyncTimeout"]=nil;
  45658. return self;
  45659. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  45660. },
  45661. args: [],
  45662. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  45663. referencedClasses: [],
  45664. messageSends: ["errorIfNotAsync:"]
  45665. }),
  45666. $globals.TestCase);
  45667. $core.addMethod(
  45668. $core.method({
  45669. selector: "isAsync",
  45670. protocol: "testing",
  45671. fn: function (){
  45672. var self=this,$self=this;
  45673. return $core.withContext(function($ctx1) {
  45674. return $recv($self["@asyncTimeout"])._notNil();
  45675. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  45676. },
  45677. args: [],
  45678. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  45679. referencedClasses: [],
  45680. messageSends: ["notNil"]
  45681. }),
  45682. $globals.TestCase);
  45683. $core.addMethod(
  45684. $core.method({
  45685. selector: "performTest",
  45686. protocol: "running",
  45687. fn: function (){
  45688. var self=this,$self=this;
  45689. return $core.withContext(function($ctx1) {
  45690. $self["@asyncTimeout"]=nil;
  45691. $self._perform_($self._selector());
  45692. return self;
  45693. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  45694. },
  45695. args: [],
  45696. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  45697. referencedClasses: [],
  45698. messageSends: ["perform:", "selector"]
  45699. }),
  45700. $globals.TestCase);
  45701. $core.addMethod(
  45702. $core.method({
  45703. selector: "runCase",
  45704. protocol: "running",
  45705. fn: function (){
  45706. var self=this,$self=this;
  45707. return $core.withContext(function($ctx1) {
  45708. $recv($recv($globals.TestContext)._testCase_(self))._start();
  45709. return self;
  45710. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  45711. },
  45712. args: [],
  45713. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  45714. referencedClasses: ["TestContext"],
  45715. messageSends: ["start", "testCase:"]
  45716. }),
  45717. $globals.TestCase);
  45718. $core.addMethod(
  45719. $core.method({
  45720. selector: "selector",
  45721. protocol: "accessing",
  45722. fn: function (){
  45723. var self=this,$self=this;
  45724. return $self["@testSelector"];
  45725. },
  45726. args: [],
  45727. source: "selector\x0a\x09^ testSelector",
  45728. referencedClasses: [],
  45729. messageSends: []
  45730. }),
  45731. $globals.TestCase);
  45732. $core.addMethod(
  45733. $core.method({
  45734. selector: "setTestSelector:",
  45735. protocol: "accessing",
  45736. fn: function (aSelector){
  45737. var self=this,$self=this;
  45738. $self["@testSelector"]=aSelector;
  45739. return self;
  45740. },
  45741. args: ["aSelector"],
  45742. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  45743. referencedClasses: [],
  45744. messageSends: []
  45745. }),
  45746. $globals.TestCase);
  45747. $core.addMethod(
  45748. $core.method({
  45749. selector: "setUp",
  45750. protocol: "running",
  45751. fn: function (){
  45752. var self=this,$self=this;
  45753. return self;
  45754. },
  45755. args: [],
  45756. source: "setUp",
  45757. referencedClasses: [],
  45758. messageSends: []
  45759. }),
  45760. $globals.TestCase);
  45761. $core.addMethod(
  45762. $core.method({
  45763. selector: "should:",
  45764. protocol: "testing",
  45765. fn: function (aBlock){
  45766. var self=this,$self=this;
  45767. return $core.withContext(function($ctx1) {
  45768. $self._assert_($recv(aBlock)._value());
  45769. return self;
  45770. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  45771. },
  45772. args: ["aBlock"],
  45773. source: "should: aBlock\x0a\x09self assert: aBlock value",
  45774. referencedClasses: [],
  45775. messageSends: ["assert:", "value"]
  45776. }),
  45777. $globals.TestCase);
  45778. $core.addMethod(
  45779. $core.method({
  45780. selector: "should:raise:",
  45781. protocol: "testing",
  45782. fn: function (aBlock,anExceptionClass){
  45783. var self=this,$self=this;
  45784. return $core.withContext(function($ctx1) {
  45785. $self._assert_($recv((function(){
  45786. return $core.withContext(function($ctx2) {
  45787. $recv(aBlock)._value();
  45788. return false;
  45789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45790. }))._on_do_(anExceptionClass,(function(ex){
  45791. return true;
  45792. })));
  45793. return self;
  45794. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45795. },
  45796. args: ["aBlock", "anExceptionClass"],
  45797. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  45798. referencedClasses: [],
  45799. messageSends: ["assert:", "on:do:", "value"]
  45800. }),
  45801. $globals.TestCase);
  45802. $core.addMethod(
  45803. $core.method({
  45804. selector: "shouldnt:raise:",
  45805. protocol: "testing",
  45806. fn: function (aBlock,anExceptionClass){
  45807. var self=this,$self=this;
  45808. return $core.withContext(function($ctx1) {
  45809. $self._assert_($recv((function(){
  45810. return $core.withContext(function($ctx2) {
  45811. $recv(aBlock)._value();
  45812. return true;
  45813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45814. }))._on_do_(anExceptionClass,(function(ex){
  45815. return false;
  45816. })));
  45817. return self;
  45818. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45819. },
  45820. args: ["aBlock", "anExceptionClass"],
  45821. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  45822. referencedClasses: [],
  45823. messageSends: ["assert:", "on:do:", "value"]
  45824. }),
  45825. $globals.TestCase);
  45826. $core.addMethod(
  45827. $core.method({
  45828. selector: "signalFailure:",
  45829. protocol: "private",
  45830. fn: function (aString){
  45831. var self=this,$self=this;
  45832. return $core.withContext(function($ctx1) {
  45833. var $1;
  45834. $1=$recv($globals.TestFailure)._new();
  45835. $recv($1)._messageText_(aString);
  45836. $recv($1)._signal();
  45837. return self;
  45838. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  45839. },
  45840. args: ["aString"],
  45841. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  45842. referencedClasses: ["TestFailure"],
  45843. messageSends: ["messageText:", "new", "signal"]
  45844. }),
  45845. $globals.TestCase);
  45846. $core.addMethod(
  45847. $core.method({
  45848. selector: "tearDown",
  45849. protocol: "running",
  45850. fn: function (){
  45851. var self=this,$self=this;
  45852. return self;
  45853. },
  45854. args: [],
  45855. source: "tearDown",
  45856. referencedClasses: [],
  45857. messageSends: []
  45858. }),
  45859. $globals.TestCase);
  45860. $core.addMethod(
  45861. $core.method({
  45862. selector: "timeout:",
  45863. protocol: "async",
  45864. fn: function (aNumber){
  45865. var self=this,$self=this;
  45866. return $core.withContext(function($ctx1) {
  45867. var $1,$receiver;
  45868. $1=$self["@asyncTimeout"];
  45869. if(($receiver = $1) == null || $receiver.a$nil){
  45870. $1;
  45871. } else {
  45872. $recv($self["@asyncTimeout"])._clearTimeout();
  45873. }
  45874. $self["@asyncTimeout"]=(0);
  45875. $self["@asyncTimeout"]=$recv($self._async_((function(){
  45876. return $core.withContext(function($ctx2) {
  45877. return $self._assert_description_(false,"SUnit grace time exhausted");
  45878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45879. })))._valueWithTimeout_(aNumber);
  45880. return self;
  45881. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  45882. },
  45883. args: ["aNumber"],
  45884. source: "timeout: aNumber\x0a\x09\x22Set a grace time timeout in milliseconds to run the test asynchronously\x22\x0a\x09\x0a\x09asyncTimeout ifNotNil: [ asyncTimeout clearTimeout ].\x0a\x09\x0a\x09\x22to allow #async: message send without throwing an error\x22\x0a\x09asyncTimeout := 0.\x0a\x09\x0a\x09asyncTimeout := (self async: [\x0a\x09\x09self assert: false description: 'SUnit grace time exhausted' ])\x0a\x09\x09\x09valueWithTimeout: aNumber",
  45885. referencedClasses: [],
  45886. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  45887. }),
  45888. $globals.TestCase);
  45889. $core.addMethod(
  45890. $core.method({
  45891. selector: "allTestSelectors",
  45892. protocol: "accessing",
  45893. fn: function (){
  45894. var self=this,$self=this;
  45895. var selectors;
  45896. return $core.withContext(function($ctx1) {
  45897. var $1;
  45898. selectors=$self._testSelectors();
  45899. $1=$self._shouldInheritSelectors();
  45900. if($core.assert($1)){
  45901. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  45902. }
  45903. return selectors;
  45904. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  45905. },
  45906. args: [],
  45907. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  45908. referencedClasses: [],
  45909. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  45910. }),
  45911. $globals.TestCase.a$cls);
  45912. $core.addMethod(
  45913. $core.method({
  45914. selector: "buildSuite",
  45915. protocol: "accessing",
  45916. fn: function (){
  45917. var self=this,$self=this;
  45918. return $core.withContext(function($ctx1) {
  45919. return $recv($self._allTestSelectors())._collect_((function(each){
  45920. return $core.withContext(function($ctx2) {
  45921. return $self._selector_(each);
  45922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45923. }));
  45924. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  45925. },
  45926. args: [],
  45927. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  45928. referencedClasses: [],
  45929. messageSends: ["collect:", "allTestSelectors", "selector:"]
  45930. }),
  45931. $globals.TestCase.a$cls);
  45932. $core.addMethod(
  45933. $core.method({
  45934. selector: "classTag",
  45935. protocol: "accessing",
  45936. fn: function (){
  45937. var self=this,$self=this;
  45938. return "test";
  45939. },
  45940. args: [],
  45941. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'test'",
  45942. referencedClasses: [],
  45943. messageSends: []
  45944. }),
  45945. $globals.TestCase.a$cls);
  45946. $core.addMethod(
  45947. $core.method({
  45948. selector: "isAbstract",
  45949. protocol: "testing",
  45950. fn: function (){
  45951. var self=this,$self=this;
  45952. return $core.withContext(function($ctx1) {
  45953. return $recv($self._name()).__eq("TestCase");
  45954. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  45955. },
  45956. args: [],
  45957. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  45958. referencedClasses: [],
  45959. messageSends: ["=", "name"]
  45960. }),
  45961. $globals.TestCase.a$cls);
  45962. $core.addMethod(
  45963. $core.method({
  45964. selector: "isTestClass",
  45965. protocol: "testing",
  45966. fn: function (){
  45967. var self=this,$self=this;
  45968. return $core.withContext(function($ctx1) {
  45969. return $recv($self._isAbstract())._not();
  45970. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  45971. },
  45972. args: [],
  45973. source: "isTestClass\x0a\x09^ self isAbstract not",
  45974. referencedClasses: [],
  45975. messageSends: ["not", "isAbstract"]
  45976. }),
  45977. $globals.TestCase.a$cls);
  45978. $core.addMethod(
  45979. $core.method({
  45980. selector: "lookupHierarchyRoot",
  45981. protocol: "accessing",
  45982. fn: function (){
  45983. var self=this,$self=this;
  45984. return $globals.TestCase;
  45985. },
  45986. args: [],
  45987. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  45988. referencedClasses: ["TestCase"],
  45989. messageSends: []
  45990. }),
  45991. $globals.TestCase.a$cls);
  45992. $core.addMethod(
  45993. $core.method({
  45994. selector: "selector:",
  45995. protocol: "accessing",
  45996. fn: function (aSelector){
  45997. var self=this,$self=this;
  45998. return $core.withContext(function($ctx1) {
  45999. var $1;
  46000. $1=$self._new();
  46001. $recv($1)._setTestSelector_(aSelector);
  46002. return $recv($1)._yourself();
  46003. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  46004. },
  46005. args: ["aSelector"],
  46006. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  46007. referencedClasses: [],
  46008. messageSends: ["setTestSelector:", "new", "yourself"]
  46009. }),
  46010. $globals.TestCase.a$cls);
  46011. $core.addMethod(
  46012. $core.method({
  46013. selector: "shouldInheritSelectors",
  46014. protocol: "testing",
  46015. fn: function (){
  46016. var self=this,$self=this;
  46017. return $core.withContext(function($ctx1) {
  46018. return $self.__tild_eq($self._lookupHierarchyRoot());
  46019. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  46020. },
  46021. args: [],
  46022. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  46023. referencedClasses: [],
  46024. messageSends: ["~=", "lookupHierarchyRoot"]
  46025. }),
  46026. $globals.TestCase.a$cls);
  46027. $core.addMethod(
  46028. $core.method({
  46029. selector: "testSelectors",
  46030. protocol: "accessing",
  46031. fn: function (){
  46032. var self=this,$self=this;
  46033. return $core.withContext(function($ctx1) {
  46034. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  46035. return $core.withContext(function($ctx2) {
  46036. return $recv(each)._match_("^test");
  46037. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46038. }));
  46039. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  46040. },
  46041. args: [],
  46042. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  46043. referencedClasses: [],
  46044. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  46045. }),
  46046. $globals.TestCase.a$cls);
  46047. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  46048. $globals.TestContext.comment="I govern running a particular test case.\x0a\x0aMy main added value is `#execute:` method which runs a block as a part of test case (restores context, nilling it afterwards, cleaning/calling `#tearDown` as appropriate for sync/async scenario).";
  46049. $core.addMethod(
  46050. $core.method({
  46051. selector: "execute:",
  46052. protocol: "running",
  46053. fn: function (aBlock){
  46054. var self=this,$self=this;
  46055. var failed;
  46056. return $core.withContext(function($ctx1) {
  46057. var $1,$2;
  46058. $recv($self["@testCase"])._context_(self);
  46059. $ctx1.sendIdx["context:"]=1;
  46060. $recv((function(){
  46061. return $core.withContext(function($ctx2) {
  46062. failed=true;
  46063. failed;
  46064. $recv(aBlock)._value();
  46065. failed=false;
  46066. return failed;
  46067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46068. }))._ensure_((function(){
  46069. return $core.withContext(function($ctx2) {
  46070. $recv($self["@testCase"])._context_(nil);
  46071. $1=$recv(failed)._and_((function(){
  46072. return $core.withContext(function($ctx3) {
  46073. return $recv($self["@testCase"])._isAsync();
  46074. $ctx3.sendIdx["isAsync"]=1;
  46075. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  46076. }));
  46077. if($core.assert($1)){
  46078. $recv($self["@testCase"])._finished();
  46079. }
  46080. $2=$recv($self["@testCase"])._isAsync();
  46081. if(!$core.assert($2)){
  46082. return $recv($self["@testCase"])._tearDown();
  46083. }
  46084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46085. }));
  46086. return self;
  46087. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  46088. },
  46089. args: ["aBlock"],
  46090. source: "execute: aBlock\x0a\x09| failed |\x0a\x09\x0a\x09testCase context: self.\x0a\x09[\x0a\x09\x09failed := true.\x0a\x09\x09aBlock value.\x0a\x09\x09failed := false\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase context: nil.\x0a\x09\x09\x09\x0a\x09\x09\x09(failed and: [ testCase isAsync ]) ifTrue: [\x0a\x09\x09\x09\x09testCase finished ].\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09testCase tearDown ] ]",
  46091. referencedClasses: [],
  46092. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  46093. }),
  46094. $globals.TestContext);
  46095. $core.addMethod(
  46096. $core.method({
  46097. selector: "start",
  46098. protocol: "running",
  46099. fn: function (){
  46100. var self=this,$self=this;
  46101. return $core.withContext(function($ctx1) {
  46102. $self._execute_((function(){
  46103. return $core.withContext(function($ctx2) {
  46104. $recv($self["@testCase"])._setUp();
  46105. return $recv($self["@testCase"])._performTest();
  46106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46107. }));
  46108. return self;
  46109. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  46110. },
  46111. args: [],
  46112. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  46113. referencedClasses: [],
  46114. messageSends: ["execute:", "setUp", "performTest"]
  46115. }),
  46116. $globals.TestContext);
  46117. $core.addMethod(
  46118. $core.method({
  46119. selector: "testCase:",
  46120. protocol: "accessing",
  46121. fn: function (aTestCase){
  46122. var self=this,$self=this;
  46123. $self["@testCase"]=aTestCase;
  46124. return self;
  46125. },
  46126. args: ["aTestCase"],
  46127. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  46128. referencedClasses: [],
  46129. messageSends: []
  46130. }),
  46131. $globals.TestContext);
  46132. $core.addMethod(
  46133. $core.method({
  46134. selector: "testCase:",
  46135. protocol: "instance creation",
  46136. fn: function (aTestCase){
  46137. var self=this,$self=this;
  46138. return $core.withContext(function($ctx1) {
  46139. var $1;
  46140. $1=$self._new();
  46141. $recv($1)._testCase_(aTestCase);
  46142. return $recv($1)._yourself();
  46143. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  46144. },
  46145. args: ["aTestCase"],
  46146. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  46147. referencedClasses: [],
  46148. messageSends: ["testCase:", "new", "yourself"]
  46149. }),
  46150. $globals.TestContext.a$cls);
  46151. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  46152. $globals.ReportingTestContext.comment="I add `TestResult` reporting to `TestContext`.\x0a\x0aErrors are caught and save into a `TestResult`,\x0aWhen test case is finished (which can be later for async tests), a callback block is executed; this is used by a `TestSuiteRunner`.";
  46153. $core.addMethod(
  46154. $core.method({
  46155. selector: "execute:",
  46156. protocol: "running",
  46157. fn: function (aBlock){
  46158. var self=this,$self=this;
  46159. return $core.withContext(function($ctx1) {
  46160. var $1;
  46161. $recv((function(){
  46162. return $core.withContext(function($ctx2) {
  46163. return $self._withErrorReporting_((function(){
  46164. return $core.withContext(function($ctx3) {
  46165. return (
  46166. $ctx3.supercall = true,
  46167. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  46168. $ctx3.supercall = false;
  46169. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46170. }));
  46171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46172. }))._ensure_((function(){
  46173. return $core.withContext(function($ctx2) {
  46174. $1=$recv($self["@testCase"])._isAsync();
  46175. if(!$core.assert($1)){
  46176. $recv($self["@result"])._increaseRuns();
  46177. return $recv($self["@finished"])._value();
  46178. }
  46179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46180. }));
  46181. return self;
  46182. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  46183. },
  46184. args: ["aBlock"],
  46185. source: "execute: aBlock\x0a\x09[\x0a\x09\x09self withErrorReporting: [ super execute: aBlock ]\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09result increaseRuns. finished value ] ]",
  46186. referencedClasses: [],
  46187. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  46188. }),
  46189. $globals.ReportingTestContext);
  46190. $core.addMethod(
  46191. $core.method({
  46192. selector: "finished:",
  46193. protocol: "accessing",
  46194. fn: function (aBlock){
  46195. var self=this,$self=this;
  46196. $self["@finished"]=aBlock;
  46197. return self;
  46198. },
  46199. args: ["aBlock"],
  46200. source: "finished: aBlock\x0a\x09finished := aBlock",
  46201. referencedClasses: [],
  46202. messageSends: []
  46203. }),
  46204. $globals.ReportingTestContext);
  46205. $core.addMethod(
  46206. $core.method({
  46207. selector: "result:",
  46208. protocol: "accessing",
  46209. fn: function (aTestResult){
  46210. var self=this,$self=this;
  46211. $self["@result"]=aTestResult;
  46212. return self;
  46213. },
  46214. args: ["aTestResult"],
  46215. source: "result: aTestResult\x0a\x09result := aTestResult",
  46216. referencedClasses: [],
  46217. messageSends: []
  46218. }),
  46219. $globals.ReportingTestContext);
  46220. $core.addMethod(
  46221. $core.method({
  46222. selector: "withErrorReporting:",
  46223. protocol: "private",
  46224. fn: function (aBlock){
  46225. var self=this,$self=this;
  46226. return $core.withContext(function($ctx1) {
  46227. $recv((function(){
  46228. return $core.withContext(function($ctx2) {
  46229. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  46230. return $core.withContext(function($ctx3) {
  46231. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  46232. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  46233. }));
  46234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46235. }))._on_do_($globals.Error,(function(ex){
  46236. return $core.withContext(function($ctx2) {
  46237. return $recv($self["@result"])._addError_($self["@testCase"]);
  46238. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  46239. }));
  46240. $ctx1.sendIdx["on:do:"]=1;
  46241. return self;
  46242. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  46243. },
  46244. args: ["aBlock"],
  46245. source: "withErrorReporting: aBlock\x0a\x09[ aBlock\x0a\x09\x09on: TestFailure\x0a\x09\x09do: [ :ex | result addFailure: testCase ]\x0a\x09]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex | result addError: testCase ]",
  46246. referencedClasses: ["TestFailure", "Error"],
  46247. messageSends: ["on:do:", "addFailure:", "addError:"]
  46248. }),
  46249. $globals.ReportingTestContext);
  46250. $core.addMethod(
  46251. $core.method({
  46252. selector: "testCase:result:finished:",
  46253. protocol: "instance creation",
  46254. fn: function (aTestCase,aTestResult,aBlock){
  46255. var self=this,$self=this;
  46256. return $core.withContext(function($ctx1) {
  46257. var $1;
  46258. $1=(
  46259. $ctx1.supercall = true,
  46260. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  46261. $ctx1.supercall = false;
  46262. $recv($1)._result_(aTestResult);
  46263. $recv($1)._finished_(aBlock);
  46264. return $recv($1)._yourself();
  46265. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  46266. },
  46267. args: ["aTestCase", "aTestResult", "aBlock"],
  46268. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  46269. referencedClasses: [],
  46270. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  46271. }),
  46272. $globals.ReportingTestContext.a$cls);
  46273. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  46274. $globals.TestFailure.comment="I am raised when the boolean parameter of an #`assert:` or `#deny:` call is the opposite of what the assertion claims.\x0a\x0aThe test framework distinguishes between failures and errors.\x0aA failure is an event whose possibiity is explicitly anticipated and checked for in an assertion,\x0awhereas an error is an unanticipated problem like a division by 0 or an index out of bounds.";
  46275. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  46276. $globals.TestResult.comment="I implement the collecting parameter pattern for running a bunch of tests.\x0a\x0aMy instances hold tests that have run, sorted into the result categories of passed, failures and errors.\x0a\x0a`TestResult` is an interesting object to subclass or substitute. `#runCase:` is the external protocol you need to reproduce";
  46277. $core.addMethod(
  46278. $core.method({
  46279. selector: "addError:",
  46280. protocol: "accessing",
  46281. fn: function (anError){
  46282. var self=this,$self=this;
  46283. return $core.withContext(function($ctx1) {
  46284. $recv($self._errors())._add_(anError);
  46285. return self;
  46286. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  46287. },
  46288. args: ["anError"],
  46289. source: "addError: anError\x0a\x09self errors add: anError",
  46290. referencedClasses: [],
  46291. messageSends: ["add:", "errors"]
  46292. }),
  46293. $globals.TestResult);
  46294. $core.addMethod(
  46295. $core.method({
  46296. selector: "addFailure:",
  46297. protocol: "accessing",
  46298. fn: function (aFailure){
  46299. var self=this,$self=this;
  46300. return $core.withContext(function($ctx1) {
  46301. $recv($self._failures())._add_(aFailure);
  46302. return self;
  46303. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  46304. },
  46305. args: ["aFailure"],
  46306. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  46307. referencedClasses: [],
  46308. messageSends: ["add:", "failures"]
  46309. }),
  46310. $globals.TestResult);
  46311. $core.addMethod(
  46312. $core.method({
  46313. selector: "errors",
  46314. protocol: "accessing",
  46315. fn: function (){
  46316. var self=this,$self=this;
  46317. return $self["@errors"];
  46318. },
  46319. args: [],
  46320. source: "errors\x0a\x09^ errors",
  46321. referencedClasses: [],
  46322. messageSends: []
  46323. }),
  46324. $globals.TestResult);
  46325. $core.addMethod(
  46326. $core.method({
  46327. selector: "failures",
  46328. protocol: "accessing",
  46329. fn: function (){
  46330. var self=this,$self=this;
  46331. return $self["@failures"];
  46332. },
  46333. args: [],
  46334. source: "failures\x0a\x09^ failures",
  46335. referencedClasses: [],
  46336. messageSends: []
  46337. }),
  46338. $globals.TestResult);
  46339. $core.addMethod(
  46340. $core.method({
  46341. selector: "increaseRuns",
  46342. protocol: "accessing",
  46343. fn: function (){
  46344. var self=this,$self=this;
  46345. return $core.withContext(function($ctx1) {
  46346. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  46347. return self;
  46348. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  46349. },
  46350. args: [],
  46351. source: "increaseRuns\x0a\x09runs := runs + 1",
  46352. referencedClasses: [],
  46353. messageSends: ["+"]
  46354. }),
  46355. $globals.TestResult);
  46356. $core.addMethod(
  46357. $core.method({
  46358. selector: "initialize",
  46359. protocol: "initialization",
  46360. fn: function (){
  46361. var self=this,$self=this;
  46362. return $core.withContext(function($ctx1) {
  46363. (
  46364. $ctx1.supercall = true,
  46365. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46366. $ctx1.supercall = false;
  46367. $self["@timestamp"]=$recv($globals.Date)._now();
  46368. $self["@runs"]=(0);
  46369. $self["@errors"]=$recv($globals.Array)._new();
  46370. $ctx1.sendIdx["new"]=1;
  46371. $self["@failures"]=$recv($globals.Array)._new();
  46372. $self["@total"]=(0);
  46373. return self;
  46374. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  46375. },
  46376. args: [],
  46377. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  46378. referencedClasses: ["Date", "Array"],
  46379. messageSends: ["initialize", "now", "new"]
  46380. }),
  46381. $globals.TestResult);
  46382. $core.addMethod(
  46383. $core.method({
  46384. selector: "nextRunDo:",
  46385. protocol: "running",
  46386. fn: function (aBlock){
  46387. var self=this,$self=this;
  46388. return $core.withContext(function($ctx1) {
  46389. var $2,$1;
  46390. $2=$self._runs();
  46391. $ctx1.sendIdx["runs"]=1;
  46392. $1=$recv($2).__eq_eq($self._total());
  46393. if(!$core.assert($1)){
  46394. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  46395. }
  46396. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  46397. },
  46398. args: ["aBlock"],
  46399. source: "nextRunDo: aBlock\x0a\x09\x22Runs aBlock with index of next run or does nothing if no more runs\x22\x0a\x09^ self runs == self total\x0a\x09\x09ifFalse: [ aBlock value: self runs + 1 ]",
  46400. referencedClasses: [],
  46401. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  46402. }),
  46403. $globals.TestResult);
  46404. $core.addMethod(
  46405. $core.method({
  46406. selector: "runCase:",
  46407. protocol: "running",
  46408. fn: function (aTestCase){
  46409. var self=this,$self=this;
  46410. return $core.withContext(function($ctx1) {
  46411. $recv((function(){
  46412. return $core.withContext(function($ctx2) {
  46413. return $recv((function(){
  46414. return $core.withContext(function($ctx3) {
  46415. $self._increaseRuns();
  46416. return $recv(aTestCase)._runCase();
  46417. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46418. }))._on_do_($globals.TestFailure,(function(ex){
  46419. return $core.withContext(function($ctx3) {
  46420. return $self._addFailure_(aTestCase);
  46421. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  46422. }));
  46423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46424. }))._on_do_($globals.Error,(function(ex){
  46425. return $core.withContext(function($ctx2) {
  46426. return $self._addError_(aTestCase);
  46427. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  46428. }));
  46429. $ctx1.sendIdx["on:do:"]=1;
  46430. return self;
  46431. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  46432. },
  46433. args: ["aTestCase"],
  46434. source: "runCase: aTestCase\x0a\x09[ [ self increaseRuns.\x0a\x09\x09aTestCase runCase ]\x0a\x09on: TestFailure do: [ :ex | self addFailure: aTestCase ]]\x0a\x09on: Error do: [ :ex | self addError: aTestCase ]",
  46435. referencedClasses: ["TestFailure", "Error"],
  46436. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  46437. }),
  46438. $globals.TestResult);
  46439. $core.addMethod(
  46440. $core.method({
  46441. selector: "runs",
  46442. protocol: "accessing",
  46443. fn: function (){
  46444. var self=this,$self=this;
  46445. return $self["@runs"];
  46446. },
  46447. args: [],
  46448. source: "runs\x0a\x09^ runs",
  46449. referencedClasses: [],
  46450. messageSends: []
  46451. }),
  46452. $globals.TestResult);
  46453. $core.addMethod(
  46454. $core.method({
  46455. selector: "status",
  46456. protocol: "accessing",
  46457. fn: function (){
  46458. var self=this,$self=this;
  46459. return $core.withContext(function($ctx1) {
  46460. var $1;
  46461. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  46462. return "error";
  46463. }),(function(){
  46464. return $core.withContext(function($ctx2) {
  46465. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  46466. return "failure";
  46467. }),(function(){
  46468. return "success";
  46469. }));
  46470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46471. }));
  46472. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  46473. return $1;
  46474. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  46475. },
  46476. args: [],
  46477. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  46478. referencedClasses: [],
  46479. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  46480. }),
  46481. $globals.TestResult);
  46482. $core.addMethod(
  46483. $core.method({
  46484. selector: "timestamp",
  46485. protocol: "accessing",
  46486. fn: function (){
  46487. var self=this,$self=this;
  46488. return $self["@timestamp"];
  46489. },
  46490. args: [],
  46491. source: "timestamp\x0a\x09^ timestamp",
  46492. referencedClasses: [],
  46493. messageSends: []
  46494. }),
  46495. $globals.TestResult);
  46496. $core.addMethod(
  46497. $core.method({
  46498. selector: "total",
  46499. protocol: "accessing",
  46500. fn: function (){
  46501. var self=this,$self=this;
  46502. return $self["@total"];
  46503. },
  46504. args: [],
  46505. source: "total\x0a\x09^ total",
  46506. referencedClasses: [],
  46507. messageSends: []
  46508. }),
  46509. $globals.TestResult);
  46510. $core.addMethod(
  46511. $core.method({
  46512. selector: "total:",
  46513. protocol: "accessing",
  46514. fn: function (aNumber){
  46515. var self=this,$self=this;
  46516. $self["@total"]=aNumber;
  46517. return self;
  46518. },
  46519. args: ["aNumber"],
  46520. source: "total: aNumber\x0a\x09total := aNumber",
  46521. referencedClasses: [],
  46522. messageSends: []
  46523. }),
  46524. $globals.TestResult);
  46525. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  46526. $globals.TestSuiteRunner.comment="I am responsible for running a collection (`suite`) of tests.\x0a\x0a## API\x0a\x0aInstances should be created using the class-side `#on:` method, taking a collection of tests to run as parameter.\x0aTo run the test suite, use `#run`.";
  46527. $core.addMethod(
  46528. $core.method({
  46529. selector: "announcer",
  46530. protocol: "accessing",
  46531. fn: function (){
  46532. var self=this,$self=this;
  46533. return $self["@announcer"];
  46534. },
  46535. args: [],
  46536. source: "announcer\x0a\x09^ announcer",
  46537. referencedClasses: [],
  46538. messageSends: []
  46539. }),
  46540. $globals.TestSuiteRunner);
  46541. $core.addMethod(
  46542. $core.method({
  46543. selector: "contextOf:",
  46544. protocol: "private",
  46545. fn: function (anInteger){
  46546. var self=this,$self=this;
  46547. return $core.withContext(function($ctx1) {
  46548. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  46549. return $core.withContext(function($ctx2) {
  46550. return $self._resume();
  46551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46552. }));
  46553. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  46554. },
  46555. args: ["anInteger"],
  46556. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  46557. referencedClasses: ["ReportingTestContext"],
  46558. messageSends: ["testCase:result:finished:", "at:", "resume"]
  46559. }),
  46560. $globals.TestSuiteRunner);
  46561. $core.addMethod(
  46562. $core.method({
  46563. selector: "initialize",
  46564. protocol: "initialization",
  46565. fn: function (){
  46566. var self=this,$self=this;
  46567. return $core.withContext(function($ctx1) {
  46568. var $1;
  46569. (
  46570. $ctx1.supercall = true,
  46571. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46572. $ctx1.supercall = false;
  46573. $self["@announcer"]=$recv($globals.Announcer)._new();
  46574. $ctx1.sendIdx["new"]=1;
  46575. $self["@result"]=$recv($globals.TestResult)._new();
  46576. $self["@runNextTest"]=(function(){
  46577. var runs;
  46578. return $core.withContext(function($ctx2) {
  46579. runs=$recv($self["@result"])._runs();
  46580. runs;
  46581. $1=$recv(runs).__lt($recv($self["@result"])._total());
  46582. if($core.assert($1)){
  46583. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  46584. }
  46585. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  46586. });
  46587. return self;
  46588. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  46589. },
  46590. args: [],
  46591. source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new.\x0a\x09result := TestResult new.\x0a\x09runNextTest := [ | runs | runs := result runs. runs < result total ifTrue: [ (self contextOf: runs + 1) start ] ].",
  46592. referencedClasses: ["Announcer", "TestResult"],
  46593. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  46594. }),
  46595. $globals.TestSuiteRunner);
  46596. $core.addMethod(
  46597. $core.method({
  46598. selector: "result",
  46599. protocol: "accessing",
  46600. fn: function (){
  46601. var self=this,$self=this;
  46602. return $self["@result"];
  46603. },
  46604. args: [],
  46605. source: "result\x0a\x09^ result",
  46606. referencedClasses: [],
  46607. messageSends: []
  46608. }),
  46609. $globals.TestSuiteRunner);
  46610. $core.addMethod(
  46611. $core.method({
  46612. selector: "resume",
  46613. protocol: "actions",
  46614. fn: function (){
  46615. var self=this,$self=this;
  46616. return $core.withContext(function($ctx1) {
  46617. $recv($self["@runNextTest"])._fork();
  46618. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  46619. return self;
  46620. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  46621. },
  46622. args: [],
  46623. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  46624. referencedClasses: ["ResultAnnouncement"],
  46625. messageSends: ["fork", "announce:", "result:", "new"]
  46626. }),
  46627. $globals.TestSuiteRunner);
  46628. $core.addMethod(
  46629. $core.method({
  46630. selector: "run",
  46631. protocol: "actions",
  46632. fn: function (){
  46633. var self=this,$self=this;
  46634. return $core.withContext(function($ctx1) {
  46635. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  46636. $self._resume();
  46637. return self;
  46638. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  46639. },
  46640. args: [],
  46641. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  46642. referencedClasses: [],
  46643. messageSends: ["total:", "size", "resume"]
  46644. }),
  46645. $globals.TestSuiteRunner);
  46646. $core.addMethod(
  46647. $core.method({
  46648. selector: "suite:",
  46649. protocol: "accessing",
  46650. fn: function (aCollection){
  46651. var self=this,$self=this;
  46652. $self["@suite"]=aCollection;
  46653. return self;
  46654. },
  46655. args: ["aCollection"],
  46656. source: "suite: aCollection\x0a\x09suite := aCollection",
  46657. referencedClasses: [],
  46658. messageSends: []
  46659. }),
  46660. $globals.TestSuiteRunner);
  46661. $core.addMethod(
  46662. $core.method({
  46663. selector: "new",
  46664. protocol: "instance creation",
  46665. fn: function (){
  46666. var self=this,$self=this;
  46667. return $core.withContext(function($ctx1) {
  46668. $self._shouldNotImplement();
  46669. return self;
  46670. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  46671. },
  46672. args: [],
  46673. source: "new\x0a\x09self shouldNotImplement",
  46674. referencedClasses: [],
  46675. messageSends: ["shouldNotImplement"]
  46676. }),
  46677. $globals.TestSuiteRunner.a$cls);
  46678. $core.addMethod(
  46679. $core.method({
  46680. selector: "on:",
  46681. protocol: "instance creation",
  46682. fn: function (aCollection){
  46683. var self=this,$self=this;
  46684. return $core.withContext(function($ctx1) {
  46685. var $1;
  46686. $1=(
  46687. $ctx1.supercall = true,
  46688. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  46689. $ctx1.supercall = false;
  46690. return $recv($1)._suite_(aCollection);
  46691. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  46692. },
  46693. args: ["aCollection"],
  46694. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  46695. referencedClasses: [],
  46696. messageSends: ["suite:", "new"]
  46697. }),
  46698. $globals.TestSuiteRunner.a$cls);
  46699. $core.addMethod(
  46700. $core.method({
  46701. selector: "isTestPackage",
  46702. protocol: "*SUnit",
  46703. fn: function (){
  46704. var self=this,$self=this;
  46705. return $core.withContext(function($ctx1) {
  46706. return $recv($self._classes())._anySatisfy_((function(each){
  46707. return $core.withContext(function($ctx2) {
  46708. return $recv(each)._isTestClass();
  46709. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46710. }));
  46711. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  46712. },
  46713. args: [],
  46714. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  46715. referencedClasses: [],
  46716. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  46717. }),
  46718. $globals.Package);
  46719. $core.addMethod(
  46720. $core.method({
  46721. selector: "isTestClass",
  46722. protocol: "*SUnit",
  46723. fn: function (){
  46724. var self=this,$self=this;
  46725. return false;
  46726. },
  46727. args: [],
  46728. source: "isTestClass\x0a\x09^ false",
  46729. referencedClasses: [],
  46730. messageSends: []
  46731. }),
  46732. $globals.TBehaviorDefaults);
  46733. });
  46734. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  46735. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  46736. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  46737. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46738. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  46739. $core.addPackage("Compiler-Tests");
  46740. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  46741. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46742. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  46743. $core.addMethod(
  46744. $core.method({
  46745. selector: "analyze:forClass:",
  46746. protocol: "convenience",
  46747. fn: function (aNode,aClass){
  46748. var self=this,$self=this;
  46749. return $core.withContext(function($ctx1) {
  46750. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  46751. return aNode;
  46752. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  46753. },
  46754. args: ["aNode", "aClass"],
  46755. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46756. referencedClasses: ["SemanticAnalyzer"],
  46757. messageSends: ["visit:", "on:"]
  46758. }),
  46759. $globals.ASTParsingTest);
  46760. $core.addMethod(
  46761. $core.method({
  46762. selector: "parse:",
  46763. protocol: "parsing",
  46764. fn: function (aString){
  46765. var self=this,$self=this;
  46766. return $core.withContext(function($ctx1) {
  46767. return $recv($globals.Smalltalk)._parse_(aString);
  46768. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  46769. },
  46770. args: ["aString"],
  46771. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46772. referencedClasses: ["Smalltalk"],
  46773. messageSends: ["parse:"]
  46774. }),
  46775. $globals.ASTParsingTest);
  46776. $core.addMethod(
  46777. $core.method({
  46778. selector: "parse:forClass:",
  46779. protocol: "parsing",
  46780. fn: function (aString,aClass){
  46781. var self=this,$self=this;
  46782. return $core.withContext(function($ctx1) {
  46783. return $self._analyze_forClass_($self._parse_(aString),aClass);
  46784. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  46785. },
  46786. args: ["aString", "aClass"],
  46787. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46788. referencedClasses: [],
  46789. messageSends: ["analyze:forClass:", "parse:"]
  46790. }),
  46791. $globals.ASTParsingTest);
  46792. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  46793. $core.addMethod(
  46794. $core.method({
  46795. selector: "astPCNodeVisitor",
  46796. protocol: "factory",
  46797. fn: function (){
  46798. var self=this,$self=this;
  46799. return $core.withContext(function($ctx1) {
  46800. var $1;
  46801. $1=$recv($globals.ASTPCNodeVisitor)._new();
  46802. $recv($1)._index_((0));
  46803. return $recv($1)._yourself();
  46804. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  46805. },
  46806. args: [],
  46807. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  46808. referencedClasses: ["ASTPCNodeVisitor"],
  46809. messageSends: ["index:", "new", "yourself"]
  46810. }),
  46811. $globals.ASTPCNodeVisitorTest);
  46812. $core.addMethod(
  46813. $core.method({
  46814. selector: "astPCNodeVisitorForSelector:",
  46815. protocol: "factory",
  46816. fn: function (aString){
  46817. var self=this,$self=this;
  46818. return $core.withContext(function($ctx1) {
  46819. var $1;
  46820. $1=$recv($globals.ASTPCNodeVisitor)._new();
  46821. $recv($1)._selector_(aString);
  46822. $recv($1)._index_((0));
  46823. return $recv($1)._yourself();
  46824. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  46825. },
  46826. args: ["aString"],
  46827. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  46828. referencedClasses: ["ASTPCNodeVisitor"],
  46829. messageSends: ["selector:", "new", "index:", "yourself"]
  46830. }),
  46831. $globals.ASTPCNodeVisitorTest);
  46832. $core.addMethod(
  46833. $core.method({
  46834. selector: "testJSStatementNode",
  46835. protocol: "tests",
  46836. fn: function (){
  46837. var self=this,$self=this;
  46838. var ast,visitor;
  46839. return $core.withContext(function($ctx1) {
  46840. var $3,$2,$1;
  46841. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  46842. $3=$self._astPCNodeVisitor();
  46843. $recv($3)._visit_(ast);
  46844. $2=$recv($3)._currentNode();
  46845. $1=$recv($2)._isJSStatementNode();
  46846. $self._assert_($1);
  46847. return self;
  46848. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46849. },
  46850. args: [],
  46851. source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <inlineJS: ''consolee.log(1)''>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  46852. referencedClasses: ["Object"],
  46853. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46854. }),
  46855. $globals.ASTPCNodeVisitorTest);
  46856. $core.addMethod(
  46857. $core.method({
  46858. selector: "testLegacyJSStatementNode",
  46859. protocol: "tests",
  46860. fn: function (){
  46861. var self=this,$self=this;
  46862. var ast,visitor;
  46863. return $core.withContext(function($ctx1) {
  46864. var $3,$2,$1;
  46865. ast=$self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  46866. $3=$self._astPCNodeVisitor();
  46867. $recv($3)._visit_(ast);
  46868. $2=$recv($3)._currentNode();
  46869. $1=$recv($2)._isJSStatementNode();
  46870. $self._assert_($1);
  46871. return self;
  46872. }, function($ctx1) {$ctx1.fill(self,"testLegacyJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46873. },
  46874. args: [],
  46875. source: "testLegacyJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  46876. referencedClasses: ["Object"],
  46877. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46878. }),
  46879. $globals.ASTPCNodeVisitorTest);
  46880. $core.addMethod(
  46881. $core.method({
  46882. selector: "testMessageSend",
  46883. protocol: "tests",
  46884. fn: function (){
  46885. var self=this,$self=this;
  46886. var ast;
  46887. return $core.withContext(function($ctx1) {
  46888. var $3,$2,$1;
  46889. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  46890. $3=$self._astPCNodeVisitorForSelector_("yourself");
  46891. $recv($3)._visit_(ast);
  46892. $2=$recv($3)._currentNode();
  46893. $1=$recv($2)._selector();
  46894. $self._assert_equals_($1,"yourself");
  46895. return self;
  46896. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46897. },
  46898. args: [],
  46899. source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  46900. referencedClasses: ["Object"],
  46901. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46902. }),
  46903. $globals.ASTPCNodeVisitorTest);
  46904. $core.addMethod(
  46905. $core.method({
  46906. selector: "testMessageSendWithBlocks",
  46907. protocol: "tests",
  46908. fn: function (){
  46909. var self=this,$self=this;
  46910. var ast;
  46911. return $core.withContext(function($ctx1) {
  46912. var $3,$2,$1;
  46913. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  46914. $3=$self._astPCNodeVisitorForSelector_("yourself");
  46915. $recv($3)._visit_(ast);
  46916. $2=$recv($3)._currentNode();
  46917. $1=$recv($2)._selector();
  46918. $self._assert_equals_($1,"yourself");
  46919. return self;
  46920. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46921. },
  46922. args: [],
  46923. source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  46924. referencedClasses: ["Object"],
  46925. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46926. }),
  46927. $globals.ASTPCNodeVisitorTest);
  46928. $core.addMethod(
  46929. $core.method({
  46930. selector: "testMessageSendWithInlining",
  46931. protocol: "tests",
  46932. fn: function (){
  46933. var self=this,$self=this;
  46934. var ast;
  46935. return $core.withContext(function($ctx1) {
  46936. var $3,$4,$2,$1,$7,$6,$5;
  46937. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  46938. $ctx1.sendIdx["parse:forClass:"]=1;
  46939. $3=$self._astPCNodeVisitorForSelector_("yourself");
  46940. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  46941. $recv($3)._visit_(ast);
  46942. $ctx1.sendIdx["visit:"]=1;
  46943. $4=$recv($3)._currentNode();
  46944. $ctx1.sendIdx["currentNode"]=1;
  46945. $2=$4;
  46946. $1=$recv($2)._selector();
  46947. $ctx1.sendIdx["selector"]=1;
  46948. $self._assert_equals_($1,"yourself");
  46949. $ctx1.sendIdx["assert:equals:"]=1;
  46950. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  46951. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  46952. $recv($7)._visit_(ast);
  46953. $6=$recv($7)._currentNode();
  46954. $5=$recv($6)._selector();
  46955. $self._assert_equals_($5,"asBoolean");
  46956. return self;
  46957. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46958. },
  46959. args: [],
  46960. source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'",
  46961. referencedClasses: ["Object"],
  46962. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46963. }),
  46964. $globals.ASTPCNodeVisitorTest);
  46965. $core.addMethod(
  46966. $core.method({
  46967. selector: "testNoMessageSend",
  46968. protocol: "tests",
  46969. fn: function (){
  46970. var self=this,$self=this;
  46971. var ast;
  46972. return $core.withContext(function($ctx1) {
  46973. var $3,$2,$1;
  46974. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  46975. $3=$self._astPCNodeVisitor();
  46976. $recv($3)._visit_(ast);
  46977. $2=$recv($3)._currentNode();
  46978. $1=$recv($2)._isNil();
  46979. $self._assert_($1);
  46980. return self;
  46981. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46982. },
  46983. args: [],
  46984. source: "testNoMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo ^ self' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isNil",
  46985. referencedClasses: ["Object"],
  46986. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  46987. }),
  46988. $globals.ASTPCNodeVisitorTest);
  46989. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  46990. $core.addMethod(
  46991. $core.method({
  46992. selector: "testNodeAtPosition",
  46993. protocol: "tests",
  46994. fn: function (){
  46995. var self=this,$self=this;
  46996. var node;
  46997. return $core.withContext(function($ctx1) {
  46998. var $3,$4,$2,$1,$7,$8,$6,$5;
  46999. node=$self._parse_("yourself\x0a\x09^ self");
  47000. $ctx1.sendIdx["parse:"]=1;
  47001. $3=node;
  47002. $4=(2).__at((4));
  47003. $ctx1.sendIdx["@"]=1;
  47004. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  47005. return nil;
  47006. }));
  47007. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  47008. $1=$recv($2)._source();
  47009. $self._assert_equals_($1,"self");
  47010. $ctx1.sendIdx["assert:equals:"]=1;
  47011. node=$self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  47012. $ctx1.sendIdx["parse:"]=2;
  47013. $7=node;
  47014. $8=(2).__at((7));
  47015. $ctx1.sendIdx["@"]=2;
  47016. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  47017. return nil;
  47018. }));
  47019. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  47020. $5=$recv($6)._selector();
  47021. $ctx1.sendIdx["selector"]=1;
  47022. $self._assert_equals_($5,"ifTrue:");
  47023. $ctx1.sendIdx["assert:equals:"]=2;
  47024. node=$self._parse_("foo\x0a\x09self foo; bar; baz");
  47025. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  47026. return nil;
  47027. })))._selector(),"foo");
  47028. return self;
  47029. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  47030. },
  47031. args: [],
  47032. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  47033. referencedClasses: [],
  47034. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  47035. }),
  47036. $globals.ASTPositionTest);
  47037. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  47038. $core.addMethod(
  47039. $core.method({
  47040. selector: "codeGeneratorClass",
  47041. protocol: "accessing",
  47042. fn: function (){
  47043. var self=this,$self=this;
  47044. return $globals.CodeGenerator;
  47045. },
  47046. args: [],
  47047. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  47048. referencedClasses: ["CodeGenerator"],
  47049. messageSends: []
  47050. }),
  47051. $globals.CodeGeneratorTest);
  47052. $core.addMethod(
  47053. $core.method({
  47054. selector: "compiler",
  47055. protocol: "factory",
  47056. fn: function (){
  47057. var self=this,$self=this;
  47058. return $core.withContext(function($ctx1) {
  47059. var $1;
  47060. $1=$recv($globals.Compiler)._new();
  47061. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  47062. return $recv($1)._yourself();
  47063. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  47064. },
  47065. args: [],
  47066. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  47067. referencedClasses: ["Compiler"],
  47068. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  47069. }),
  47070. $globals.CodeGeneratorTest);
  47071. $core.addMethod(
  47072. $core.method({
  47073. selector: "setUp",
  47074. protocol: "initialization",
  47075. fn: function (){
  47076. var self=this,$self=this;
  47077. return $core.withContext(function($ctx1) {
  47078. $self["@receiver"]=$recv($globals.DoIt)._new();
  47079. return self;
  47080. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  47081. },
  47082. args: [],
  47083. source: "setUp\x0a\x09receiver := DoIt new",
  47084. referencedClasses: ["DoIt"],
  47085. messageSends: ["new"]
  47086. }),
  47087. $globals.CodeGeneratorTest);
  47088. $core.addMethod(
  47089. $core.method({
  47090. selector: "should:receiver:raise:",
  47091. protocol: "testing",
  47092. fn: function (aString,anObject,anErrorClass){
  47093. var self=this,$self=this;
  47094. var method,result;
  47095. return $core.withContext(function($ctx1) {
  47096. var $1,$2,$3,$receiver;
  47097. $self["@receiver"]=anObject;
  47098. $recv((function(){
  47099. return $core.withContext(function($ctx2) {
  47100. return $self._should_raise_((function(){
  47101. return $core.withContext(function($ctx3) {
  47102. $1=$self._compiler();
  47103. $2=$recv(anObject)._class();
  47104. $ctx3.sendIdx["class"]=1;
  47105. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  47106. method;
  47107. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  47108. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47109. }),anErrorClass);
  47110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47111. }))._ensure_((function(){
  47112. return $core.withContext(function($ctx2) {
  47113. $3=method;
  47114. if(($receiver = $3) == null || $receiver.a$nil){
  47115. return $3;
  47116. } else {
  47117. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  47118. }
  47119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47120. }));
  47121. return self;
  47122. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  47123. },
  47124. args: ["aString", "anObject", "anErrorClass"],
  47125. source: "should: aString receiver: anObject raise: anErrorClass\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09[ self should: [\x0a\x09\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09\x09receiver perform: method selector ] raise: anErrorClass ]\x0a\x09ensure: [ method ifNotNil: [ anObject class removeCompiledMethod: method ] ]",
  47126. referencedClasses: [],
  47127. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  47128. }),
  47129. $globals.CodeGeneratorTest);
  47130. $core.addMethod(
  47131. $core.method({
  47132. selector: "should:receiver:return:",
  47133. protocol: "testing",
  47134. fn: function (aString,anObject,aResult){
  47135. var self=this,$self=this;
  47136. var method,result;
  47137. return $core.withContext(function($ctx1) {
  47138. var $1,$2;
  47139. $self["@receiver"]=anObject;
  47140. $1=$self._compiler();
  47141. $2=$recv(anObject)._class();
  47142. $ctx1.sendIdx["class"]=1;
  47143. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  47144. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  47145. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  47146. $self._assert_equals_(aResult,result);
  47147. return self;
  47148. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  47149. },
  47150. args: ["aString", "anObject", "aResult"],
  47151. source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  47152. referencedClasses: [],
  47153. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  47154. }),
  47155. $globals.CodeGeneratorTest);
  47156. $core.addMethod(
  47157. $core.method({
  47158. selector: "should:return:",
  47159. protocol: "testing",
  47160. fn: function (aString,anObject){
  47161. var self=this,$self=this;
  47162. return $core.withContext(function($ctx1) {
  47163. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  47164. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  47165. },
  47166. args: ["aString", "anObject"],
  47167. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  47168. referencedClasses: [],
  47169. messageSends: ["should:receiver:return:"]
  47170. }),
  47171. $globals.CodeGeneratorTest);
  47172. $core.addMethod(
  47173. $core.method({
  47174. selector: "tearDown",
  47175. protocol: "initialization",
  47176. fn: function (){
  47177. var self=this,$self=this;
  47178. return self;
  47179. },
  47180. args: [],
  47181. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  47182. referencedClasses: [],
  47183. messageSends: []
  47184. }),
  47185. $globals.CodeGeneratorTest);
  47186. $core.addMethod(
  47187. $core.method({
  47188. selector: "testAssignment",
  47189. protocol: "tests",
  47190. fn: function (){
  47191. var self=this,$self=this;
  47192. return $core.withContext(function($ctx1) {
  47193. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  47194. $ctx1.sendIdx["should:return:"]=1;
  47195. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  47196. $ctx1.sendIdx["should:return:"]=2;
  47197. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  47198. return self;
  47199. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  47200. },
  47201. args: [],
  47202. source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1",
  47203. referencedClasses: [],
  47204. messageSends: ["should:return:"]
  47205. }),
  47206. $globals.CodeGeneratorTest);
  47207. $core.addMethod(
  47208. $core.method({
  47209. selector: "testBackslashSelectors",
  47210. protocol: "tests",
  47211. fn: function (){
  47212. var self=this,$self=this;
  47213. return $core.withContext(function($ctx1) {
  47214. $self._should_return_("\x5c arg ^ 4",(4));
  47215. $ctx1.sendIdx["should:return:"]=1;
  47216. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  47217. return self;
  47218. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  47219. },
  47220. args: [],
  47221. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  47222. referencedClasses: [],
  47223. messageSends: ["should:return:"]
  47224. }),
  47225. $globals.CodeGeneratorTest);
  47226. $core.addMethod(
  47227. $core.method({
  47228. selector: "testBlockReturn",
  47229. protocol: "tests",
  47230. fn: function (){
  47231. var self=this,$self=this;
  47232. return $core.withContext(function($ctx1) {
  47233. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  47234. $ctx1.sendIdx["should:return:"]=1;
  47235. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  47236. $ctx1.sendIdx["should:return:"]=2;
  47237. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  47238. return self;
  47239. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  47240. },
  47241. args: [],
  47242. source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).",
  47243. referencedClasses: [],
  47244. messageSends: ["should:return:"]
  47245. }),
  47246. $globals.CodeGeneratorTest);
  47247. $core.addMethod(
  47248. $core.method({
  47249. selector: "testCascades",
  47250. protocol: "tests",
  47251. fn: function (){
  47252. var self=this,$self=this;
  47253. return $core.withContext(function($ctx1) {
  47254. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  47255. return self;
  47256. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  47257. },
  47258. args: [],
  47259. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  47260. referencedClasses: [],
  47261. messageSends: ["should:return:"]
  47262. }),
  47263. $globals.CodeGeneratorTest);
  47264. $core.addMethod(
  47265. $core.method({
  47266. selector: "testCascadesInDynamicArray",
  47267. protocol: "tests",
  47268. fn: function (){
  47269. var self=this,$self=this;
  47270. return $core.withContext(function($ctx1) {
  47271. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  47272. return self;
  47273. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  47274. },
  47275. args: [],
  47276. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  47277. referencedClasses: [],
  47278. messageSends: ["should:return:"]
  47279. }),
  47280. $globals.CodeGeneratorTest);
  47281. $core.addMethod(
  47282. $core.method({
  47283. selector: "testCascadesInDynamicDictioary",
  47284. protocol: "tests",
  47285. fn: function (){
  47286. var self=this,$self=this;
  47287. return $core.withContext(function($ctx1) {
  47288. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  47289. return self;
  47290. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  47291. },
  47292. args: [],
  47293. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  47294. referencedClasses: [],
  47295. messageSends: ["should:return:"]
  47296. }),
  47297. $globals.CodeGeneratorTest);
  47298. $core.addMethod(
  47299. $core.method({
  47300. selector: "testCascadesInSend",
  47301. protocol: "tests",
  47302. fn: function (){
  47303. var self=this,$self=this;
  47304. return $core.withContext(function($ctx1) {
  47305. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  47306. return self;
  47307. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  47308. },
  47309. args: [],
  47310. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  47311. referencedClasses: [],
  47312. messageSends: ["should:return:"]
  47313. }),
  47314. $globals.CodeGeneratorTest);
  47315. $core.addMethod(
  47316. $core.method({
  47317. selector: "testCascadesWithInlining",
  47318. protocol: "tests",
  47319. fn: function (){
  47320. var self=this,$self=this;
  47321. return $core.withContext(function($ctx1) {
  47322. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  47323. $ctx1.sendIdx["should:return:"]=1;
  47324. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  47325. return self;
  47326. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  47327. },
  47328. args: [],
  47329. source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
  47330. referencedClasses: [],
  47331. messageSends: ["should:return:"]
  47332. }),
  47333. $globals.CodeGeneratorTest);
  47334. $core.addMethod(
  47335. $core.method({
  47336. selector: "testDynamicArrayElementsOrdered",
  47337. protocol: "tests",
  47338. fn: function (){
  47339. var self=this,$self=this;
  47340. return $core.withContext(function($ctx1) {
  47341. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  47342. $ctx1.sendIdx["should:return:"]=1;
  47343. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  47344. return self;
  47345. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  47346. },
  47347. args: [],
  47348. source: "testDynamicArrayElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a' return: #(1 2).",
  47349. referencedClasses: [],
  47350. messageSends: ["should:return:"]
  47351. }),
  47352. $globals.CodeGeneratorTest);
  47353. $core.addMethod(
  47354. $core.method({
  47355. selector: "testDynamicDictionaryElementsOrdered",
  47356. protocol: "tests",
  47357. fn: function (){
  47358. var self=this,$self=this;
  47359. return $core.withContext(function($ctx1) {
  47360. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  47361. return self;
  47362. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  47363. },
  47364. args: [],
  47365. source: "testDynamicDictionaryElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := ''foo''.\x0a\x09^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  47366. referencedClasses: [],
  47367. messageSends: ["should:return:"]
  47368. }),
  47369. $globals.CodeGeneratorTest);
  47370. $core.addMethod(
  47371. $core.method({
  47372. selector: "testDynamicDictionaryWithMoreArrows",
  47373. protocol: "tests",
  47374. fn: function (){
  47375. var self=this,$self=this;
  47376. return $core.withContext(function($ctx1) {
  47377. var $2,$1;
  47378. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  47379. $ctx1.sendIdx["->"]=1;
  47380. $1=$recv($globals.HashedCollection)._with_($2);
  47381. $self._should_return_("foo ^ #{1->2->3}",$1);
  47382. return self;
  47383. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  47384. },
  47385. args: [],
  47386. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  47387. referencedClasses: ["HashedCollection"],
  47388. messageSends: ["should:return:", "with:", "->"]
  47389. }),
  47390. $globals.CodeGeneratorTest);
  47391. $core.addMethod(
  47392. $core.method({
  47393. selector: "testGlobalVar",
  47394. protocol: "tests",
  47395. fn: function (){
  47396. var self=this,$self=this;
  47397. return $core.withContext(function($ctx1) {
  47398. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  47399. $ctx1.sendIdx["should:return:"]=1;
  47400. $self._should_return_("foo ^ Math cos: 0",(1));
  47401. $ctx1.sendIdx["should:return:"]=2;
  47402. $self._should_return_("foo ^ NonExistingVar",nil);
  47403. return self;
  47404. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  47405. },
  47406. args: [],
  47407. source: "testGlobalVar\x0a\x09self should: 'foo ^ eval class' return: BlockClosure.\x0a\x09self should: 'foo ^ Math cos: 0' return: 1.\x0a\x09self should: 'foo ^ NonExistingVar' return: nil",
  47408. referencedClasses: ["BlockClosure"],
  47409. messageSends: ["should:return:"]
  47410. }),
  47411. $globals.CodeGeneratorTest);
  47412. $core.addMethod(
  47413. $core.method({
  47414. selector: "testInnerTemporalDependentElementsOrdered",
  47415. protocol: "tests",
  47416. fn: function (){
  47417. var self=this,$self=this;
  47418. return $core.withContext(function($ctx1) {
  47419. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  47420. $2="foo".__minus_gt($globals.Array);
  47421. $ctx1.sendIdx["->"]=1;
  47422. $3="bar".__minus_gt((2));
  47423. $ctx1.sendIdx["->"]=2;
  47424. $1=[$2,$3];
  47425. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  47426. $ctx1.sendIdx["should:return:"]=1;
  47427. $5="foo".__minus_gt($globals.Array);
  47428. $ctx1.sendIdx["->"]=3;
  47429. $6="bar".__minus_gt((2));
  47430. $ctx1.sendIdx["->"]=4;
  47431. $4=[$5,$6];
  47432. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  47433. $ctx1.sendIdx["should:return:"]=2;
  47434. $8="foo".__minus_gt((1));
  47435. $ctx1.sendIdx["->"]=5;
  47436. $9="bar".__minus_gt((2));
  47437. $ctx1.sendIdx["->"]=6;
  47438. $7=[$8,$9];
  47439. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  47440. $ctx1.sendIdx["should:return:"]=3;
  47441. $11="foo".__minus_gt((1));
  47442. $ctx1.sendIdx["->"]=7;
  47443. $10=[$11,"bar".__minus_gt((2))];
  47444. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  47445. $ctx1.sendIdx["should:return:"]=4;
  47446. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  47447. return self;
  47448. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  47449. },
  47450. args: [],
  47451. source: "testInnerTemporalDependentElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(x := 2)\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  47452. referencedClasses: ["Array"],
  47453. messageSends: ["should:return:", "->"]
  47454. }),
  47455. $globals.CodeGeneratorTest);
  47456. $core.addMethod(
  47457. $core.method({
  47458. selector: "testJSStatement",
  47459. protocol: "tests",
  47460. fn: function (){
  47461. var self=this,$self=this;
  47462. return $core.withContext(function($ctx1) {
  47463. $self._should_return_("foo <return 2+3>",(5));
  47464. return self;
  47465. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  47466. },
  47467. args: [],
  47468. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  47469. referencedClasses: [],
  47470. messageSends: ["should:return:"]
  47471. }),
  47472. $globals.CodeGeneratorTest);
  47473. $core.addMethod(
  47474. $core.method({
  47475. selector: "testLexicalScope",
  47476. protocol: "tests",
  47477. fn: function (){
  47478. var self=this,$self=this;
  47479. return $core.withContext(function($ctx1) {
  47480. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  47481. return self;
  47482. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  47483. },
  47484. args: [],
  47485. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  47486. referencedClasses: [],
  47487. messageSends: ["should:return:"]
  47488. }),
  47489. $globals.CodeGeneratorTest);
  47490. $core.addMethod(
  47491. $core.method({
  47492. selector: "testLiterals",
  47493. protocol: "tests",
  47494. fn: function (){
  47495. var self=this,$self=this;
  47496. return $core.withContext(function($ctx1) {
  47497. $self._should_return_("foo ^ 1",(1));
  47498. $ctx1.sendIdx["should:return:"]=1;
  47499. $self._should_return_("foo ^ 'hello'","hello");
  47500. $ctx1.sendIdx["should:return:"]=2;
  47501. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  47502. $ctx1.sendIdx["should:return:"]=3;
  47503. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  47504. $ctx1.sendIdx["should:return:"]=4;
  47505. $self._should_return_("foo ^ true",true);
  47506. $ctx1.sendIdx["should:return:"]=5;
  47507. $self._should_return_("foo ^ false",false);
  47508. $ctx1.sendIdx["should:return:"]=6;
  47509. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  47510. $ctx1.sendIdx["should:return:"]=7;
  47511. $self._should_return_("foo ^ #hello","hello");
  47512. $ctx1.sendIdx["should:return:"]=8;
  47513. $self._should_return_("foo ^ $h","h");
  47514. $ctx1.sendIdx["should:return:"]=9;
  47515. $self._should_return_("foo ^ -123.456",(-123.456));
  47516. $ctx1.sendIdx["should:return:"]=10;
  47517. $self._should_return_("foo ^ -2.5e4",(-25000));
  47518. return self;
  47519. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  47520. },
  47521. args: [],
  47522. source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ $h' return: 'h'.\x0a\x09self should: 'foo ^ -123.456' return: -123.456.\x0a\x09self should: 'foo ^ -2.5e4' return: -25000.",
  47523. referencedClasses: [],
  47524. messageSends: ["should:return:"]
  47525. }),
  47526. $globals.CodeGeneratorTest);
  47527. $core.addMethod(
  47528. $core.method({
  47529. selector: "testLocalReturn",
  47530. protocol: "tests",
  47531. fn: function (){
  47532. var self=this,$self=this;
  47533. return $core.withContext(function($ctx1) {
  47534. $self._should_return_("foo ^ 1",(1));
  47535. $ctx1.sendIdx["should:return:"]=1;
  47536. $self._should_return_("foo ^ 1 + 1",(2));
  47537. $ctx1.sendIdx["should:return:"]=2;
  47538. $self._should_return_("foo ",$self["@receiver"]);
  47539. $ctx1.sendIdx["should:return:"]=3;
  47540. $self._should_return_("foo self asString",$self["@receiver"]);
  47541. $ctx1.sendIdx["should:return:"]=4;
  47542. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  47543. return self;
  47544. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  47545. },
  47546. args: [],
  47547. source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3",
  47548. referencedClasses: [],
  47549. messageSends: ["should:return:"]
  47550. }),
  47551. $globals.CodeGeneratorTest);
  47552. $core.addMethod(
  47553. $core.method({
  47554. selector: "testMessageSends",
  47555. protocol: "tests",
  47556. fn: function (){
  47557. var self=this,$self=this;
  47558. return $core.withContext(function($ctx1) {
  47559. $self._should_return_("foo ^ 1 asString","1");
  47560. $ctx1.sendIdx["should:return:"]=1;
  47561. $self._should_return_("foo ^ 1 + 1",(2));
  47562. $ctx1.sendIdx["should:return:"]=2;
  47563. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  47564. $ctx1.sendIdx["should:return:"]=3;
  47565. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  47566. $ctx1.sendIdx["should:return:"]=4;
  47567. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  47568. return self;
  47569. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  47570. },
  47571. args: [],
  47572. source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)",
  47573. referencedClasses: [],
  47574. messageSends: ["should:return:"]
  47575. }),
  47576. $globals.CodeGeneratorTest);
  47577. $core.addMethod(
  47578. $core.method({
  47579. selector: "testMistypedPragmaJSStatement",
  47580. protocol: "tests",
  47581. fn: function (){
  47582. var self=this,$self=this;
  47583. return $core.withContext(function($ctx1) {
  47584. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  47585. return self;
  47586. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  47587. },
  47588. args: [],
  47589. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  47590. referencedClasses: ["ParseError"],
  47591. messageSends: ["should:receiver:raise:"]
  47592. }),
  47593. $globals.CodeGeneratorTest);
  47594. $core.addMethod(
  47595. $core.method({
  47596. selector: "testMultipleSequences",
  47597. protocol: "tests",
  47598. fn: function (){
  47599. var self=this,$self=this;
  47600. return $core.withContext(function($ctx1) {
  47601. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  47602. return self;
  47603. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  47604. },
  47605. args: [],
  47606. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  47607. referencedClasses: [],
  47608. messageSends: ["should:return:"]
  47609. }),
  47610. $globals.CodeGeneratorTest);
  47611. $core.addMethod(
  47612. $core.method({
  47613. selector: "testMutableLiterals",
  47614. protocol: "tests",
  47615. fn: function (){
  47616. var self=this,$self=this;
  47617. return $core.withContext(function($ctx1) {
  47618. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  47619. return self;
  47620. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  47621. },
  47622. args: [],
  47623. source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://lolg.it/amber/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
  47624. referencedClasses: [],
  47625. messageSends: ["should:return:"]
  47626. }),
  47627. $globals.CodeGeneratorTest);
  47628. $core.addMethod(
  47629. $core.method({
  47630. selector: "testNestedIfTrue",
  47631. protocol: "tests",
  47632. fn: function (){
  47633. var self=this,$self=this;
  47634. return $core.withContext(function($ctx1) {
  47635. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  47636. $ctx1.sendIdx["should:return:"]=1;
  47637. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  47638. $ctx1.sendIdx["should:return:"]=2;
  47639. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  47640. $ctx1.sendIdx["should:return:"]=3;
  47641. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  47642. return self;
  47643. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  47644. },
  47645. args: [],
  47646. source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.",
  47647. referencedClasses: [],
  47648. messageSends: ["should:return:"]
  47649. }),
  47650. $globals.CodeGeneratorTest);
  47651. $core.addMethod(
  47652. $core.method({
  47653. selector: "testNestedSends",
  47654. protocol: "tests",
  47655. fn: function (){
  47656. var self=this,$self=this;
  47657. return $core.withContext(function($ctx1) {
  47658. $self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($globals.Point)._x_y_((2).__at((3)),(4)))._asString());
  47659. return self;
  47660. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  47661. },
  47662. args: [],
  47663. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  47664. referencedClasses: ["Point"],
  47665. messageSends: ["should:return:", "asString", "x:y:", "@"]
  47666. }),
  47667. $globals.CodeGeneratorTest);
  47668. $core.addMethod(
  47669. $core.method({
  47670. selector: "testNonLocalReturn",
  47671. protocol: "tests",
  47672. fn: function (){
  47673. var self=this,$self=this;
  47674. return $core.withContext(function($ctx1) {
  47675. $self._should_return_("foo [ ^ 1 ] value",(1));
  47676. $ctx1.sendIdx["should:return:"]=1;
  47677. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  47678. $ctx1.sendIdx["should:return:"]=2;
  47679. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  47680. $ctx1.sendIdx["should:return:"]=3;
  47681. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  47682. return self;
  47683. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  47684. },
  47685. args: [],
  47686. source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8",
  47687. referencedClasses: [],
  47688. messageSends: ["should:return:"]
  47689. }),
  47690. $globals.CodeGeneratorTest);
  47691. $core.addMethod(
  47692. $core.method({
  47693. selector: "testPascalCaseGlobal",
  47694. protocol: "tests",
  47695. fn: function (){
  47696. var self=this,$self=this;
  47697. return $core.withContext(function($ctx1) {
  47698. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  47699. $ctx1.sendIdx["should:return:"]=1;
  47700. $self._should_return_("foo ^NonExistent",nil);
  47701. return self;
  47702. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  47703. },
  47704. args: [],
  47705. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  47706. referencedClasses: ["Smalltalk"],
  47707. messageSends: ["should:return:", "at:", "globals"]
  47708. }),
  47709. $globals.CodeGeneratorTest);
  47710. $core.addMethod(
  47711. $core.method({
  47712. selector: "testPragmaJSStatement",
  47713. protocol: "tests",
  47714. fn: function (){
  47715. var self=this,$self=this;
  47716. return $core.withContext(function($ctx1) {
  47717. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  47718. return self;
  47719. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  47720. },
  47721. args: [],
  47722. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  47723. referencedClasses: [],
  47724. messageSends: ["should:return:"]
  47725. }),
  47726. $globals.CodeGeneratorTest);
  47727. $core.addMethod(
  47728. $core.method({
  47729. selector: "testRootSuperSend",
  47730. protocol: "tests",
  47731. fn: function (){
  47732. var self=this,$self=this;
  47733. return $core.withContext(function($ctx1) {
  47734. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  47735. return self;
  47736. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  47737. },
  47738. args: [],
  47739. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  47740. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  47741. messageSends: ["should:receiver:raise:", "new"]
  47742. }),
  47743. $globals.CodeGeneratorTest);
  47744. $core.addMethod(
  47745. $core.method({
  47746. selector: "testSendReceiverAndArgumentsOrdered",
  47747. protocol: "tests",
  47748. fn: function (){
  47749. var self=this,$self=this;
  47750. return $core.withContext(function($ctx1) {
  47751. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  47752. $ctx1.sendIdx["should:return:"]=1;
  47753. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  47754. return self;
  47755. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  47756. },
  47757. args: [],
  47758. source: "testSendReceiverAndArgumentsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a' return: {Array. 2}.",
  47759. referencedClasses: ["Array"],
  47760. messageSends: ["should:return:"]
  47761. }),
  47762. $globals.CodeGeneratorTest);
  47763. $core.addMethod(
  47764. $core.method({
  47765. selector: "testSuperSend",
  47766. protocol: "tests",
  47767. fn: function (){
  47768. var self=this,$self=this;
  47769. return $core.withContext(function($ctx1) {
  47770. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  47771. return self;
  47772. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  47773. },
  47774. args: [],
  47775. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  47776. referencedClasses: [],
  47777. messageSends: ["should:receiver:return:"]
  47778. }),
  47779. $globals.CodeGeneratorTest);
  47780. $core.addMethod(
  47781. $core.method({
  47782. selector: "testTempVariables",
  47783. protocol: "tests",
  47784. fn: function (){
  47785. var self=this,$self=this;
  47786. return $core.withContext(function($ctx1) {
  47787. $self._should_return_("foo | a | ^ a",nil);
  47788. $ctx1.sendIdx["should:return:"]=1;
  47789. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  47790. $ctx1.sendIdx["should:return:"]=2;
  47791. $self._should_return_("foo | a b c | ^ c",nil);
  47792. $ctx1.sendIdx["should:return:"]=3;
  47793. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  47794. $ctx1.sendIdx["should:return:"]=4;
  47795. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  47796. $ctx1.sendIdx["should:return:"]=5;
  47797. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  47798. return self;
  47799. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  47800. },
  47801. args: [],
  47802. source: "testTempVariables\x0a\x09self should: 'foo | a | ^ a' return: nil.\x0a\x09self should: 'foo | AVariable | ^ AVariable' return: nil.\x0a\x09self should: 'foo | a b c | ^ c' return: nil.\x0a\x09self should: 'foo | a | [ | d | ^ d ] value' return: nil.\x0a\x09\x0a\x09self should: 'foo | a | a:= 1. ^ a' return: 1.\x0a\x09self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.",
  47803. referencedClasses: [],
  47804. messageSends: ["should:return:"]
  47805. }),
  47806. $globals.CodeGeneratorTest);
  47807. $core.addMethod(
  47808. $core.method({
  47809. selector: "testThisContext",
  47810. protocol: "tests",
  47811. fn: function (){
  47812. var self=this,$self=this;
  47813. return $core.withContext(function($ctx1) {
  47814. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  47815. return self;
  47816. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  47817. },
  47818. args: [],
  47819. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  47820. referencedClasses: [],
  47821. messageSends: ["should:return:"]
  47822. }),
  47823. $globals.CodeGeneratorTest);
  47824. $core.addMethod(
  47825. $core.method({
  47826. selector: "testifFalse",
  47827. protocol: "tests",
  47828. fn: function (){
  47829. var self=this,$self=this;
  47830. return $core.withContext(function($ctx1) {
  47831. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  47832. $ctx1.sendIdx["should:return:"]=1;
  47833. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  47834. $ctx1.sendIdx["should:return:"]=2;
  47835. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  47836. $ctx1.sendIdx["should:return:"]=3;
  47837. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  47838. return self;
  47839. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  47840. },
  47841. args: [],
  47842. source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.",
  47843. referencedClasses: [],
  47844. messageSends: ["should:return:"]
  47845. }),
  47846. $globals.CodeGeneratorTest);
  47847. $core.addMethod(
  47848. $core.method({
  47849. selector: "testifFalseIfTrue",
  47850. protocol: "tests",
  47851. fn: function (){
  47852. var self=this,$self=this;
  47853. return $core.withContext(function($ctx1) {
  47854. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  47855. $ctx1.sendIdx["should:return:"]=1;
  47856. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  47857. $ctx1.sendIdx["should:return:"]=2;
  47858. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  47859. $ctx1.sendIdx["should:return:"]=3;
  47860. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  47861. return self;
  47862. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  47863. },
  47864. args: [],
  47865. source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.",
  47866. referencedClasses: [],
  47867. messageSends: ["should:return:"]
  47868. }),
  47869. $globals.CodeGeneratorTest);
  47870. $core.addMethod(
  47871. $core.method({
  47872. selector: "testifNil",
  47873. protocol: "tests",
  47874. fn: function (){
  47875. var self=this,$self=this;
  47876. return $core.withContext(function($ctx1) {
  47877. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  47878. $ctx1.sendIdx["should:return:"]=1;
  47879. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  47880. $ctx1.sendIdx["should:return:"]=2;
  47881. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  47882. $ctx1.sendIdx["should:return:"]=3;
  47883. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  47884. return self;
  47885. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  47886. },
  47887. args: [],
  47888. source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.",
  47889. referencedClasses: [],
  47890. messageSends: ["should:return:"]
  47891. }),
  47892. $globals.CodeGeneratorTest);
  47893. $core.addMethod(
  47894. $core.method({
  47895. selector: "testifNilIfNotNil",
  47896. protocol: "tests",
  47897. fn: function (){
  47898. var self=this,$self=this;
  47899. return $core.withContext(function($ctx1) {
  47900. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  47901. $ctx1.sendIdx["should:return:"]=1;
  47902. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  47903. $ctx1.sendIdx["should:return:"]=2;
  47904. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  47905. $ctx1.sendIdx["should:return:"]=3;
  47906. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  47907. return self;
  47908. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  47909. },
  47910. args: [],
  47911. source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.",
  47912. referencedClasses: [],
  47913. messageSends: ["should:return:"]
  47914. }),
  47915. $globals.CodeGeneratorTest);
  47916. $core.addMethod(
  47917. $core.method({
  47918. selector: "testifNotNil",
  47919. protocol: "tests",
  47920. fn: function (){
  47921. var self=this,$self=this;
  47922. return $core.withContext(function($ctx1) {
  47923. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  47924. $ctx1.sendIdx["should:return:"]=1;
  47925. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  47926. $ctx1.sendIdx["should:return:"]=2;
  47927. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  47928. $ctx1.sendIdx["should:return:"]=3;
  47929. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  47930. return self;
  47931. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  47932. },
  47933. args: [],
  47934. source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.",
  47935. referencedClasses: [],
  47936. messageSends: ["should:return:"]
  47937. }),
  47938. $globals.CodeGeneratorTest);
  47939. $core.addMethod(
  47940. $core.method({
  47941. selector: "testifNotNilWithArgument",
  47942. protocol: "tests",
  47943. fn: function (){
  47944. var self=this,$self=this;
  47945. return $core.withContext(function($ctx1) {
  47946. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  47947. $ctx1.sendIdx["should:return:"]=1;
  47948. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  47949. $ctx1.sendIdx["should:return:"]=2;
  47950. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  47951. $ctx1.sendIdx["should:return:"]=3;
  47952. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  47953. $ctx1.sendIdx["should:return:"]=4;
  47954. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  47955. $ctx1.sendIdx["should:return:"]=5;
  47956. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  47957. return self;
  47958. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  47959. },
  47960. args: [],
  47961. source: "testifNotNilWithArgument\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5",
  47962. referencedClasses: [],
  47963. messageSends: ["should:return:"]
  47964. }),
  47965. $globals.CodeGeneratorTest);
  47966. $core.addMethod(
  47967. $core.method({
  47968. selector: "testifTrue",
  47969. protocol: "tests",
  47970. fn: function (){
  47971. var self=this,$self=this;
  47972. return $core.withContext(function($ctx1) {
  47973. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  47974. $ctx1.sendIdx["should:return:"]=1;
  47975. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  47976. $ctx1.sendIdx["should:return:"]=2;
  47977. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  47978. $ctx1.sendIdx["should:return:"]=3;
  47979. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  47980. return self;
  47981. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  47982. },
  47983. args: [],
  47984. source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.",
  47985. referencedClasses: [],
  47986. messageSends: ["should:return:"]
  47987. }),
  47988. $globals.CodeGeneratorTest);
  47989. $core.addMethod(
  47990. $core.method({
  47991. selector: "testifTrueIfFalse",
  47992. protocol: "tests",
  47993. fn: function (){
  47994. var self=this,$self=this;
  47995. return $core.withContext(function($ctx1) {
  47996. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  47997. $ctx1.sendIdx["should:return:"]=1;
  47998. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  47999. $ctx1.sendIdx["should:return:"]=2;
  48000. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  48001. $ctx1.sendIdx["should:return:"]=3;
  48002. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  48003. return self;
  48004. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  48005. },
  48006. args: [],
  48007. source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.",
  48008. referencedClasses: [],
  48009. messageSends: ["should:return:"]
  48010. }),
  48011. $globals.CodeGeneratorTest);
  48012. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  48013. $core.addMethod(
  48014. $core.method({
  48015. selector: "analyze:forClass:",
  48016. protocol: "parsing",
  48017. fn: function (aNode,aClass){
  48018. var self=this,$self=this;
  48019. return $core.withContext(function($ctx1) {
  48020. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  48021. return aNode;
  48022. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  48023. },
  48024. args: ["aNode", "aClass"],
  48025. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  48026. referencedClasses: ["SemanticAnalyzer"],
  48027. messageSends: ["visit:", "on:"]
  48028. }),
  48029. $globals.ASTInterpreterTest);
  48030. $core.addMethod(
  48031. $core.method({
  48032. selector: "interpret:receiver:withArguments:",
  48033. protocol: "private",
  48034. fn: function (aString,anObject,aDictionary){
  48035. var self=this,$self=this;
  48036. var ctx,ast,interpreter;
  48037. return $core.withContext(function($ctx1) {
  48038. var $1,$2,$3,$receiver;
  48039. interpreter=$recv($globals.ASTInterpreter)._new();
  48040. $ctx1.sendIdx["new"]=1;
  48041. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  48042. $1=$recv($globals.AIContext)._new();
  48043. $recv($1)._receiver_(anObject);
  48044. $recv($1)._interpreter_(interpreter);
  48045. ctx=$recv($1)._yourself();
  48046. $2=$recv(ast)._sequenceNode();
  48047. if(($receiver = $2) == null || $receiver.a$nil){
  48048. $2;
  48049. } else {
  48050. var sequence;
  48051. sequence=$receiver;
  48052. $recv($recv(sequence)._temps())._do_((function(each){
  48053. return $core.withContext(function($ctx2) {
  48054. return $recv(ctx)._defineLocal_(each);
  48055. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48056. }));
  48057. }
  48058. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  48059. return $core.withContext(function($ctx2) {
  48060. return $recv(ctx)._localAt_put_(key,value);
  48061. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  48062. }));
  48063. $3=interpreter;
  48064. $recv($3)._context_(ctx);
  48065. $recv($3)._node_(ast);
  48066. $recv($3)._enterNode();
  48067. $recv($3)._proceed();
  48068. return $recv($3)._result();
  48069. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  48070. },
  48071. args: ["aString", "anObject", "aDictionary"],
  48072. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  48073. referencedClasses: ["ASTInterpreter", "AIContext"],
  48074. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  48075. }),
  48076. $globals.ASTInterpreterTest);
  48077. $core.addMethod(
  48078. $core.method({
  48079. selector: "parse:",
  48080. protocol: "parsing",
  48081. fn: function (aString){
  48082. var self=this,$self=this;
  48083. return $core.withContext(function($ctx1) {
  48084. return $recv($globals.Smalltalk)._parse_(aString);
  48085. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  48086. },
  48087. args: ["aString"],
  48088. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  48089. referencedClasses: ["Smalltalk"],
  48090. messageSends: ["parse:"]
  48091. }),
  48092. $globals.ASTInterpreterTest);
  48093. $core.addMethod(
  48094. $core.method({
  48095. selector: "parse:forClass:",
  48096. protocol: "parsing",
  48097. fn: function (aString,aClass){
  48098. var self=this,$self=this;
  48099. return $core.withContext(function($ctx1) {
  48100. return $self._analyze_forClass_($self._parse_(aString),aClass);
  48101. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  48102. },
  48103. args: ["aString", "aClass"],
  48104. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  48105. referencedClasses: [],
  48106. messageSends: ["analyze:forClass:", "parse:"]
  48107. }),
  48108. $globals.ASTInterpreterTest);
  48109. $core.addMethod(
  48110. $core.method({
  48111. selector: "should:receiver:return:",
  48112. protocol: "testing",
  48113. fn: function (aString,anObject,aResult){
  48114. var self=this,$self=this;
  48115. return $core.withContext(function($ctx1) {
  48116. $self["@receiver"]=anObject;
  48117. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  48118. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  48119. },
  48120. args: ["aString", "anObject", "aResult"],
  48121. source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult",
  48122. referencedClasses: [],
  48123. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  48124. }),
  48125. $globals.ASTInterpreterTest);
  48126. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  48127. $core.addMethod(
  48128. $core.method({
  48129. selector: "interpret:receiver:withArguments:",
  48130. protocol: "private",
  48131. fn: function (aString,anObject,aDictionary){
  48132. var self=this,$self=this;
  48133. var ctx,ast,debugger_;
  48134. return $core.withContext(function($ctx1) {
  48135. var $1,$2,$3,$4,$5,$receiver;
  48136. $1=$recv($globals.AIContext)._new();
  48137. $ctx1.sendIdx["new"]=1;
  48138. $recv($1)._receiver_(anObject);
  48139. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  48140. ctx=$recv($1)._yourself();
  48141. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  48142. $2=$recv(ast)._sequenceNode();
  48143. if(($receiver = $2) == null || $receiver.a$nil){
  48144. $2;
  48145. } else {
  48146. var sequence;
  48147. sequence=$receiver;
  48148. $recv($recv(sequence)._temps())._do_((function(each){
  48149. return $core.withContext(function($ctx2) {
  48150. return $recv(ctx)._defineLocal_(each);
  48151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48152. }));
  48153. }
  48154. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  48155. return $core.withContext(function($ctx2) {
  48156. return $recv(ctx)._localAt_put_(key,value);
  48157. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  48158. }));
  48159. $3=$recv(ctx)._interpreter();
  48160. $ctx1.sendIdx["interpreter"]=1;
  48161. $recv($3)._context_(ctx);
  48162. $ctx1.sendIdx["context:"]=1;
  48163. $4=$recv(ctx)._interpreter();
  48164. $recv($4)._node_(ast);
  48165. $recv($4)._enterNode();
  48166. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  48167. $5=debugger_;
  48168. $recv($5)._proceed();
  48169. return $recv($5)._result();
  48170. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  48171. },
  48172. args: ["aString", "anObject", "aDictionary"],
  48173. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast; enterNode.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
  48174. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  48175. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  48176. }),
  48177. $globals.ASTDebuggerTest);
  48178. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  48179. $core.addMethod(
  48180. $core.method({
  48181. selector: "codeGeneratorClass",
  48182. protocol: "accessing",
  48183. fn: function (){
  48184. var self=this,$self=this;
  48185. return $globals.InliningCodeGenerator;
  48186. },
  48187. args: [],
  48188. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  48189. referencedClasses: ["InliningCodeGenerator"],
  48190. messageSends: []
  48191. }),
  48192. $globals.InliningCodeGeneratorTest);
  48193. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  48194. $core.addMethod(
  48195. $core.method({
  48196. selector: "testClassRefVar",
  48197. protocol: "tests",
  48198. fn: function (){
  48199. var self=this,$self=this;
  48200. var node;
  48201. return $core.withContext(function($ctx1) {
  48202. var $1,$2;
  48203. $1=$recv($globals.VariableNode)._new();
  48204. $ctx1.sendIdx["new"]=1;
  48205. $recv($1)._value_("Object");
  48206. node=$recv($1)._yourself();
  48207. $2=$recv($globals.SemanticAnalyzer)._new();
  48208. $ctx1.sendIdx["new"]=2;
  48209. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  48210. $recv($2)._visit_(node);
  48211. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  48212. return self;
  48213. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  48214. },
  48215. args: [],
  48216. source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar",
  48217. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  48218. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  48219. }),
  48220. $globals.ScopeVarTest);
  48221. $core.addMethod(
  48222. $core.method({
  48223. selector: "testInstanceVar",
  48224. protocol: "tests",
  48225. fn: function (){
  48226. var self=this,$self=this;
  48227. var node,scope;
  48228. return $core.withContext(function($ctx1) {
  48229. var $1;
  48230. $1=$recv($globals.VariableNode)._new();
  48231. $ctx1.sendIdx["new"]=1;
  48232. $recv($1)._value_("bzzz");
  48233. node=$recv($1)._yourself();
  48234. scope=$recv($globals.MethodLexicalScope)._new();
  48235. $recv(scope)._addIVar_("bzzz");
  48236. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  48237. return self;
  48238. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  48239. },
  48240. args: [],
  48241. source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
  48242. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48243. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  48244. }),
  48245. $globals.ScopeVarTest);
  48246. $core.addMethod(
  48247. $core.method({
  48248. selector: "testPseudoVar",
  48249. protocol: "tests",
  48250. fn: function (){
  48251. var self=this,$self=this;
  48252. var node,pseudoVars;
  48253. return $core.withContext(function($ctx1) {
  48254. var $1;
  48255. pseudoVars=["self", "super", "true", "false", "nil"];
  48256. $recv(pseudoVars)._do_((function(each){
  48257. return $core.withContext(function($ctx2) {
  48258. $1=$recv($globals.VariableNode)._new();
  48259. $ctx2.sendIdx["new"]=1;
  48260. $recv($1)._value_(each);
  48261. node=$recv($1)._yourself();
  48262. node;
  48263. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  48264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48265. }));
  48266. return self;
  48267. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  48268. },
  48269. args: [],
  48270. source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar]",
  48271. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48272. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  48273. }),
  48274. $globals.ScopeVarTest);
  48275. $core.addMethod(
  48276. $core.method({
  48277. selector: "testTempVar",
  48278. protocol: "tests",
  48279. fn: function (){
  48280. var self=this,$self=this;
  48281. var node,scope;
  48282. return $core.withContext(function($ctx1) {
  48283. var $1;
  48284. $1=$recv($globals.VariableNode)._new();
  48285. $ctx1.sendIdx["new"]=1;
  48286. $recv($1)._value_("bzzz");
  48287. node=$recv($1)._yourself();
  48288. scope=$recv($globals.MethodLexicalScope)._new();
  48289. $recv(scope)._addTemp_("bzzz");
  48290. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  48291. return self;
  48292. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  48293. },
  48294. args: [],
  48295. source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
  48296. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48297. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  48298. }),
  48299. $globals.ScopeVarTest);
  48300. $core.addMethod(
  48301. $core.method({
  48302. selector: "testUnknownVar",
  48303. protocol: "tests",
  48304. fn: function (){
  48305. var self=this,$self=this;
  48306. var node;
  48307. return $core.withContext(function($ctx1) {
  48308. var $1;
  48309. $1=$recv($globals.VariableNode)._new();
  48310. $ctx1.sendIdx["new"]=1;
  48311. $recv($1)._value_("bzzz");
  48312. node=$recv($1)._yourself();
  48313. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  48314. return self;
  48315. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  48316. },
  48317. args: [],
  48318. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  48319. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48320. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  48321. }),
  48322. $globals.ScopeVarTest);
  48323. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  48324. $core.addMethod(
  48325. $core.method({
  48326. selector: "setUp",
  48327. protocol: "running",
  48328. fn: function (){
  48329. var self=this,$self=this;
  48330. return $core.withContext(function($ctx1) {
  48331. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  48332. return self;
  48333. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  48334. },
  48335. args: [],
  48336. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  48337. referencedClasses: ["SemanticAnalyzer", "Object"],
  48338. messageSends: ["on:"]
  48339. }),
  48340. $globals.SemanticAnalyzerTest);
  48341. $core.addMethod(
  48342. $core.method({
  48343. selector: "testAssignment",
  48344. protocol: "tests",
  48345. fn: function (){
  48346. var self=this,$self=this;
  48347. var src,ast;
  48348. return $core.withContext(function($ctx1) {
  48349. src="foo self := 1";
  48350. ast=$recv($globals.Smalltalk)._parse_(src);
  48351. $self._should_raise_((function(){
  48352. return $core.withContext(function($ctx2) {
  48353. return $recv($self["@analyzer"])._visit_(ast);
  48354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48355. }),$globals.InvalidAssignmentError);
  48356. return self;
  48357. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48358. },
  48359. args: [],
  48360. source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
  48361. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  48362. messageSends: ["parse:", "should:raise:", "visit:"]
  48363. }),
  48364. $globals.SemanticAnalyzerTest);
  48365. $core.addMethod(
  48366. $core.method({
  48367. selector: "testNonLocalReturn",
  48368. protocol: "tests",
  48369. fn: function (){
  48370. var self=this,$self=this;
  48371. var src,ast;
  48372. return $core.withContext(function($ctx1) {
  48373. src="foo | a | a + 1. ^ a";
  48374. ast=$recv($globals.Smalltalk)._parse_(src);
  48375. $recv($self["@analyzer"])._visit_(ast);
  48376. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  48377. return self;
  48378. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48379. },
  48380. args: [],
  48381. source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
  48382. referencedClasses: ["Smalltalk"],
  48383. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  48384. }),
  48385. $globals.SemanticAnalyzerTest);
  48386. $core.addMethod(
  48387. $core.method({
  48388. selector: "testNonLocalReturn2",
  48389. protocol: "tests",
  48390. fn: function (){
  48391. var self=this,$self=this;
  48392. var src,ast;
  48393. return $core.withContext(function($ctx1) {
  48394. src="foo | a | a + 1. [ [ ^ a] ]";
  48395. ast=$recv($globals.Smalltalk)._parse_(src);
  48396. $recv($self["@analyzer"])._visit_(ast);
  48397. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  48398. return self;
  48399. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48400. },
  48401. args: [],
  48402. source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
  48403. referencedClasses: ["Smalltalk"],
  48404. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  48405. }),
  48406. $globals.SemanticAnalyzerTest);
  48407. $core.addMethod(
  48408. $core.method({
  48409. selector: "testScope",
  48410. protocol: "tests",
  48411. fn: function (){
  48412. var self=this,$self=this;
  48413. var src,ast;
  48414. return $core.withContext(function($ctx1) {
  48415. var $4,$3,$2,$1;
  48416. src="foo | a | a + 1. [ | b | b := a ]";
  48417. ast=$recv($globals.Smalltalk)._parse_(src);
  48418. $recv($self["@analyzer"])._visit_(ast);
  48419. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48420. $ctx1.sendIdx["dagChildren"]=1;
  48421. $3=$recv($4)._last();
  48422. $2=$recv($3)._scope();
  48423. $ctx1.sendIdx["scope"]=1;
  48424. $1=$recv($2).__eq_eq($recv(ast)._scope());
  48425. $self._deny_($1);
  48426. return self;
  48427. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48428. },
  48429. args: [],
  48430. source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast dagChildren first dagChildren last scope == ast scope.",
  48431. referencedClasses: ["Smalltalk"],
  48432. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  48433. }),
  48434. $globals.SemanticAnalyzerTest);
  48435. $core.addMethod(
  48436. $core.method({
  48437. selector: "testScope2",
  48438. protocol: "tests",
  48439. fn: function (){
  48440. var self=this,$self=this;
  48441. var src,ast;
  48442. return $core.withContext(function($ctx1) {
  48443. var $8,$7,$6,$5,$4,$3,$2,$1;
  48444. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  48445. ast=$recv($globals.Smalltalk)._parse_(src);
  48446. $recv($self["@analyzer"])._visit_(ast);
  48447. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48448. $ctx1.sendIdx["dagChildren"]=3;
  48449. $7=$recv($8)._last();
  48450. $6=$recv($7)._dagChildren();
  48451. $ctx1.sendIdx["dagChildren"]=2;
  48452. $5=$recv($6)._first();
  48453. $ctx1.sendIdx["first"]=2;
  48454. $4=$recv($5)._dagChildren();
  48455. $ctx1.sendIdx["dagChildren"]=1;
  48456. $3=$recv($4)._first();
  48457. $ctx1.sendIdx["first"]=1;
  48458. $2=$recv($3)._scope();
  48459. $ctx1.sendIdx["scope"]=1;
  48460. $1=$recv($2).__eq_eq($recv(ast)._scope());
  48461. $self._deny_($1);
  48462. return self;
  48463. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48464. },
  48465. args: [],
  48466. source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast dagChildren first dagChildren last dagChildren first dagChildren first scope == ast scope.",
  48467. referencedClasses: ["Smalltalk"],
  48468. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  48469. }),
  48470. $globals.SemanticAnalyzerTest);
  48471. $core.addMethod(
  48472. $core.method({
  48473. selector: "testScopeLevel",
  48474. protocol: "tests",
  48475. fn: function (){
  48476. var self=this,$self=this;
  48477. var src,ast;
  48478. return $core.withContext(function($ctx1) {
  48479. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  48480. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  48481. ast=$recv($globals.Smalltalk)._parse_(src);
  48482. $recv($self["@analyzer"])._visit_(ast);
  48483. $2=$recv(ast)._scope();
  48484. $ctx1.sendIdx["scope"]=1;
  48485. $1=$recv($2)._scopeLevel();
  48486. $ctx1.sendIdx["scopeLevel"]=1;
  48487. $self._assert_equals_($1,(1));
  48488. $ctx1.sendIdx["assert:equals:"]=1;
  48489. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48490. $ctx1.sendIdx["dagChildren"]=3;
  48491. $9=$recv($10)._last();
  48492. $8=$recv($9)._dagChildren();
  48493. $ctx1.sendIdx["dagChildren"]=2;
  48494. $7=$recv($8)._first();
  48495. $ctx1.sendIdx["first"]=2;
  48496. $6=$recv($7)._dagChildren();
  48497. $ctx1.sendIdx["dagChildren"]=1;
  48498. $5=$recv($6)._first();
  48499. $ctx1.sendIdx["first"]=1;
  48500. $4=$recv($5)._scope();
  48501. $3=$recv($4)._scopeLevel();
  48502. $self._assert_equals_($3,(3));
  48503. return self;
  48504. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48505. },
  48506. args: [],
  48507. source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first scope scopeLevel equals: 3",
  48508. referencedClasses: ["Smalltalk"],
  48509. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  48510. }),
  48511. $globals.SemanticAnalyzerTest);
  48512. $core.addMethod(
  48513. $core.method({
  48514. selector: "testUnknownVariables",
  48515. protocol: "tests",
  48516. fn: function (){
  48517. var self=this,$self=this;
  48518. var src,ast;
  48519. return $core.withContext(function($ctx1) {
  48520. src="foo | a | b + a";
  48521. ast=$recv($globals.Smalltalk)._parse_(src);
  48522. $self._should_raise_((function(){
  48523. return $core.withContext(function($ctx2) {
  48524. return $recv($self["@analyzer"])._visit_(ast);
  48525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48526. }),$globals.UnknownVariableError);
  48527. return self;
  48528. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48529. },
  48530. args: [],
  48531. source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  48532. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48533. messageSends: ["parse:", "should:raise:", "visit:"]
  48534. }),
  48535. $globals.SemanticAnalyzerTest);
  48536. $core.addMethod(
  48537. $core.method({
  48538. selector: "testUnknownVariablesWithScope",
  48539. protocol: "tests",
  48540. fn: function (){
  48541. var self=this,$self=this;
  48542. var src,ast;
  48543. return $core.withContext(function($ctx1) {
  48544. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  48545. ast=$recv($globals.Smalltalk)._parse_(src);
  48546. $self._should_raise_((function(){
  48547. return $core.withContext(function($ctx2) {
  48548. return $recv($self["@analyzer"])._visit_(ast);
  48549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48550. }),$globals.UnknownVariableError);
  48551. return self;
  48552. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48553. },
  48554. args: [],
  48555. source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  48556. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48557. messageSends: ["parse:", "should:raise:", "visit:"]
  48558. }),
  48559. $globals.SemanticAnalyzerTest);
  48560. $core.addMethod(
  48561. $core.method({
  48562. selector: "testVariableShadowing",
  48563. protocol: "tests",
  48564. fn: function (){
  48565. var self=this,$self=this;
  48566. var src,ast;
  48567. return $core.withContext(function($ctx1) {
  48568. src="foo | a | a + 1";
  48569. ast=$recv($globals.Smalltalk)._parse_(src);
  48570. $recv($self["@analyzer"])._visit_(ast);
  48571. return self;
  48572. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48573. },
  48574. args: [],
  48575. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  48576. referencedClasses: ["Smalltalk"],
  48577. messageSends: ["parse:", "visit:"]
  48578. }),
  48579. $globals.SemanticAnalyzerTest);
  48580. $core.addMethod(
  48581. $core.method({
  48582. selector: "testVariableShadowing2",
  48583. protocol: "tests",
  48584. fn: function (){
  48585. var self=this,$self=this;
  48586. var src,ast;
  48587. return $core.withContext(function($ctx1) {
  48588. src="foo | a | a + 1. [ | a | a := 2 ]";
  48589. ast=$recv($globals.Smalltalk)._parse_(src);
  48590. $self._should_raise_((function(){
  48591. return $core.withContext(function($ctx2) {
  48592. return $recv($self["@analyzer"])._visit_(ast);
  48593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48594. }),$globals.ShadowingVariableError);
  48595. return self;
  48596. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48597. },
  48598. args: [],
  48599. source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  48600. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  48601. messageSends: ["parse:", "should:raise:", "visit:"]
  48602. }),
  48603. $globals.SemanticAnalyzerTest);
  48604. $core.addMethod(
  48605. $core.method({
  48606. selector: "testVariableShadowing3",
  48607. protocol: "tests",
  48608. fn: function (){
  48609. var self=this,$self=this;
  48610. var src,ast;
  48611. return $core.withContext(function($ctx1) {
  48612. src="foo | a | a + 1. [ | b | b := 2 ]";
  48613. ast=$recv($globals.Smalltalk)._parse_(src);
  48614. $recv($self["@analyzer"])._visit_(ast);
  48615. return self;
  48616. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48617. },
  48618. args: [],
  48619. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  48620. referencedClasses: ["Smalltalk"],
  48621. messageSends: ["parse:", "visit:"]
  48622. }),
  48623. $globals.SemanticAnalyzerTest);
  48624. $core.addMethod(
  48625. $core.method({
  48626. selector: "testVariableShadowing4",
  48627. protocol: "tests",
  48628. fn: function (){
  48629. var self=this,$self=this;
  48630. var src,ast;
  48631. return $core.withContext(function($ctx1) {
  48632. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  48633. ast=$recv($globals.Smalltalk)._parse_(src);
  48634. $recv($self["@analyzer"])._visit_(ast);
  48635. return self;
  48636. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48637. },
  48638. args: [],
  48639. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  48640. referencedClasses: ["Smalltalk"],
  48641. messageSends: ["parse:", "visit:"]
  48642. }),
  48643. $globals.SemanticAnalyzerTest);
  48644. $core.addMethod(
  48645. $core.method({
  48646. selector: "testVariableShadowing5",
  48647. protocol: "tests",
  48648. fn: function (){
  48649. var self=this,$self=this;
  48650. var src,ast;
  48651. return $core.withContext(function($ctx1) {
  48652. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  48653. ast=$recv($globals.Smalltalk)._parse_(src);
  48654. $self._should_raise_((function(){
  48655. return $core.withContext(function($ctx2) {
  48656. return $recv($self["@analyzer"])._visit_(ast);
  48657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48658. }),$globals.ShadowingVariableError);
  48659. return self;
  48660. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48661. },
  48662. args: [],
  48663. source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  48664. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  48665. messageSends: ["parse:", "should:raise:", "visit:"]
  48666. }),
  48667. $globals.SemanticAnalyzerTest);
  48668. $core.addMethod(
  48669. $core.method({
  48670. selector: "testVariablesLookup",
  48671. protocol: "tests",
  48672. fn: function (){
  48673. var self=this,$self=this;
  48674. var src,ast;
  48675. return $core.withContext(function($ctx1) {
  48676. var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28;
  48677. src="foo | a | a + 1. [ | b | b := a ]";
  48678. ast=$recv($globals.Smalltalk)._parse_(src);
  48679. $recv($self["@analyzer"])._visit_(ast);
  48680. $7=$recv(ast)._dagChildren();
  48681. $ctx1.sendIdx["dagChildren"]=2;
  48682. $6=$recv($7)._first();
  48683. $ctx1.sendIdx["first"]=2;
  48684. $5=$recv($6)._dagChildren();
  48685. $ctx1.sendIdx["dagChildren"]=1;
  48686. $4=$recv($5)._first();
  48687. $ctx1.sendIdx["first"]=1;
  48688. $3=$recv($4)._receiver();
  48689. $ctx1.sendIdx["receiver"]=1;
  48690. $2=$recv($3)._binding();
  48691. $ctx1.sendIdx["binding"]=1;
  48692. $1=$recv($2)._isTempVar();
  48693. $ctx1.sendIdx["isTempVar"]=1;
  48694. $self._assert_($1);
  48695. $ctx1.sendIdx["assert:"]=1;
  48696. $15=$recv(ast)._dagChildren();
  48697. $ctx1.sendIdx["dagChildren"]=4;
  48698. $14=$recv($15)._first();
  48699. $ctx1.sendIdx["first"]=4;
  48700. $13=$recv($14)._dagChildren();
  48701. $ctx1.sendIdx["dagChildren"]=3;
  48702. $12=$recv($13)._first();
  48703. $ctx1.sendIdx["first"]=3;
  48704. $11=$recv($12)._receiver();
  48705. $10=$recv($11)._binding();
  48706. $ctx1.sendIdx["binding"]=2;
  48707. $9=$recv($10)._scope();
  48708. $ctx1.sendIdx["scope"]=1;
  48709. $16=$recv(ast)._scope();
  48710. $ctx1.sendIdx["scope"]=2;
  48711. $8=$recv($9).__eq_eq($16);
  48712. $ctx1.sendIdx["=="]=1;
  48713. $self._assert_($8);
  48714. $ctx1.sendIdx["assert:"]=2;
  48715. $27=$recv(ast)._dagChildren();
  48716. $ctx1.sendIdx["dagChildren"]=8;
  48717. $26=$recv($27)._first();
  48718. $ctx1.sendIdx["first"]=7;
  48719. $25=$recv($26)._dagChildren();
  48720. $ctx1.sendIdx["dagChildren"]=7;
  48721. $24=$recv($25)._last();
  48722. $ctx1.sendIdx["last"]=1;
  48723. $23=$recv($24)._dagChildren();
  48724. $ctx1.sendIdx["dagChildren"]=6;
  48725. $22=$recv($23)._first();
  48726. $ctx1.sendIdx["first"]=6;
  48727. $21=$recv($22)._dagChildren();
  48728. $ctx1.sendIdx["dagChildren"]=5;
  48729. $20=$recv($21)._first();
  48730. $ctx1.sendIdx["first"]=5;
  48731. $19=$recv($20)._left();
  48732. $ctx1.sendIdx["left"]=1;
  48733. $18=$recv($19)._binding();
  48734. $ctx1.sendIdx["binding"]=3;
  48735. $17=$recv($18)._isTempVar();
  48736. $self._assert_($17);
  48737. $ctx1.sendIdx["assert:"]=3;
  48738. $39=$recv(ast)._dagChildren();
  48739. $ctx1.sendIdx["dagChildren"]=12;
  48740. $38=$recv($39)._first();
  48741. $ctx1.sendIdx["first"]=10;
  48742. $37=$recv($38)._dagChildren();
  48743. $ctx1.sendIdx["dagChildren"]=11;
  48744. $36=$recv($37)._last();
  48745. $ctx1.sendIdx["last"]=2;
  48746. $35=$recv($36)._dagChildren();
  48747. $ctx1.sendIdx["dagChildren"]=10;
  48748. $34=$recv($35)._first();
  48749. $ctx1.sendIdx["first"]=9;
  48750. $33=$recv($34)._dagChildren();
  48751. $ctx1.sendIdx["dagChildren"]=9;
  48752. $32=$recv($33)._first();
  48753. $ctx1.sendIdx["first"]=8;
  48754. $31=$recv($32)._left();
  48755. $30=$recv($31)._binding();
  48756. $29=$recv($30)._scope();
  48757. $ctx1.sendIdx["scope"]=3;
  48758. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48759. $ctx1.sendIdx["dagChildren"]=13;
  48760. $41=$recv($42)._last();
  48761. $40=$recv($41)._scope();
  48762. $28=$recv($29).__eq_eq($40);
  48763. $self._assert_($28);
  48764. return self;
  48765. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48766. },
  48767. args: [],
  48768. source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast dagChildren first dagChildren first receiver binding isTempVar.\x0a\x09self assert: ast dagChildren first dagChildren first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first left binding isTempVar.\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first left binding scope == ast dagChildren first dagChildren last scope.",
  48769. referencedClasses: ["Smalltalk"],
  48770. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  48771. }),
  48772. $globals.SemanticAnalyzerTest);
  48773. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  48774. $core.addMethod(
  48775. $core.method({
  48776. selector: "setUp",
  48777. protocol: "running",
  48778. fn: function (){
  48779. var self=this,$self=this;
  48780. return $core.withContext(function($ctx1) {
  48781. var $1,$3,$4,$2;
  48782. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  48783. $3=$recv($globals.AIContext)._new();
  48784. $recv($3)._defineLocal_("local");
  48785. $recv($3)._localAt_put_("local",(3));
  48786. $4=$recv($3)._yourself();
  48787. $ctx1.sendIdx["yourself"]=1;
  48788. $2=$4;
  48789. $recv($1)._context_($2);
  48790. $self["@analyzer"]=$recv($1)._yourself();
  48791. return self;
  48792. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  48793. },
  48794. args: [],
  48795. source: "setUp\x0a\x09analyzer := (AISemanticAnalyzer on: Object)\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09defineLocal: 'local';\x0a\x09\x09\x09localAt: 'local' put: 3;\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  48796. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  48797. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  48798. }),
  48799. $globals.AISemanticAnalyzerTest);
  48800. $core.addMethod(
  48801. $core.method({
  48802. selector: "testContextVariables",
  48803. protocol: "tests",
  48804. fn: function (){
  48805. var self=this,$self=this;
  48806. var src,ast;
  48807. return $core.withContext(function($ctx1) {
  48808. src="foo | a | local + a";
  48809. ast=$recv($globals.Smalltalk)._parse_(src);
  48810. $self._shouldnt_raise_((function(){
  48811. return $core.withContext(function($ctx2) {
  48812. return $recv($self["@analyzer"])._visit_(ast);
  48813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48814. }),$globals.UnknownVariableError);
  48815. return self;
  48816. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  48817. },
  48818. args: [],
  48819. source: "testContextVariables\x0a\x09| src ast |\x0a\x09\x0a\x09src := 'foo | a | local + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self shouldnt: [ analyzer visit: ast ] raise: UnknownVariableError",
  48820. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48821. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  48822. }),
  48823. $globals.AISemanticAnalyzerTest);
  48824. });
  48825. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  48826. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  48827. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48828. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48829. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  48830. $core.addPackage("Kernel-Tests");
  48831. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  48832. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48833. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  48834. $core.addMethod(
  48835. $core.method({
  48836. selector: "testAddExtensionMethod",
  48837. protocol: "tests",
  48838. fn: function (){
  48839. var self=this,$self=this;
  48840. var method,dirty;
  48841. return $core.withContext(function($ctx1) {
  48842. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  48843. $2=$self._class();
  48844. $ctx1.sendIdx["class"]=1;
  48845. $1=$recv($2)._package();
  48846. $ctx1.sendIdx["package"]=1;
  48847. dirty=$recv($1)._isDirty();
  48848. $ctx1.sendIdx["isDirty"]=1;
  48849. $4=$self._class();
  48850. $ctx1.sendIdx["class"]=2;
  48851. $3=$recv($4)._package();
  48852. $ctx1.sendIdx["package"]=2;
  48853. $recv($3)._beClean();
  48854. $5=$self._class();
  48855. $ctx1.sendIdx["class"]=3;
  48856. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  48857. $8=$self._class();
  48858. $ctx1.sendIdx["class"]=4;
  48859. $7=$recv($8)._package();
  48860. $ctx1.sendIdx["package"]=3;
  48861. $6=$recv($7)._isDirty();
  48862. $self._deny_($6);
  48863. $9=$self._class();
  48864. $ctx1.sendIdx["class"]=5;
  48865. $recv($9)._removeCompiledMethod_(method);
  48866. $10=dirty;
  48867. if($core.assert($10)){
  48868. $recv($recv($self._class())._package())._beDirty();
  48869. }
  48870. return self;
  48871. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  48872. },
  48873. args: [],
  48874. source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]",
  48875. referencedClasses: [],
  48876. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  48877. }),
  48878. $globals.AnnouncementSubscriptionTest);
  48879. $core.addMethod(
  48880. $core.method({
  48881. selector: "testHandlesAnnouncement",
  48882. protocol: "tests",
  48883. fn: function (){
  48884. var self=this,$self=this;
  48885. var subscription,announcementClass1,announcementClass2,classBuilder;
  48886. return $core.withContext(function($ctx1) {
  48887. var $1,$2;
  48888. classBuilder=$recv($globals.ClassBuilder)._new();
  48889. $ctx1.sendIdx["new"]=1;
  48890. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  48891. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  48892. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  48893. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  48894. $self._assert_equals_($1,true);
  48895. $ctx1.sendIdx["assert:equals:"]=1;
  48896. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  48897. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  48898. $self._assert_equals_($2,true);
  48899. $ctx1.sendIdx["assert:equals:"]=2;
  48900. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  48901. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  48902. return self;
  48903. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  48904. },
  48905. args: [],
  48906. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  48907. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  48908. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  48909. }),
  48910. $globals.AnnouncementSubscriptionTest);
  48911. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  48912. $core.addMethod(
  48913. $core.method({
  48914. selector: "testOnDo",
  48915. protocol: "tests",
  48916. fn: function (){
  48917. var self=this,$self=this;
  48918. var counter,announcer;
  48919. return $core.withContext(function($ctx1) {
  48920. var $1,$2;
  48921. counter=(0);
  48922. announcer=$recv($globals.Announcer)._new();
  48923. $ctx1.sendIdx["new"]=1;
  48924. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  48925. return $core.withContext(function($ctx2) {
  48926. counter=$recv(counter).__plus((1));
  48927. return counter;
  48928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48929. }));
  48930. $1=announcer;
  48931. $2=$recv($globals.SystemAnnouncement)._new();
  48932. $ctx1.sendIdx["new"]=2;
  48933. $recv($1)._announce_($2);
  48934. $ctx1.sendIdx["announce:"]=1;
  48935. $self._assert_equals_(counter,(1));
  48936. $ctx1.sendIdx["assert:equals:"]=1;
  48937. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  48938. $self._assert_equals_(counter,(2));
  48939. return self;
  48940. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48941. },
  48942. args: [],
  48943. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  48944. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48945. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  48946. }),
  48947. $globals.AnnouncerTest);
  48948. $core.addMethod(
  48949. $core.method({
  48950. selector: "testOnDoFor",
  48951. protocol: "tests",
  48952. fn: function (){
  48953. var self=this,$self=this;
  48954. var counter,announcer;
  48955. return $core.withContext(function($ctx1) {
  48956. var $1,$2,$3,$4;
  48957. counter=(0);
  48958. announcer=$recv($globals.Announcer)._new();
  48959. $ctx1.sendIdx["new"]=1;
  48960. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  48961. return $core.withContext(function($ctx2) {
  48962. counter=$recv(counter).__plus((1));
  48963. return counter;
  48964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48965. }),self);
  48966. $1=announcer;
  48967. $2=$recv($globals.SystemAnnouncement)._new();
  48968. $ctx1.sendIdx["new"]=2;
  48969. $recv($1)._announce_($2);
  48970. $ctx1.sendIdx["announce:"]=1;
  48971. $self._assert_equals_(counter,(1));
  48972. $ctx1.sendIdx["assert:equals:"]=1;
  48973. $3=announcer;
  48974. $4=$recv($globals.SystemAnnouncement)._new();
  48975. $ctx1.sendIdx["new"]=3;
  48976. $recv($3)._announce_($4);
  48977. $ctx1.sendIdx["announce:"]=2;
  48978. $self._assert_equals_(counter,(2));
  48979. $ctx1.sendIdx["assert:equals:"]=2;
  48980. $recv(announcer)._unsubscribe_(self);
  48981. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  48982. $self._assert_equals_(counter,(2));
  48983. return self;
  48984. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48985. },
  48986. args: [],
  48987. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  48988. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48989. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  48990. }),
  48991. $globals.AnnouncerTest);
  48992. $core.addMethod(
  48993. $core.method({
  48994. selector: "testOnDoOnce",
  48995. protocol: "tests",
  48996. fn: function (){
  48997. var self=this,$self=this;
  48998. var counter,announcer;
  48999. return $core.withContext(function($ctx1) {
  49000. var $1,$2;
  49001. counter=(0);
  49002. announcer=$recv($globals.Announcer)._new();
  49003. $ctx1.sendIdx["new"]=1;
  49004. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  49005. return $core.withContext(function($ctx2) {
  49006. counter=$recv(counter).__plus((1));
  49007. return counter;
  49008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49009. }));
  49010. $1=announcer;
  49011. $2=$recv($globals.SystemAnnouncement)._new();
  49012. $ctx1.sendIdx["new"]=2;
  49013. $recv($1)._announce_($2);
  49014. $ctx1.sendIdx["announce:"]=1;
  49015. $self._assert_equals_(counter,(1));
  49016. $ctx1.sendIdx["assert:equals:"]=1;
  49017. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  49018. $self._assert_equals_(counter,(1));
  49019. return self;
  49020. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  49021. },
  49022. args: [],
  49023. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  49024. referencedClasses: ["Announcer", "SystemAnnouncement"],
  49025. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  49026. }),
  49027. $globals.AnnouncerTest);
  49028. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  49029. $core.addMethod(
  49030. $core.method({
  49031. selector: "localReturnOnDoCatch",
  49032. protocol: "fixture",
  49033. fn: function (){
  49034. var self=this,$self=this;
  49035. return $core.withContext(function($ctx1) {
  49036. var $early={};
  49037. try {
  49038. $recv((function(){
  49039. throw $early=[(2)];
  49040. }))._on_do_($globals.Error,(function(){
  49041. }));
  49042. return (3);
  49043. }
  49044. catch(e) {if(e===$early)return e[0]; throw e}
  49045. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  49046. },
  49047. args: [],
  49048. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  49049. referencedClasses: ["Error"],
  49050. messageSends: ["on:do:"]
  49051. }),
  49052. $globals.BlockClosureTest);
  49053. $core.addMethod(
  49054. $core.method({
  49055. selector: "localReturnOnDoMiss",
  49056. protocol: "fixture",
  49057. fn: function (){
  49058. var self=this,$self=this;
  49059. return $core.withContext(function($ctx1) {
  49060. var $early={};
  49061. try {
  49062. $recv((function(){
  49063. throw $early=[(2)];
  49064. }))._on_do_($globals.Class,(function(){
  49065. }));
  49066. return (3);
  49067. }
  49068. catch(e) {if(e===$early)return e[0]; throw e}
  49069. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  49070. },
  49071. args: [],
  49072. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  49073. referencedClasses: ["Class"],
  49074. messageSends: ["on:do:"]
  49075. }),
  49076. $globals.BlockClosureTest);
  49077. $core.addMethod(
  49078. $core.method({
  49079. selector: "testCanClearInterval",
  49080. protocol: "tests",
  49081. fn: function (){
  49082. var self=this,$self=this;
  49083. return $core.withContext(function($ctx1) {
  49084. $self._shouldnt_raise_((function(){
  49085. return $core.withContext(function($ctx2) {
  49086. return $recv($recv((function(){
  49087. return $core.withContext(function($ctx3) {
  49088. return $recv($recv($globals.Error)._new())._signal();
  49089. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49090. }))._valueWithInterval_((0)))._clearInterval();
  49091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49092. }),$globals.Error);
  49093. return self;
  49094. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  49095. },
  49096. args: [],
  49097. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  49098. referencedClasses: ["Error"],
  49099. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  49100. }),
  49101. $globals.BlockClosureTest);
  49102. $core.addMethod(
  49103. $core.method({
  49104. selector: "testCanClearTimeout",
  49105. protocol: "tests",
  49106. fn: function (){
  49107. var self=this,$self=this;
  49108. return $core.withContext(function($ctx1) {
  49109. $self._shouldnt_raise_((function(){
  49110. return $core.withContext(function($ctx2) {
  49111. return $recv($recv((function(){
  49112. return $core.withContext(function($ctx3) {
  49113. return $recv($recv($globals.Error)._new())._signal();
  49114. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49115. }))._valueWithTimeout_((0)))._clearTimeout();
  49116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49117. }),$globals.Error);
  49118. return self;
  49119. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  49120. },
  49121. args: [],
  49122. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  49123. referencedClasses: ["Error"],
  49124. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  49125. }),
  49126. $globals.BlockClosureTest);
  49127. $core.addMethod(
  49128. $core.method({
  49129. selector: "testCompiledSource",
  49130. protocol: "tests",
  49131. fn: function (){
  49132. var self=this,$self=this;
  49133. return $core.withContext(function($ctx1) {
  49134. $self._assert_($recv($recv((function(){
  49135. return $core.withContext(function($ctx2) {
  49136. return (1).__plus((1));
  49137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49138. }))._compiledSource())._includesSubString_("function"));
  49139. return self;
  49140. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  49141. },
  49142. args: [],
  49143. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  49144. referencedClasses: [],
  49145. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  49146. }),
  49147. $globals.BlockClosureTest);
  49148. $core.addMethod(
  49149. $core.method({
  49150. selector: "testCurrySelf",
  49151. protocol: "tests",
  49152. fn: function (){
  49153. var self=this,$self=this;
  49154. var curriedMethod,array;
  49155. return $core.withContext(function($ctx1) {
  49156. curriedMethod=$recv($recv((function(selfarg,x){
  49157. return $core.withContext(function($ctx2) {
  49158. return $recv(selfarg)._at_(x);
  49159. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  49160. }))._currySelf())._asCompiledMethod_("foo:");
  49161. array=[(3), (1), (4)];
  49162. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  49163. $recv((function(){
  49164. return $core.withContext(function($ctx2) {
  49165. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  49166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49167. }))._ensure_((function(){
  49168. return $core.withContext(function($ctx2) {
  49169. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  49170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49171. }));
  49172. return self;
  49173. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  49174. },
  49175. args: [],
  49176. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  49177. referencedClasses: ["ClassBuilder", "Array"],
  49178. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  49179. }),
  49180. $globals.BlockClosureTest);
  49181. $core.addMethod(
  49182. $core.method({
  49183. selector: "testEnsure",
  49184. protocol: "tests",
  49185. fn: function (){
  49186. var self=this,$self=this;
  49187. return $core.withContext(function($ctx1) {
  49188. $self._assert_equals_($recv((function(){
  49189. return (3);
  49190. }))._ensure_((function(){
  49191. return (4);
  49192. })),(3));
  49193. return self;
  49194. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  49195. },
  49196. args: [],
  49197. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  49198. referencedClasses: [],
  49199. messageSends: ["assert:equals:", "ensure:"]
  49200. }),
  49201. $globals.BlockClosureTest);
  49202. $core.addMethod(
  49203. $core.method({
  49204. selector: "testEnsureRaises",
  49205. protocol: "tests",
  49206. fn: function (){
  49207. var self=this,$self=this;
  49208. return $core.withContext(function($ctx1) {
  49209. $self._should_raise_((function(){
  49210. return $core.withContext(function($ctx2) {
  49211. return $recv((function(){
  49212. return $core.withContext(function($ctx3) {
  49213. return $recv($recv($globals.Error)._new())._signal();
  49214. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49215. }))._ensure_((function(){
  49216. return true;
  49217. }));
  49218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49219. }),$globals.Error);
  49220. return self;
  49221. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  49222. },
  49223. args: [],
  49224. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  49225. referencedClasses: ["Error"],
  49226. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  49227. }),
  49228. $globals.BlockClosureTest);
  49229. $core.addMethod(
  49230. $core.method({
  49231. selector: "testExceptionSemantics",
  49232. protocol: "tests",
  49233. fn: function (){
  49234. var self=this,$self=this;
  49235. return $core.withContext(function($ctx1) {
  49236. $self._timeout_((100));
  49237. $recv($self._async_((function(){
  49238. return $core.withContext(function($ctx2) {
  49239. return $recv((function(){
  49240. return $core.withContext(function($ctx3) {
  49241. $self._assert_(true);
  49242. $recv($globals.Error)._signal();
  49243. $self._deny_(true);
  49244. return $self._finished();
  49245. $ctx3.sendIdx["finished"]=1;
  49246. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49247. }))._on_do_($globals.Error,(function(ex){
  49248. return $core.withContext(function($ctx3) {
  49249. return $self._finished();
  49250. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  49251. }));
  49252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49253. })))._valueWithTimeout_((0));
  49254. return self;
  49255. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  49256. },
  49257. args: [],
  49258. source: "testExceptionSemantics\x0a\x09\x22See https://lolg.it/amber/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  49259. referencedClasses: ["Error"],
  49260. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  49261. }),
  49262. $globals.BlockClosureTest);
  49263. $core.addMethod(
  49264. $core.method({
  49265. selector: "testLocalReturnOnDoCatch",
  49266. protocol: "tests",
  49267. fn: function (){
  49268. var self=this,$self=this;
  49269. return $core.withContext(function($ctx1) {
  49270. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  49271. return self;
  49272. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  49273. },
  49274. args: [],
  49275. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  49276. referencedClasses: [],
  49277. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  49278. }),
  49279. $globals.BlockClosureTest);
  49280. $core.addMethod(
  49281. $core.method({
  49282. selector: "testLocalReturnOnDoMiss",
  49283. protocol: "tests",
  49284. fn: function (){
  49285. var self=this,$self=this;
  49286. return $core.withContext(function($ctx1) {
  49287. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  49288. return self;
  49289. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  49290. },
  49291. args: [],
  49292. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  49293. referencedClasses: [],
  49294. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  49295. }),
  49296. $globals.BlockClosureTest);
  49297. $core.addMethod(
  49298. $core.method({
  49299. selector: "testNewWithValues",
  49300. protocol: "tests",
  49301. fn: function (){
  49302. var self=this,$self=this;
  49303. return $core.withContext(function($ctx1) {
  49304. function TestConstructor(arg1, arg2, arg3) {}
  49305. TestConstructor.prototype.name = "theTestPrototype";
  49306. var wrappedConstructor = $recv(TestConstructor);
  49307. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  49308. $self._assert_(result instanceof TestConstructor);
  49309. $self._assert_equals_(result.name, "theTestPrototype");
  49310. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  49311. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  49312. return self;
  49313. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  49314. },
  49315. args: [],
  49316. source: "testNewWithValues\x0a<inlineJS: '\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = \x22theTestPrototype\x22;\x0a\x0a\x09var wrappedConstructor = $recv(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3]);\x0a\x09$self._assert_(result instanceof TestConstructor);\x0a\x09$self._assert_equals_(result.name, \x22theTestPrototype\x22);\x0a\x0a\x09/* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */\x0a\x09$self._should_raise_(function () {wrappedConstructor._newWithValues_(\x22single argument\x22);}, $globals.Error);\x0a'>",
  49317. referencedClasses: [],
  49318. messageSends: []
  49319. }),
  49320. $globals.BlockClosureTest);
  49321. $core.addMethod(
  49322. $core.method({
  49323. selector: "testNumArgs",
  49324. protocol: "tests",
  49325. fn: function (){
  49326. var self=this,$self=this;
  49327. return $core.withContext(function($ctx1) {
  49328. var $1;
  49329. $1=$recv((function(){
  49330. }))._numArgs();
  49331. $ctx1.sendIdx["numArgs"]=1;
  49332. $self._assert_equals_($1,(0));
  49333. $ctx1.sendIdx["assert:equals:"]=1;
  49334. $self._assert_equals_($recv((function(a,b){
  49335. }))._numArgs(),(2));
  49336. return self;
  49337. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  49338. },
  49339. args: [],
  49340. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  49341. referencedClasses: [],
  49342. messageSends: ["assert:equals:", "numArgs"]
  49343. }),
  49344. $globals.BlockClosureTest);
  49345. $core.addMethod(
  49346. $core.method({
  49347. selector: "testOnDo",
  49348. protocol: "tests",
  49349. fn: function (){
  49350. var self=this,$self=this;
  49351. return $core.withContext(function($ctx1) {
  49352. $self._assert_($recv((function(){
  49353. return $core.withContext(function($ctx2) {
  49354. return $recv($recv($globals.Error)._new())._signal();
  49355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49356. }))._on_do_($globals.Error,(function(ex){
  49357. return true;
  49358. })));
  49359. return self;
  49360. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  49361. },
  49362. args: [],
  49363. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  49364. referencedClasses: ["Error"],
  49365. messageSends: ["assert:", "on:do:", "signal", "new"]
  49366. }),
  49367. $globals.BlockClosureTest);
  49368. $core.addMethod(
  49369. $core.method({
  49370. selector: "testValue",
  49371. protocol: "tests",
  49372. fn: function (){
  49373. var self=this,$self=this;
  49374. return $core.withContext(function($ctx1) {
  49375. var $1;
  49376. $1=$recv((function(){
  49377. return $core.withContext(function($ctx2) {
  49378. return (1).__plus((1));
  49379. $ctx2.sendIdx["+"]=1;
  49380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49381. }))._value();
  49382. $ctx1.sendIdx["value"]=1;
  49383. $self._assert_equals_($1,(2));
  49384. $ctx1.sendIdx["assert:equals:"]=1;
  49385. $self._assert_equals_($recv((function(x){
  49386. return $core.withContext(function($ctx2) {
  49387. return $recv(x).__plus((1));
  49388. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  49389. }))._value_((2)),(3));
  49390. $ctx1.sendIdx["assert:equals:"]=2;
  49391. $self._assert_equals_($recv((function(x,y){
  49392. return $core.withContext(function($ctx2) {
  49393. return $recv(x).__star(y);
  49394. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  49395. }))._value_value_((2),(4)),(8));
  49396. $ctx1.sendIdx["assert:equals:"]=3;
  49397. $self._assert_equals_($recv((function(a,b,c){
  49398. return (1);
  49399. }))._value(),(1));
  49400. return self;
  49401. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  49402. },
  49403. args: [],
  49404. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  49405. referencedClasses: [],
  49406. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  49407. }),
  49408. $globals.BlockClosureTest);
  49409. $core.addMethod(
  49410. $core.method({
  49411. selector: "testValueWithPossibleArguments",
  49412. protocol: "tests",
  49413. fn: function (){
  49414. var self=this,$self=this;
  49415. return $core.withContext(function($ctx1) {
  49416. var $1,$2;
  49417. $1=$recv((function(){
  49418. return (1);
  49419. }))._valueWithPossibleArguments_([(3), (4)]);
  49420. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  49421. $self._assert_equals_($1,(1));
  49422. $ctx1.sendIdx["assert:equals:"]=1;
  49423. $2=$recv((function(a){
  49424. return $core.withContext(function($ctx2) {
  49425. return $recv(a).__plus((4));
  49426. $ctx2.sendIdx["+"]=1;
  49427. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  49428. }))._valueWithPossibleArguments_([(3), (4)]);
  49429. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  49430. $self._assert_equals_($2,(7));
  49431. $ctx1.sendIdx["assert:equals:"]=2;
  49432. $self._assert_equals_($recv((function(a,b){
  49433. return $core.withContext(function($ctx2) {
  49434. return $recv(a).__plus(b);
  49435. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  49436. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  49437. return self;
  49438. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  49439. },
  49440. args: [],
  49441. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  49442. referencedClasses: [],
  49443. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  49444. }),
  49445. $globals.BlockClosureTest);
  49446. $core.addMethod(
  49447. $core.method({
  49448. selector: "testWhileFalse",
  49449. protocol: "tests",
  49450. fn: function (){
  49451. var self=this,$self=this;
  49452. var i;
  49453. return $core.withContext(function($ctx1) {
  49454. i=(0);
  49455. $recv((function(){
  49456. return $core.withContext(function($ctx2) {
  49457. return $recv(i).__gt((5));
  49458. $ctx2.sendIdx[">"]=1;
  49459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49460. }))._whileFalse_((function(){
  49461. return $core.withContext(function($ctx2) {
  49462. i=$recv(i).__plus((1));
  49463. $ctx2.sendIdx["+"]=1;
  49464. return i;
  49465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49466. }));
  49467. $self._assert_equals_(i,(6));
  49468. $ctx1.sendIdx["assert:equals:"]=1;
  49469. i=(0);
  49470. $recv((function(){
  49471. return $core.withContext(function($ctx2) {
  49472. i=$recv(i).__plus((1));
  49473. i;
  49474. return $recv(i).__gt((5));
  49475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49476. }))._whileFalse();
  49477. $self._assert_equals_(i,(6));
  49478. return self;
  49479. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  49480. },
  49481. args: [],
  49482. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  49483. referencedClasses: [],
  49484. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  49485. }),
  49486. $globals.BlockClosureTest);
  49487. $core.addMethod(
  49488. $core.method({
  49489. selector: "testWhileTrue",
  49490. protocol: "tests",
  49491. fn: function (){
  49492. var self=this,$self=this;
  49493. var i;
  49494. return $core.withContext(function($ctx1) {
  49495. i=(0);
  49496. $recv((function(){
  49497. return $core.withContext(function($ctx2) {
  49498. return $recv(i).__lt((5));
  49499. $ctx2.sendIdx["<"]=1;
  49500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49501. }))._whileTrue_((function(){
  49502. return $core.withContext(function($ctx2) {
  49503. i=$recv(i).__plus((1));
  49504. $ctx2.sendIdx["+"]=1;
  49505. return i;
  49506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49507. }));
  49508. $self._assert_equals_(i,(5));
  49509. $ctx1.sendIdx["assert:equals:"]=1;
  49510. i=(0);
  49511. $recv((function(){
  49512. return $core.withContext(function($ctx2) {
  49513. i=$recv(i).__plus((1));
  49514. i;
  49515. return $recv(i).__lt((5));
  49516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49517. }))._whileTrue();
  49518. $self._assert_equals_(i,(5));
  49519. return self;
  49520. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  49521. },
  49522. args: [],
  49523. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  49524. referencedClasses: [],
  49525. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  49526. }),
  49527. $globals.BlockClosureTest);
  49528. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  49529. $core.addMethod(
  49530. $core.method({
  49531. selector: "testEquality",
  49532. protocol: "tests",
  49533. fn: function (){
  49534. var self=this,$self=this;
  49535. return $core.withContext(function($ctx1) {
  49536. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  49537. $1=(0).__eq(false);
  49538. $ctx1.sendIdx["="]=1;
  49539. $self._deny_($1);
  49540. $ctx1.sendIdx["deny:"]=1;
  49541. $2=false.__eq((0));
  49542. $ctx1.sendIdx["="]=2;
  49543. $self._deny_($2);
  49544. $ctx1.sendIdx["deny:"]=2;
  49545. $3="".__eq(false);
  49546. $ctx1.sendIdx["="]=3;
  49547. $self._deny_($3);
  49548. $ctx1.sendIdx["deny:"]=3;
  49549. $4=false.__eq("");
  49550. $ctx1.sendIdx["="]=4;
  49551. $self._deny_($4);
  49552. $ctx1.sendIdx["deny:"]=4;
  49553. $5=true.__eq(true);
  49554. $ctx1.sendIdx["="]=5;
  49555. $self._assert_($5);
  49556. $ctx1.sendIdx["assert:"]=1;
  49557. $6=false.__eq(true);
  49558. $ctx1.sendIdx["="]=6;
  49559. $self._deny_($6);
  49560. $ctx1.sendIdx["deny:"]=5;
  49561. $7=true.__eq(false);
  49562. $ctx1.sendIdx["="]=7;
  49563. $self._deny_($7);
  49564. $8=false.__eq(false);
  49565. $ctx1.sendIdx["="]=8;
  49566. $self._assert_($8);
  49567. $ctx1.sendIdx["assert:"]=2;
  49568. $10=true._yourself();
  49569. $ctx1.sendIdx["yourself"]=1;
  49570. $9=$recv($10).__eq(true);
  49571. $ctx1.sendIdx["="]=9;
  49572. $self._assert_($9);
  49573. $ctx1.sendIdx["assert:"]=3;
  49574. $12=true._yourself();
  49575. $ctx1.sendIdx["yourself"]=2;
  49576. $11=$recv($12).__eq(true._yourself());
  49577. $self._assert_($11);
  49578. return self;
  49579. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  49580. },
  49581. args: [],
  49582. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  49583. referencedClasses: [],
  49584. messageSends: ["deny:", "=", "assert:", "yourself"]
  49585. }),
  49586. $globals.BooleanTest);
  49587. $core.addMethod(
  49588. $core.method({
  49589. selector: "testIdentity",
  49590. protocol: "tests",
  49591. fn: function (){
  49592. var self=this,$self=this;
  49593. return $core.withContext(function($ctx1) {
  49594. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  49595. $1=(0).__eq_eq(false);
  49596. $ctx1.sendIdx["=="]=1;
  49597. $self._deny_($1);
  49598. $ctx1.sendIdx["deny:"]=1;
  49599. $2=false.__eq_eq((0));
  49600. $ctx1.sendIdx["=="]=2;
  49601. $self._deny_($2);
  49602. $ctx1.sendIdx["deny:"]=2;
  49603. $3="".__eq_eq(false);
  49604. $ctx1.sendIdx["=="]=3;
  49605. $self._deny_($3);
  49606. $ctx1.sendIdx["deny:"]=3;
  49607. $4=false.__eq_eq("");
  49608. $ctx1.sendIdx["=="]=4;
  49609. $self._deny_($4);
  49610. $ctx1.sendIdx["deny:"]=4;
  49611. $5=true.__eq_eq(true);
  49612. $ctx1.sendIdx["=="]=5;
  49613. $self._assert_($5);
  49614. $ctx1.sendIdx["assert:"]=1;
  49615. $6=false.__eq_eq(true);
  49616. $ctx1.sendIdx["=="]=6;
  49617. $self._deny_($6);
  49618. $ctx1.sendIdx["deny:"]=5;
  49619. $7=true.__eq_eq(false);
  49620. $ctx1.sendIdx["=="]=7;
  49621. $self._deny_($7);
  49622. $8=false.__eq_eq(false);
  49623. $ctx1.sendIdx["=="]=8;
  49624. $self._assert_($8);
  49625. $ctx1.sendIdx["assert:"]=2;
  49626. $10=true._yourself();
  49627. $ctx1.sendIdx["yourself"]=1;
  49628. $9=$recv($10).__eq_eq(true);
  49629. $ctx1.sendIdx["=="]=9;
  49630. $self._assert_($9);
  49631. $ctx1.sendIdx["assert:"]=3;
  49632. $12=true._yourself();
  49633. $ctx1.sendIdx["yourself"]=2;
  49634. $11=$recv($12).__eq_eq(true._yourself());
  49635. $self._assert_($11);
  49636. return self;
  49637. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  49638. },
  49639. args: [],
  49640. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  49641. referencedClasses: [],
  49642. messageSends: ["deny:", "==", "assert:", "yourself"]
  49643. }),
  49644. $globals.BooleanTest);
  49645. $core.addMethod(
  49646. $core.method({
  49647. selector: "testIfTrueIfFalse",
  49648. protocol: "tests",
  49649. fn: function (){
  49650. var self=this,$self=this;
  49651. return $core.withContext(function($ctx1) {
  49652. var $1,$2,$3,$4,$5,$6,$7,$8;
  49653. if($core.assert(true)){
  49654. $1="alternative block";
  49655. }
  49656. $self._assert_equals_($1,"alternative block");
  49657. $ctx1.sendIdx["assert:equals:"]=1;
  49658. if(!$core.assert(true)){
  49659. $2="alternative block";
  49660. }
  49661. $self._assert_equals_($2,nil);
  49662. $ctx1.sendIdx["assert:equals:"]=2;
  49663. if($core.assert(false)){
  49664. $3="alternative block";
  49665. }
  49666. $self._assert_equals_($3,nil);
  49667. $ctx1.sendIdx["assert:equals:"]=3;
  49668. if(!$core.assert(false)){
  49669. $4="alternative block";
  49670. }
  49671. $self._assert_equals_($4,"alternative block");
  49672. $ctx1.sendIdx["assert:equals:"]=4;
  49673. if($core.assert(false)){
  49674. $5="alternative block";
  49675. } else {
  49676. $5="alternative block2";
  49677. }
  49678. $self._assert_equals_($5,"alternative block2");
  49679. $ctx1.sendIdx["assert:equals:"]=5;
  49680. if($core.assert(false)){
  49681. $6="alternative block2";
  49682. } else {
  49683. $6="alternative block";
  49684. }
  49685. $self._assert_equals_($6,"alternative block");
  49686. $ctx1.sendIdx["assert:equals:"]=6;
  49687. if($core.assert(true)){
  49688. $7="alternative block";
  49689. } else {
  49690. $7="alternative block2";
  49691. }
  49692. $self._assert_equals_($7,"alternative block");
  49693. $ctx1.sendIdx["assert:equals:"]=7;
  49694. if($core.assert(true)){
  49695. $8="alternative block2";
  49696. } else {
  49697. $8="alternative block";
  49698. }
  49699. $self._assert_equals_($8,"alternative block2");
  49700. return self;
  49701. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  49702. },
  49703. args: [],
  49704. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  49705. referencedClasses: [],
  49706. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49707. }),
  49708. $globals.BooleanTest);
  49709. $core.addMethod(
  49710. $core.method({
  49711. selector: "testIfTrueIfFalseWithBoxing",
  49712. protocol: "tests",
  49713. fn: function (){
  49714. var self=this,$self=this;
  49715. return $core.withContext(function($ctx1) {
  49716. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  49717. $2=true._yourself();
  49718. $ctx1.sendIdx["yourself"]=1;
  49719. if($core.assert($2)){
  49720. $1="alternative block";
  49721. }
  49722. $self._assert_equals_($1,"alternative block");
  49723. $ctx1.sendIdx["assert:equals:"]=1;
  49724. $4=true._yourself();
  49725. $ctx1.sendIdx["yourself"]=2;
  49726. if(!$core.assert($4)){
  49727. $3="alternative block";
  49728. }
  49729. $self._assert_equals_($3,nil);
  49730. $ctx1.sendIdx["assert:equals:"]=2;
  49731. $6=false._yourself();
  49732. $ctx1.sendIdx["yourself"]=3;
  49733. if($core.assert($6)){
  49734. $5="alternative block";
  49735. }
  49736. $self._assert_equals_($5,nil);
  49737. $ctx1.sendIdx["assert:equals:"]=3;
  49738. $8=false._yourself();
  49739. $ctx1.sendIdx["yourself"]=4;
  49740. if(!$core.assert($8)){
  49741. $7="alternative block";
  49742. }
  49743. $self._assert_equals_($7,"alternative block");
  49744. $ctx1.sendIdx["assert:equals:"]=4;
  49745. $10=false._yourself();
  49746. $ctx1.sendIdx["yourself"]=5;
  49747. if($core.assert($10)){
  49748. $9="alternative block";
  49749. } else {
  49750. $9="alternative block2";
  49751. }
  49752. $self._assert_equals_($9,"alternative block2");
  49753. $ctx1.sendIdx["assert:equals:"]=5;
  49754. $12=false._yourself();
  49755. $ctx1.sendIdx["yourself"]=6;
  49756. if($core.assert($12)){
  49757. $11="alternative block2";
  49758. } else {
  49759. $11="alternative block";
  49760. }
  49761. $self._assert_equals_($11,"alternative block");
  49762. $ctx1.sendIdx["assert:equals:"]=6;
  49763. $14=true._yourself();
  49764. $ctx1.sendIdx["yourself"]=7;
  49765. if($core.assert($14)){
  49766. $13="alternative block";
  49767. } else {
  49768. $13="alternative block2";
  49769. }
  49770. $self._assert_equals_($13,"alternative block");
  49771. $ctx1.sendIdx["assert:equals:"]=7;
  49772. $16=true._yourself();
  49773. if($core.assert($16)){
  49774. $15="alternative block2";
  49775. } else {
  49776. $15="alternative block";
  49777. }
  49778. $self._assert_equals_($15,"alternative block2");
  49779. return self;
  49780. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  49781. },
  49782. args: [],
  49783. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  49784. referencedClasses: [],
  49785. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49786. }),
  49787. $globals.BooleanTest);
  49788. $core.addMethod(
  49789. $core.method({
  49790. selector: "testLogic",
  49791. protocol: "tests",
  49792. fn: function (){
  49793. var self=this,$self=this;
  49794. return $core.withContext(function($ctx1) {
  49795. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  49796. $1=true.__and(true);
  49797. $ctx1.sendIdx["&"]=1;
  49798. $self._assert_($1);
  49799. $ctx1.sendIdx["assert:"]=1;
  49800. $2=true.__and(false);
  49801. $ctx1.sendIdx["&"]=2;
  49802. $self._deny_($2);
  49803. $ctx1.sendIdx["deny:"]=1;
  49804. $3=false.__and(true);
  49805. $ctx1.sendIdx["&"]=3;
  49806. $self._deny_($3);
  49807. $ctx1.sendIdx["deny:"]=2;
  49808. $5=false.__and(false);
  49809. $ctx1.sendIdx["&"]=4;
  49810. $4=$self._deny_($5);
  49811. $ctx1.sendIdx["deny:"]=3;
  49812. $6=true.__or(true);
  49813. $ctx1.sendIdx["|"]=1;
  49814. $self._assert_($6);
  49815. $ctx1.sendIdx["assert:"]=2;
  49816. $7=true.__or(false);
  49817. $ctx1.sendIdx["|"]=2;
  49818. $self._assert_($7);
  49819. $ctx1.sendIdx["assert:"]=3;
  49820. $8=false.__or(true);
  49821. $ctx1.sendIdx["|"]=3;
  49822. $self._assert_($8);
  49823. $ctx1.sendIdx["assert:"]=4;
  49824. $10=false.__or(false);
  49825. $ctx1.sendIdx["|"]=4;
  49826. $9=$self._deny_($10);
  49827. $ctx1.sendIdx["deny:"]=4;
  49828. $12=(1).__gt((0));
  49829. $ctx1.sendIdx[">"]=1;
  49830. $11=true.__and($12);
  49831. $ctx1.sendIdx["&"]=5;
  49832. $self._assert_($11);
  49833. $ctx1.sendIdx["assert:"]=5;
  49834. $14=(1).__gt((0));
  49835. $ctx1.sendIdx[">"]=2;
  49836. $13=$recv($14).__and(false);
  49837. $ctx1.sendIdx["&"]=6;
  49838. $self._deny_($13);
  49839. $ctx1.sendIdx["deny:"]=5;
  49840. $16=(1).__gt((0));
  49841. $ctx1.sendIdx[">"]=3;
  49842. $17=(1).__gt((2));
  49843. $ctx1.sendIdx[">"]=4;
  49844. $15=$recv($16).__and($17);
  49845. $self._deny_($15);
  49846. $19=(1).__gt((0));
  49847. $ctx1.sendIdx[">"]=5;
  49848. $18=false.__or($19);
  49849. $ctx1.sendIdx["|"]=5;
  49850. $self._assert_($18);
  49851. $ctx1.sendIdx["assert:"]=6;
  49852. $21=(1).__gt((0));
  49853. $ctx1.sendIdx[">"]=6;
  49854. $20=$recv($21).__or(false);
  49855. $ctx1.sendIdx["|"]=6;
  49856. $self._assert_($20);
  49857. $ctx1.sendIdx["assert:"]=7;
  49858. $23=(1).__gt((0));
  49859. $ctx1.sendIdx[">"]=7;
  49860. $22=$recv($23).__or((1).__gt((2)));
  49861. $self._assert_($22);
  49862. return self;
  49863. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  49864. },
  49865. args: [],
  49866. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  49867. referencedClasses: [],
  49868. messageSends: ["assert:", "&", "deny:", "|", ">"]
  49869. }),
  49870. $globals.BooleanTest);
  49871. $core.addMethod(
  49872. $core.method({
  49873. selector: "testLogicKeywords",
  49874. protocol: "tests",
  49875. fn: function (){
  49876. var self=this,$self=this;
  49877. return $core.withContext(function($ctx1) {
  49878. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  49879. $1=true._and_((function(){
  49880. return true;
  49881. }));
  49882. $ctx1.sendIdx["and:"]=1;
  49883. $self._assert_($1);
  49884. $ctx1.sendIdx["assert:"]=1;
  49885. $2=true._and_((function(){
  49886. return false;
  49887. }));
  49888. $ctx1.sendIdx["and:"]=2;
  49889. $self._deny_($2);
  49890. $ctx1.sendIdx["deny:"]=1;
  49891. $3=false._and_((function(){
  49892. return true;
  49893. }));
  49894. $ctx1.sendIdx["and:"]=3;
  49895. $self._deny_($3);
  49896. $ctx1.sendIdx["deny:"]=2;
  49897. $5=false._and_((function(){
  49898. return false;
  49899. }));
  49900. $ctx1.sendIdx["and:"]=4;
  49901. $4=$self._deny_($5);
  49902. $ctx1.sendIdx["deny:"]=3;
  49903. $6=true._or_((function(){
  49904. return true;
  49905. }));
  49906. $ctx1.sendIdx["or:"]=1;
  49907. $self._assert_($6);
  49908. $ctx1.sendIdx["assert:"]=2;
  49909. $7=true._or_((function(){
  49910. return false;
  49911. }));
  49912. $ctx1.sendIdx["or:"]=2;
  49913. $self._assert_($7);
  49914. $ctx1.sendIdx["assert:"]=3;
  49915. $8=false._or_((function(){
  49916. return true;
  49917. }));
  49918. $ctx1.sendIdx["or:"]=3;
  49919. $self._assert_($8);
  49920. $ctx1.sendIdx["assert:"]=4;
  49921. $10=false._or_((function(){
  49922. return false;
  49923. }));
  49924. $ctx1.sendIdx["or:"]=4;
  49925. $9=$self._deny_($10);
  49926. $ctx1.sendIdx["deny:"]=4;
  49927. $11=true._and_((function(){
  49928. return $core.withContext(function($ctx2) {
  49929. return (1).__gt((0));
  49930. $ctx2.sendIdx[">"]=1;
  49931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  49932. }));
  49933. $ctx1.sendIdx["and:"]=5;
  49934. $self._assert_($11);
  49935. $ctx1.sendIdx["assert:"]=5;
  49936. $13=(1).__gt((0));
  49937. $ctx1.sendIdx[">"]=2;
  49938. $12=$recv($13)._and_((function(){
  49939. return false;
  49940. }));
  49941. $ctx1.sendIdx["and:"]=6;
  49942. $self._deny_($12);
  49943. $ctx1.sendIdx["deny:"]=5;
  49944. $15=(1).__gt((0));
  49945. $ctx1.sendIdx[">"]=3;
  49946. $14=$recv($15)._and_((function(){
  49947. return $core.withContext(function($ctx2) {
  49948. return (1).__gt((2));
  49949. $ctx2.sendIdx[">"]=4;
  49950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  49951. }));
  49952. $self._deny_($14);
  49953. $16=false._or_((function(){
  49954. return $core.withContext(function($ctx2) {
  49955. return (1).__gt((0));
  49956. $ctx2.sendIdx[">"]=5;
  49957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  49958. }));
  49959. $ctx1.sendIdx["or:"]=5;
  49960. $self._assert_($16);
  49961. $ctx1.sendIdx["assert:"]=6;
  49962. $18=(1).__gt((0));
  49963. $ctx1.sendIdx[">"]=6;
  49964. $17=$recv($18)._or_((function(){
  49965. return false;
  49966. }));
  49967. $ctx1.sendIdx["or:"]=6;
  49968. $self._assert_($17);
  49969. $ctx1.sendIdx["assert:"]=7;
  49970. $20=(1).__gt((0));
  49971. $ctx1.sendIdx[">"]=7;
  49972. $19=$recv($20)._or_((function(){
  49973. return $core.withContext(function($ctx2) {
  49974. return (1).__gt((2));
  49975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  49976. }));
  49977. $self._assert_($19);
  49978. return self;
  49979. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  49980. },
  49981. args: [],
  49982. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  49983. referencedClasses: [],
  49984. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  49985. }),
  49986. $globals.BooleanTest);
  49987. $core.addMethod(
  49988. $core.method({
  49989. selector: "testNonBooleanError",
  49990. protocol: "tests",
  49991. fn: function (){
  49992. var self=this,$self=this;
  49993. return $core.withContext(function($ctx1) {
  49994. $self._should_raise_((function(){
  49995. return $core.withContext(function($ctx2) {
  49996. if($core.assert("")){
  49997. } else {
  49998. }
  49999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50000. }),$globals.NonBooleanReceiver);
  50001. return self;
  50002. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  50003. },
  50004. args: [],
  50005. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  50006. referencedClasses: ["NonBooleanReceiver"],
  50007. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  50008. }),
  50009. $globals.BooleanTest);
  50010. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  50011. $core.addMethod(
  50012. $core.method({
  50013. selector: "setUp",
  50014. protocol: "running",
  50015. fn: function (){
  50016. var self=this,$self=this;
  50017. return $core.withContext(function($ctx1) {
  50018. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  50019. return self;
  50020. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  50021. },
  50022. args: [],
  50023. source: "setUp\x0a\x09builder := ClassBuilder new",
  50024. referencedClasses: ["ClassBuilder"],
  50025. messageSends: ["new"]
  50026. }),
  50027. $globals.ClassBuilderTest);
  50028. $core.addMethod(
  50029. $core.method({
  50030. selector: "tearDown",
  50031. protocol: "running",
  50032. fn: function (){
  50033. var self=this,$self=this;
  50034. return $core.withContext(function($ctx1) {
  50035. var $1,$receiver;
  50036. $1=$self["@theClass"];
  50037. if(($receiver = $1) == null || $receiver.a$nil){
  50038. $1;
  50039. } else {
  50040. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  50041. $self["@theClass"]=nil;
  50042. $self["@theClass"];
  50043. }
  50044. return self;
  50045. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  50046. },
  50047. args: [],
  50048. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  50049. referencedClasses: ["Smalltalk"],
  50050. messageSends: ["ifNotNil:", "removeClass:"]
  50051. }),
  50052. $globals.ClassBuilderTest);
  50053. $core.addMethod(
  50054. $core.method({
  50055. selector: "testClassCopy",
  50056. protocol: "tests",
  50057. fn: function (){
  50058. var self=this,$self=this;
  50059. return $core.withContext(function($ctx1) {
  50060. var $2,$1,$4,$3,$6,$5,$8,$7;
  50061. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50062. $2=$recv($self["@theClass"])._superclass();
  50063. $ctx1.sendIdx["superclass"]=1;
  50064. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  50065. $ctx1.sendIdx["=="]=1;
  50066. $self._assert_($1);
  50067. $ctx1.sendIdx["assert:"]=1;
  50068. $4=$recv($self["@theClass"])._instanceVariableNames();
  50069. $ctx1.sendIdx["instanceVariableNames"]=1;
  50070. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  50071. $ctx1.sendIdx["=="]=2;
  50072. $self._assert_($3);
  50073. $ctx1.sendIdx["assert:"]=2;
  50074. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  50075. $ctx1.sendIdx["assert:equals:"]=1;
  50076. $6=$recv($self["@theClass"])._package();
  50077. $ctx1.sendIdx["package"]=1;
  50078. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  50079. $self._assert_($5);
  50080. $8=$recv($self["@theClass"])._methodDictionary();
  50081. $ctx1.sendIdx["methodDictionary"]=1;
  50082. $7=$recv($8)._keys();
  50083. $ctx1.sendIdx["keys"]=1;
  50084. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  50085. return self;
  50086. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  50087. },
  50088. args: [],
  50089. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  50090. referencedClasses: ["ObjectMock"],
  50091. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  50092. }),
  50093. $globals.ClassBuilderTest);
  50094. $core.addMethod(
  50095. $core.method({
  50096. selector: "testClassMigration",
  50097. protocol: "tests",
  50098. fn: function (){
  50099. var self=this,$self=this;
  50100. var instance,oldClass;
  50101. return $core.withContext(function($ctx1) {
  50102. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  50103. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50104. $2=$recv($globals.Smalltalk)._globals();
  50105. $ctx1.sendIdx["globals"]=1;
  50106. $1=$recv($2)._at_("ObjectMock2");
  50107. $ctx1.sendIdx["at:"]=1;
  50108. instance=$recv($1)._new();
  50109. $4=$recv($globals.Smalltalk)._globals();
  50110. $ctx1.sendIdx["globals"]=2;
  50111. $3=$recv($4)._at_("ObjectMock2");
  50112. $ctx1.sendIdx["at:"]=2;
  50113. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  50114. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  50115. $ctx1.sendIdx["=="]=1;
  50116. $self._deny_($5);
  50117. $ctx1.sendIdx["deny:"]=1;
  50118. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  50119. $ctx1.sendIdx["=="]=2;
  50120. $self._assert_($6);
  50121. $ctx1.sendIdx["assert:"]=1;
  50122. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  50123. $ctx1.sendIdx["assert:"]=2;
  50124. $7=$recv($globals.ObjectMock2)._selectors();
  50125. $ctx1.sendIdx["selectors"]=1;
  50126. $self._assert_equals_($7,$recv(oldClass)._selectors());
  50127. $ctx1.sendIdx["assert:equals:"]=1;
  50128. $8=$recv($globals.ObjectMock2)._comment();
  50129. $ctx1.sendIdx["comment"]=1;
  50130. $self._assert_equals_($8,$recv(oldClass)._comment());
  50131. $ctx1.sendIdx["assert:equals:"]=2;
  50132. $9=$recv($recv($globals.ObjectMock2)._package())._name();
  50133. $ctx1.sendIdx["name"]=1;
  50134. $self._assert_equals_($9,"Kernel-Tests");
  50135. $11=$recv(instance)._class();
  50136. $ctx1.sendIdx["class"]=1;
  50137. $10=$recv($11).__eq_eq($globals.ObjectMock2);
  50138. $self._deny_($10);
  50139. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  50140. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  50141. return self;
  50142. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  50143. },
  50144. args: [],
  50145. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  50146. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  50147. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  50148. }),
  50149. $globals.ClassBuilderTest);
  50150. $core.addMethod(
  50151. $core.method({
  50152. selector: "testClassMigrationWithClassInstanceVariables",
  50153. protocol: "tests",
  50154. fn: function (){
  50155. var self=this,$self=this;
  50156. return $core.withContext(function($ctx1) {
  50157. var $1;
  50158. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50159. $1=$recv($globals.ObjectMock2)._class();
  50160. $ctx1.sendIdx["class"]=1;
  50161. $recv($1)._instanceVariableNames_("foo bar");
  50162. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  50163. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  50164. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  50165. return self;
  50166. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  50167. },
  50168. args: [],
  50169. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  50170. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  50171. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  50172. }),
  50173. $globals.ClassBuilderTest);
  50174. $core.addMethod(
  50175. $core.method({
  50176. selector: "testClassMigrationWithSubclasses",
  50177. protocol: "tests",
  50178. fn: function (){
  50179. var self=this,$self=this;
  50180. return $core.withContext(function($ctx1) {
  50181. var $2,$1,$4,$3;
  50182. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50183. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  50184. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  50185. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  50186. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  50187. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  50188. $2=$recv($globals.ObjectMock)._subclasses();
  50189. $ctx1.sendIdx["subclasses"]=1;
  50190. $1=$recv($2)._includes_($globals.ObjectMock2);
  50191. $ctx1.sendIdx["includes:"]=1;
  50192. $self._assert_($1);
  50193. $ctx1.sendIdx["assert:"]=1;
  50194. $4=$recv($globals.ObjectMock2)._subclasses();
  50195. $ctx1.sendIdx["subclasses"]=2;
  50196. $3=$recv($4)._includes_($globals.ObjectMock3);
  50197. $ctx1.sendIdx["includes:"]=2;
  50198. $self._assert_($3);
  50199. $ctx1.sendIdx["assert:"]=2;
  50200. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  50201. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  50202. return $core.withContext(function($ctx2) {
  50203. return $recv($globals.Smalltalk)._removeClass_(each);
  50204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50205. }));
  50206. return self;
  50207. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  50208. },
  50209. args: [],
  50210. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ]",
  50211. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  50212. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  50213. }),
  50214. $globals.ClassBuilderTest);
  50215. $core.addMethod(
  50216. $core.method({
  50217. selector: "testInstanceVariableNames",
  50218. protocol: "tests",
  50219. fn: function (){
  50220. var self=this,$self=this;
  50221. return $core.withContext(function($ctx1) {
  50222. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  50223. return self;
  50224. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  50225. },
  50226. args: [],
  50227. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  50228. referencedClasses: [],
  50229. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  50230. }),
  50231. $globals.ClassBuilderTest);
  50232. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  50233. $core.addMethod(
  50234. $core.method({
  50235. selector: "jsConstructor",
  50236. protocol: "running",
  50237. fn: function (){
  50238. var self=this,$self=this;
  50239. return $core.withContext(function($ctx1) {
  50240. function Foo(){}
  50241. Foo.prototype.valueOf = function () {return 4;};
  50242. return Foo;
  50243. ;
  50244. return self;
  50245. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  50246. },
  50247. args: [],
  50248. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  50249. referencedClasses: [],
  50250. messageSends: []
  50251. }),
  50252. $globals.ClassTest);
  50253. $core.addMethod(
  50254. $core.method({
  50255. selector: "setUp",
  50256. protocol: "running",
  50257. fn: function (){
  50258. var self=this,$self=this;
  50259. return $core.withContext(function($ctx1) {
  50260. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  50261. return self;
  50262. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  50263. },
  50264. args: [],
  50265. source: "setUp\x0a\x09builder := ClassBuilder new",
  50266. referencedClasses: ["ClassBuilder"],
  50267. messageSends: ["new"]
  50268. }),
  50269. $globals.ClassTest);
  50270. $core.addMethod(
  50271. $core.method({
  50272. selector: "tearDown",
  50273. protocol: "running",
  50274. fn: function (){
  50275. var self=this,$self=this;
  50276. return $core.withContext(function($ctx1) {
  50277. var $1,$receiver;
  50278. $1=$self["@theClass"];
  50279. if(($receiver = $1) == null || $receiver.a$nil){
  50280. $1;
  50281. } else {
  50282. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  50283. return $core.withContext(function($ctx2) {
  50284. return $recv($globals.Smalltalk)._removeClass_(each);
  50285. $ctx2.sendIdx["removeClass:"]=1;
  50286. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50287. }));
  50288. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  50289. $self["@theClass"]=nil;
  50290. $self["@theClass"];
  50291. }
  50292. return self;
  50293. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  50294. },
  50295. args: [],
  50296. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  50297. referencedClasses: ["Smalltalk"],
  50298. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  50299. }),
  50300. $globals.ClassTest);
  50301. $core.addMethod(
  50302. $core.method({
  50303. selector: "testAllSubclasses",
  50304. protocol: "tests",
  50305. fn: function (){
  50306. var self=this,$self=this;
  50307. var subclasses,index;
  50308. return $core.withContext(function($ctx1) {
  50309. subclasses=$recv($globals.Object)._subclasses();
  50310. $ctx1.sendIdx["subclasses"]=1;
  50311. index=(1);
  50312. $recv((function(){
  50313. return $core.withContext(function($ctx2) {
  50314. return $recv(index).__gt($recv(subclasses)._size());
  50315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50316. }))._whileFalse_((function(){
  50317. return $core.withContext(function($ctx2) {
  50318. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  50319. index=$recv(index).__plus((1));
  50320. return index;
  50321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50322. }));
  50323. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  50324. return self;
  50325. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  50326. },
  50327. args: [],
  50328. source: "testAllSubclasses\x0a\x09| subclasses index |\x0a\x0a\x09subclasses := Object subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09self assert: Object allSubclasses equals: subclasses",
  50329. referencedClasses: ["Object"],
  50330. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  50331. }),
  50332. $globals.ClassTest);
  50333. $core.addMethod(
  50334. $core.method({
  50335. selector: "testMetaclassSubclasses",
  50336. protocol: "tests",
  50337. fn: function (){
  50338. var self=this,$self=this;
  50339. var subclasses;
  50340. return $core.withContext(function($ctx1) {
  50341. var $4,$3,$2,$1;
  50342. $4=$recv($globals.Object)._class();
  50343. $ctx1.sendIdx["class"]=1;
  50344. $3=$recv($4)._instanceClass();
  50345. $2=$recv($3)._subclasses();
  50346. $ctx1.sendIdx["subclasses"]=1;
  50347. $1=$recv($2)._select_((function(each){
  50348. return $core.withContext(function($ctx2) {
  50349. return $recv($recv(each)._isMetaclass())._not();
  50350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50351. }));
  50352. subclasses=$recv($1)._collect_((function(each){
  50353. return $core.withContext(function($ctx2) {
  50354. return $recv(each)._theMetaClass();
  50355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50356. }));
  50357. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  50358. return self;
  50359. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  50360. },
  50361. args: [],
  50362. source: "testMetaclassSubclasses\x0a\x09| subclasses |\x0a\x0a\x09subclasses := (Object class instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ].\x0a\x0a\x09self assert: Object class subclasses equals: subclasses",
  50363. referencedClasses: ["Object"],
  50364. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  50365. }),
  50366. $globals.ClassTest);
  50367. $core.addMethod(
  50368. $core.method({
  50369. selector: "testSetJavaScriptConstructor",
  50370. protocol: "tests",
  50371. fn: function (){
  50372. var self=this,$self=this;
  50373. var instance;
  50374. return $core.withContext(function($ctx1) {
  50375. var $2,$1,$4,$3,$6,$5,$8,$7;
  50376. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50377. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  50378. $2=$recv($self["@theClass"])._superclass();
  50379. $ctx1.sendIdx["superclass"]=1;
  50380. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  50381. $ctx1.sendIdx["=="]=1;
  50382. $self._assert_($1);
  50383. $ctx1.sendIdx["assert:"]=1;
  50384. $4=$recv($self["@theClass"])._instanceVariableNames();
  50385. $ctx1.sendIdx["instanceVariableNames"]=1;
  50386. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  50387. $ctx1.sendIdx["=="]=2;
  50388. $self._assert_($3);
  50389. $ctx1.sendIdx["assert:"]=2;
  50390. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  50391. $ctx1.sendIdx["assert:equals:"]=1;
  50392. $6=$recv($self["@theClass"])._package();
  50393. $ctx1.sendIdx["package"]=1;
  50394. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  50395. $ctx1.sendIdx["=="]=3;
  50396. $self._assert_($5);
  50397. $ctx1.sendIdx["assert:"]=3;
  50398. $8=$recv($self["@theClass"])._methodDictionary();
  50399. $ctx1.sendIdx["methodDictionary"]=1;
  50400. $7=$recv($8)._keys();
  50401. $ctx1.sendIdx["keys"]=1;
  50402. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  50403. $ctx1.sendIdx["assert:equals:"]=2;
  50404. instance=$recv($self["@theClass"])._new();
  50405. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  50406. $self._assert_equals_($recv(instance)._value(),(4));
  50407. $ctx1.sendIdx["assert:equals:"]=3;
  50408. $self._shouldnt_raise_((function(){
  50409. return $core.withContext(function($ctx2) {
  50410. return $recv(instance)._foo_((9));
  50411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50412. }),$globals.Error);
  50413. $self._assert_equals_($recv(instance)._foo(),(9));
  50414. return self;
  50415. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  50416. },
  50417. args: [],
  50418. source: "testSetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self jsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-coupled detached root class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  50419. referencedClasses: ["ObjectMock", "Error"],
  50420. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  50421. }),
  50422. $globals.ClassTest);
  50423. $core.addMethod(
  50424. $core.method({
  50425. selector: "testTrickySetJavaScriptConstructor",
  50426. protocol: "tests",
  50427. fn: function (){
  50428. var self=this,$self=this;
  50429. var instance;
  50430. return $core.withContext(function($ctx1) {
  50431. var $2,$1,$4,$3,$6,$5,$8,$7;
  50432. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50433. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  50434. $2=$recv($self["@theClass"])._superclass();
  50435. $ctx1.sendIdx["superclass"]=1;
  50436. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  50437. $ctx1.sendIdx["=="]=1;
  50438. $self._assert_($1);
  50439. $ctx1.sendIdx["assert:"]=1;
  50440. $4=$recv($self["@theClass"])._instanceVariableNames();
  50441. $ctx1.sendIdx["instanceVariableNames"]=1;
  50442. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  50443. $ctx1.sendIdx["=="]=2;
  50444. $self._assert_($3);
  50445. $ctx1.sendIdx["assert:"]=2;
  50446. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  50447. $ctx1.sendIdx["assert:equals:"]=1;
  50448. $6=$recv($self["@theClass"])._package();
  50449. $ctx1.sendIdx["package"]=1;
  50450. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  50451. $ctx1.sendIdx["=="]=3;
  50452. $self._assert_($5);
  50453. $ctx1.sendIdx["assert:"]=3;
  50454. $8=$recv($self["@theClass"])._methodDictionary();
  50455. $ctx1.sendIdx["methodDictionary"]=1;
  50456. $7=$recv($8)._keys();
  50457. $ctx1.sendIdx["keys"]=1;
  50458. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  50459. $ctx1.sendIdx["assert:equals:"]=2;
  50460. instance=$recv($self["@theClass"])._new();
  50461. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  50462. $self._assert_equals_($recv(instance)._value(),(4));
  50463. $ctx1.sendIdx["assert:equals:"]=3;
  50464. $self._shouldnt_raise_((function(){
  50465. return $core.withContext(function($ctx2) {
  50466. return $recv(instance)._foo_((9));
  50467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50468. }),$globals.Error);
  50469. $self._assert_equals_($recv(instance)._foo(),(9));
  50470. return self;
  50471. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  50472. },
  50473. args: [],
  50474. source: "testTrickySetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self trickyJsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-coupled detached root class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  50475. referencedClasses: ["ObjectMock", "Error"],
  50476. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  50477. }),
  50478. $globals.ClassTest);
  50479. $core.addMethod(
  50480. $core.method({
  50481. selector: "trickyJsConstructor",
  50482. protocol: "running",
  50483. fn: function (){
  50484. var self=this,$self=this;
  50485. return $core.withContext(function($ctx1) {
  50486. function Foo(){}
  50487. Foo.prototype.valueOf = function () {return 4;};
  50488. Foo.prototype._foo = function () {return "bar";};
  50489. return Foo;
  50490. ;
  50491. return self;
  50492. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  50493. },
  50494. args: [],
  50495. source: "trickyJsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09Foo.prototype._foo = function () {return \x22bar\x22;};\x0a\x09\x09return Foo;\x0a\x09'>",
  50496. referencedClasses: [],
  50497. messageSends: []
  50498. }),
  50499. $globals.ClassTest);
  50500. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  50501. $core.addMethod(
  50502. $core.method({
  50503. selector: "assertSameContents:as:",
  50504. protocol: "convenience",
  50505. fn: function (aCollection,anotherCollection){
  50506. var self=this,$self=this;
  50507. return $core.withContext(function($ctx1) {
  50508. var $2,$1,$4,$3;
  50509. $2=$recv(aCollection)._size();
  50510. $ctx1.sendIdx["size"]=1;
  50511. $1=$recv($2).__eq($recv(anotherCollection)._size());
  50512. $ctx1.sendIdx["="]=1;
  50513. $self._assert_($1);
  50514. $ctx1.sendIdx["assert:"]=1;
  50515. $recv(aCollection)._do_((function(each){
  50516. return $core.withContext(function($ctx2) {
  50517. $4=$recv(aCollection)._occurrencesOf_(each);
  50518. $ctx2.sendIdx["occurrencesOf:"]=1;
  50519. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  50520. return $self._assert_($3);
  50521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50522. }));
  50523. return self;
  50524. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  50525. },
  50526. args: ["aCollection", "anotherCollection"],
  50527. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  50528. referencedClasses: [],
  50529. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  50530. }),
  50531. $globals.CollectionTest);
  50532. $core.addMethod(
  50533. $core.method({
  50534. selector: "collection",
  50535. protocol: "fixture",
  50536. fn: function (){
  50537. var self=this,$self=this;
  50538. return $core.withContext(function($ctx1) {
  50539. $self._subclassResponsibility();
  50540. return self;
  50541. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  50542. },
  50543. args: [],
  50544. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  50545. referencedClasses: [],
  50546. messageSends: ["subclassResponsibility"]
  50547. }),
  50548. $globals.CollectionTest);
  50549. $core.addMethod(
  50550. $core.method({
  50551. selector: "collectionClass",
  50552. protocol: "fixture",
  50553. fn: function (){
  50554. var self=this,$self=this;
  50555. return $core.withContext(function($ctx1) {
  50556. return $recv($self._class())._collectionClass();
  50557. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  50558. },
  50559. args: [],
  50560. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  50561. referencedClasses: [],
  50562. messageSends: ["collectionClass", "class"]
  50563. }),
  50564. $globals.CollectionTest);
  50565. $core.addMethod(
  50566. $core.method({
  50567. selector: "collectionOfPrintStrings",
  50568. protocol: "fixture",
  50569. fn: function (){
  50570. var self=this,$self=this;
  50571. return $core.withContext(function($ctx1) {
  50572. $self._subclassResponsibility();
  50573. return self;
  50574. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  50575. },
  50576. args: [],
  50577. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  50578. referencedClasses: [],
  50579. messageSends: ["subclassResponsibility"]
  50580. }),
  50581. $globals.CollectionTest);
  50582. $core.addMethod(
  50583. $core.method({
  50584. selector: "collectionSize",
  50585. protocol: "fixture",
  50586. fn: function (){
  50587. var self=this,$self=this;
  50588. return $core.withContext(function($ctx1) {
  50589. $self._subclassResponsibility();
  50590. return self;
  50591. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  50592. },
  50593. args: [],
  50594. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  50595. referencedClasses: [],
  50596. messageSends: ["subclassResponsibility"]
  50597. }),
  50598. $globals.CollectionTest);
  50599. $core.addMethod(
  50600. $core.method({
  50601. selector: "collectionWithDuplicates",
  50602. protocol: "fixture",
  50603. fn: function (){
  50604. var self=this,$self=this;
  50605. return $core.withContext(function($ctx1) {
  50606. $self._subclassResponsibility();
  50607. return self;
  50608. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  50609. },
  50610. args: [],
  50611. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  50612. referencedClasses: [],
  50613. messageSends: ["subclassResponsibility"]
  50614. }),
  50615. $globals.CollectionTest);
  50616. $core.addMethod(
  50617. $core.method({
  50618. selector: "collectionWithNewValue",
  50619. protocol: "fixture",
  50620. fn: function (){
  50621. var self=this,$self=this;
  50622. return $core.withContext(function($ctx1) {
  50623. $self._subclassResponsibility();
  50624. return self;
  50625. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  50626. },
  50627. args: [],
  50628. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  50629. referencedClasses: [],
  50630. messageSends: ["subclassResponsibility"]
  50631. }),
  50632. $globals.CollectionTest);
  50633. $core.addMethod(
  50634. $core.method({
  50635. selector: "initialize",
  50636. protocol: "initialization",
  50637. fn: function (){
  50638. var self=this,$self=this;
  50639. return $core.withContext(function($ctx1) {
  50640. (
  50641. $ctx1.supercall = true,
  50642. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  50643. $ctx1.supercall = false;
  50644. $self["@sampleBlock"]=(function(){
  50645. });
  50646. return self;
  50647. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  50648. },
  50649. args: [],
  50650. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  50651. referencedClasses: [],
  50652. messageSends: ["initialize"]
  50653. }),
  50654. $globals.CollectionTest);
  50655. $core.addMethod(
  50656. $core.method({
  50657. selector: "isCollectionReadOnly",
  50658. protocol: "testing",
  50659. fn: function (){
  50660. var self=this,$self=this;
  50661. return false;
  50662. },
  50663. args: [],
  50664. source: "isCollectionReadOnly\x0a\x09^ false",
  50665. referencedClasses: [],
  50666. messageSends: []
  50667. }),
  50668. $globals.CollectionTest);
  50669. $core.addMethod(
  50670. $core.method({
  50671. selector: "sampleNewValue",
  50672. protocol: "fixture",
  50673. fn: function (){
  50674. var self=this,$self=this;
  50675. return "N";
  50676. },
  50677. args: [],
  50678. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  50679. referencedClasses: [],
  50680. messageSends: []
  50681. }),
  50682. $globals.CollectionTest);
  50683. $core.addMethod(
  50684. $core.method({
  50685. selector: "sampleNewValueAsCollection",
  50686. protocol: "fixture",
  50687. fn: function (){
  50688. var self=this,$self=this;
  50689. return $core.withContext(function($ctx1) {
  50690. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  50691. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  50692. },
  50693. args: [],
  50694. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  50695. referencedClasses: [],
  50696. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  50697. }),
  50698. $globals.CollectionTest);
  50699. $core.addMethod(
  50700. $core.method({
  50701. selector: "testAddAll",
  50702. protocol: "tests",
  50703. fn: function (){
  50704. var self=this,$self=this;
  50705. return $core.withContext(function($ctx1) {
  50706. var $2,$4,$3,$5,$1,$6,$9,$8,$10,$11,$7,$12,$15,$14,$17,$16,$18,$13,$20,$21,$22,$19,$23,$25,$24;
  50707. $2=$self._collection();
  50708. $ctx1.sendIdx["collection"]=1;
  50709. $4=$self._collectionClass();
  50710. $ctx1.sendIdx["collectionClass"]=1;
  50711. $3=$recv($4)._new();
  50712. $ctx1.sendIdx["new"]=1;
  50713. $recv($2)._addAll_($3);
  50714. $ctx1.sendIdx["addAll:"]=1;
  50715. $5=$recv($2)._yourself();
  50716. $ctx1.sendIdx["yourself"]=1;
  50717. $1=$5;
  50718. $6=$self._collection();
  50719. $ctx1.sendIdx["collection"]=2;
  50720. $self._assert_equals_($1,$6);
  50721. $ctx1.sendIdx["assert:equals:"]=1;
  50722. $9=$self._collectionClass();
  50723. $ctx1.sendIdx["collectionClass"]=2;
  50724. $8=$recv($9)._new();
  50725. $ctx1.sendIdx["new"]=2;
  50726. $10=$self._collection();
  50727. $ctx1.sendIdx["collection"]=3;
  50728. $recv($8)._addAll_($10);
  50729. $ctx1.sendIdx["addAll:"]=2;
  50730. $11=$recv($8)._yourself();
  50731. $ctx1.sendIdx["yourself"]=2;
  50732. $7=$11;
  50733. $12=$self._collection();
  50734. $ctx1.sendIdx["collection"]=4;
  50735. $self._assert_equals_($7,$12);
  50736. $ctx1.sendIdx["assert:equals:"]=2;
  50737. $15=$self._collectionClass();
  50738. $ctx1.sendIdx["collectionClass"]=3;
  50739. $14=$recv($15)._new();
  50740. $ctx1.sendIdx["new"]=3;
  50741. $17=$self._collectionClass();
  50742. $ctx1.sendIdx["collectionClass"]=4;
  50743. $16=$recv($17)._new();
  50744. $ctx1.sendIdx["new"]=4;
  50745. $recv($14)._addAll_($16);
  50746. $ctx1.sendIdx["addAll:"]=3;
  50747. $18=$recv($14)._yourself();
  50748. $ctx1.sendIdx["yourself"]=3;
  50749. $13=$18;
  50750. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  50751. $ctx1.sendIdx["assert:equals:"]=3;
  50752. $20=$self._collection();
  50753. $ctx1.sendIdx["collection"]=5;
  50754. $21=$self._sampleNewValueAsCollection();
  50755. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  50756. $recv($20)._addAll_($21);
  50757. $ctx1.sendIdx["addAll:"]=4;
  50758. $22=$recv($20)._yourself();
  50759. $ctx1.sendIdx["yourself"]=4;
  50760. $19=$22;
  50761. $23=$self._collectionWithNewValue();
  50762. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50763. $self._assert_equals_($19,$23);
  50764. $25=$self._sampleNewValueAsCollection();
  50765. $recv($25)._addAll_($self._collection());
  50766. $24=$recv($25)._yourself();
  50767. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  50768. return self;
  50769. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  50770. },
  50771. args: [],
  50772. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  50773. referencedClasses: [],
  50774. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50775. }),
  50776. $globals.CollectionTest);
  50777. $core.addMethod(
  50778. $core.method({
  50779. selector: "testAllSatisfy",
  50780. protocol: "tests",
  50781. fn: function (){
  50782. var self=this,$self=this;
  50783. var collection,anyOne;
  50784. return $core.withContext(function($ctx1) {
  50785. var $1;
  50786. collection=$self._collection();
  50787. anyOne=$recv(collection)._anyOne();
  50788. $1=$recv(collection)._allSatisfy_((function(each){
  50789. return $core.withContext(function($ctx2) {
  50790. return $recv(collection)._includes_(each);
  50791. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50792. }));
  50793. $ctx1.sendIdx["allSatisfy:"]=1;
  50794. $self._assert_($1);
  50795. $self._deny_($recv(collection)._allSatisfy_((function(each){
  50796. return $core.withContext(function($ctx2) {
  50797. return $recv(each).__tild_eq(anyOne);
  50798. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50799. })));
  50800. return self;
  50801. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  50802. },
  50803. args: [],
  50804. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  50805. referencedClasses: [],
  50806. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  50807. }),
  50808. $globals.CollectionTest);
  50809. $core.addMethod(
  50810. $core.method({
  50811. selector: "testAnyOne",
  50812. protocol: "tests",
  50813. fn: function (){
  50814. var self=this,$self=this;
  50815. return $core.withContext(function($ctx1) {
  50816. var $2,$1;
  50817. $self._should_raise_((function(){
  50818. return $core.withContext(function($ctx2) {
  50819. return $recv($recv($self._collectionClass())._new())._anyOne();
  50820. $ctx2.sendIdx["anyOne"]=1;
  50821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50822. }),$globals.Error);
  50823. $2=$self._collection();
  50824. $ctx1.sendIdx["collection"]=1;
  50825. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  50826. $self._assert_($1);
  50827. return self;
  50828. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  50829. },
  50830. args: [],
  50831. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  50832. referencedClasses: ["Error"],
  50833. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  50834. }),
  50835. $globals.CollectionTest);
  50836. $core.addMethod(
  50837. $core.method({
  50838. selector: "testAnySatisfy",
  50839. protocol: "tests",
  50840. fn: function (){
  50841. var self=this,$self=this;
  50842. var anyOne;
  50843. return $core.withContext(function($ctx1) {
  50844. var $1,$3,$2;
  50845. $1=$self._collection();
  50846. $ctx1.sendIdx["collection"]=1;
  50847. anyOne=$recv($1)._anyOne();
  50848. $3=$self._collection();
  50849. $ctx1.sendIdx["collection"]=2;
  50850. $2=$recv($3)._anySatisfy_((function(each){
  50851. return $core.withContext(function($ctx2) {
  50852. return $recv(each).__eq(anyOne);
  50853. $ctx2.sendIdx["="]=1;
  50854. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50855. }));
  50856. $ctx1.sendIdx["anySatisfy:"]=1;
  50857. $self._assert_($2);
  50858. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  50859. return $core.withContext(function($ctx2) {
  50860. return $recv(each).__eq($recv($globals.Object)._new());
  50861. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50862. })));
  50863. return self;
  50864. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  50865. },
  50866. args: [],
  50867. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  50868. referencedClasses: ["Object"],
  50869. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  50870. }),
  50871. $globals.CollectionTest);
  50872. $core.addMethod(
  50873. $core.method({
  50874. selector: "testAsArray",
  50875. protocol: "tests",
  50876. fn: function (){
  50877. var self=this,$self=this;
  50878. return $core.withContext(function($ctx1) {
  50879. var $1;
  50880. $1=$self._collection();
  50881. $ctx1.sendIdx["collection"]=1;
  50882. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  50883. return self;
  50884. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  50885. },
  50886. args: [],
  50887. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  50888. referencedClasses: [],
  50889. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  50890. }),
  50891. $globals.CollectionTest);
  50892. $core.addMethod(
  50893. $core.method({
  50894. selector: "testAsOrderedCollection",
  50895. protocol: "tests",
  50896. fn: function (){
  50897. var self=this,$self=this;
  50898. return $core.withContext(function($ctx1) {
  50899. var $1;
  50900. $1=$self._collection();
  50901. $ctx1.sendIdx["collection"]=1;
  50902. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  50903. return self;
  50904. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  50905. },
  50906. args: [],
  50907. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  50908. referencedClasses: [],
  50909. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  50910. }),
  50911. $globals.CollectionTest);
  50912. $core.addMethod(
  50913. $core.method({
  50914. selector: "testAsSet",
  50915. protocol: "tests",
  50916. fn: function (){
  50917. var self=this,$self=this;
  50918. var c,set;
  50919. return $core.withContext(function($ctx1) {
  50920. c=$self._collectionWithDuplicates();
  50921. set=$recv(c)._asSet();
  50922. $self._assert_equals_($recv(set)._size(),(6));
  50923. $recv(c)._do_((function(each){
  50924. return $core.withContext(function($ctx2) {
  50925. return $self._assert_($recv(set)._includes_(each));
  50926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50927. }));
  50928. return self;
  50929. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  50930. },
  50931. args: [],
  50932. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 6.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  50933. referencedClasses: [],
  50934. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  50935. }),
  50936. $globals.CollectionTest);
  50937. $core.addMethod(
  50938. $core.method({
  50939. selector: "testCollect",
  50940. protocol: "tests",
  50941. fn: function (){
  50942. var self=this,$self=this;
  50943. return $core.withContext(function($ctx1) {
  50944. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  50945. $2=$self._collection();
  50946. $ctx1.sendIdx["collection"]=1;
  50947. $1=$recv($2)._collect_((function(each){
  50948. return each;
  50949. }));
  50950. $ctx1.sendIdx["collect:"]=1;
  50951. $3=$self._collection();
  50952. $ctx1.sendIdx["collection"]=2;
  50953. $self._assert_equals_($1,$3);
  50954. $ctx1.sendIdx["assert:equals:"]=1;
  50955. $5=$self._collectionWithNewValue();
  50956. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50957. $4=$recv($5)._collect_((function(each){
  50958. return each;
  50959. }));
  50960. $ctx1.sendIdx["collect:"]=2;
  50961. $self._assert_equals_($4,$self._collectionWithNewValue());
  50962. $ctx1.sendIdx["assert:equals:"]=2;
  50963. $8=$self._collectionClass();
  50964. $ctx1.sendIdx["collectionClass"]=1;
  50965. $7=$recv($8)._new();
  50966. $ctx1.sendIdx["new"]=1;
  50967. $6=$recv($7)._collect_((function(each){
  50968. return $core.withContext(function($ctx2) {
  50969. return $recv(each)._printString();
  50970. $ctx2.sendIdx["printString"]=1;
  50971. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50972. }));
  50973. $ctx1.sendIdx["collect:"]=3;
  50974. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  50975. $ctx1.sendIdx["assert:equals:"]=3;
  50976. $11=$self._collection();
  50977. $ctx1.sendIdx["collection"]=3;
  50978. $10=$recv($11)._collect_((function(){
  50979. return $core.withContext(function($ctx2) {
  50980. return $self._sampleNewValue();
  50981. $ctx2.sendIdx["sampleNewValue"]=1;
  50982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  50983. }));
  50984. $ctx1.sendIdx["collect:"]=4;
  50985. $9=$recv($10)._detect_((function(){
  50986. return true;
  50987. }));
  50988. $self._assert_equals_($9,$self._sampleNewValue());
  50989. $ctx1.sendIdx["assert:equals:"]=4;
  50990. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  50991. return $core.withContext(function($ctx2) {
  50992. return $recv(each)._printString();
  50993. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50994. })),$self._collectionOfPrintStrings());
  50995. return self;
  50996. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  50997. },
  50998. args: [],
  50999. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  51000. referencedClasses: [],
  51001. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  51002. }),
  51003. $globals.CollectionTest);
  51004. $core.addMethod(
  51005. $core.method({
  51006. selector: "testComma",
  51007. protocol: "tests",
  51008. fn: function (){
  51009. var self=this,$self=this;
  51010. return $core.withContext(function($ctx1) {
  51011. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  51012. $2=$self._collection();
  51013. $ctx1.sendIdx["collection"]=1;
  51014. $4=$self._collectionClass();
  51015. $ctx1.sendIdx["collectionClass"]=1;
  51016. $3=$recv($4)._new();
  51017. $ctx1.sendIdx["new"]=1;
  51018. $1=$recv($2).__comma($3);
  51019. $ctx1.sendIdx[","]=1;
  51020. $5=$self._collection();
  51021. $ctx1.sendIdx["collection"]=2;
  51022. $self._assert_equals_($1,$5);
  51023. $ctx1.sendIdx["assert:equals:"]=1;
  51024. $8=$self._collectionClass();
  51025. $ctx1.sendIdx["collectionClass"]=2;
  51026. $7=$recv($8)._new();
  51027. $ctx1.sendIdx["new"]=2;
  51028. $9=$self._collection();
  51029. $ctx1.sendIdx["collection"]=3;
  51030. $6=$recv($7).__comma($9);
  51031. $ctx1.sendIdx[","]=2;
  51032. $10=$self._collection();
  51033. $ctx1.sendIdx["collection"]=4;
  51034. $self._assert_equals_($6,$10);
  51035. $ctx1.sendIdx["assert:equals:"]=2;
  51036. $13=$self._collectionClass();
  51037. $ctx1.sendIdx["collectionClass"]=3;
  51038. $12=$recv($13)._new();
  51039. $ctx1.sendIdx["new"]=3;
  51040. $15=$self._collectionClass();
  51041. $ctx1.sendIdx["collectionClass"]=4;
  51042. $14=$recv($15)._new();
  51043. $ctx1.sendIdx["new"]=4;
  51044. $11=$recv($12).__comma($14);
  51045. $ctx1.sendIdx[","]=3;
  51046. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  51047. $ctx1.sendIdx["assert:equals:"]=3;
  51048. $17=$self._collection();
  51049. $ctx1.sendIdx["collection"]=5;
  51050. $18=$self._sampleNewValueAsCollection();
  51051. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  51052. $16=$recv($17).__comma($18);
  51053. $ctx1.sendIdx[","]=4;
  51054. $19=$self._collectionWithNewValue();
  51055. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51056. $self._assert_equals_($16,$19);
  51057. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  51058. return self;
  51059. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  51060. },
  51061. args: [],
  51062. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  51063. referencedClasses: [],
  51064. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  51065. }),
  51066. $globals.CollectionTest);
  51067. $core.addMethod(
  51068. $core.method({
  51069. selector: "testCopy",
  51070. protocol: "tests",
  51071. fn: function (){
  51072. var self=this,$self=this;
  51073. return $core.withContext(function($ctx1) {
  51074. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  51075. $3=$self._collectionClass();
  51076. $ctx1.sendIdx["collectionClass"]=1;
  51077. $2=$recv($3)._new();
  51078. $ctx1.sendIdx["new"]=1;
  51079. $1=$recv($2)._copy();
  51080. $ctx1.sendIdx["copy"]=1;
  51081. $5=$self._collectionClass();
  51082. $ctx1.sendIdx["collectionClass"]=2;
  51083. $4=$recv($5)._new();
  51084. $ctx1.sendIdx["new"]=2;
  51085. $self._assert_equals_($1,$4);
  51086. $ctx1.sendIdx["assert:equals:"]=1;
  51087. $7=$self._collection();
  51088. $ctx1.sendIdx["collection"]=1;
  51089. $6=$recv($7)._copy();
  51090. $ctx1.sendIdx["copy"]=2;
  51091. $8=$self._collection();
  51092. $ctx1.sendIdx["collection"]=2;
  51093. $self._assert_equals_($6,$8);
  51094. $ctx1.sendIdx["assert:equals:"]=2;
  51095. $10=$self._collectionWithNewValue();
  51096. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51097. $9=$recv($10)._copy();
  51098. $ctx1.sendIdx["copy"]=3;
  51099. $11=$self._collectionWithNewValue();
  51100. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51101. $self._assert_equals_($9,$11);
  51102. $15=$self._collectionClass();
  51103. $ctx1.sendIdx["collectionClass"]=3;
  51104. $14=$recv($15)._new();
  51105. $ctx1.sendIdx["new"]=3;
  51106. $13=$recv($14)._copy();
  51107. $ctx1.sendIdx["copy"]=4;
  51108. $16=$self._collection();
  51109. $ctx1.sendIdx["collection"]=3;
  51110. $12=$recv($13).__eq($16);
  51111. $ctx1.sendIdx["="]=1;
  51112. $self._deny_($12);
  51113. $ctx1.sendIdx["deny:"]=1;
  51114. $19=$self._collection();
  51115. $ctx1.sendIdx["collection"]=4;
  51116. $18=$recv($19)._copy();
  51117. $ctx1.sendIdx["copy"]=5;
  51118. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  51119. $ctx1.sendIdx["="]=2;
  51120. $self._deny_($17);
  51121. $ctx1.sendIdx["deny:"]=2;
  51122. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  51123. return self;
  51124. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  51125. },
  51126. args: [],
  51127. source: "testCopy\x0a\x09self assert: self collectionClass new copy equals: self collectionClass new.\x0a\x09self assert: self collection copy equals: self collection.\x0a\x09self assert: self collectionWithNewValue copy equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new copy = self collection.\x0a\x09self deny: self collection copy = self collectionClass new.\x0a\x09self deny: self collection copy = self collectionWithNewValue",
  51128. referencedClasses: [],
  51129. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  51130. }),
  51131. $globals.CollectionTest);
  51132. $core.addMethod(
  51133. $core.method({
  51134. selector: "testCopySeparates",
  51135. protocol: "tests",
  51136. fn: function (){
  51137. var self=this,$self=this;
  51138. var original,copy;
  51139. return $core.withContext(function($ctx1) {
  51140. original=$self._collection();
  51141. $ctx1.sendIdx["collection"]=1;
  51142. copy=$recv(original)._copy();
  51143. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  51144. $self._assert_($recv(original).__eq($self._collection()));
  51145. return self;
  51146. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  51147. },
  51148. args: [],
  51149. source: "testCopySeparates\x0a\x09| original copy |\x0a\x09original := self collection.\x0a\x09copy := original copy.\x0a\x09copy addAll: self sampleNewValueAsCollection.\x0a\x09self assert: original = self collection",
  51150. referencedClasses: [],
  51151. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  51152. }),
  51153. $globals.CollectionTest);
  51154. $core.addMethod(
  51155. $core.method({
  51156. selector: "testDetect",
  51157. protocol: "tests",
  51158. fn: function (){
  51159. var self=this,$self=this;
  51160. return $core.withContext(function($ctx1) {
  51161. var $1,$2,$3,$4,$6,$5,$7;
  51162. $self._shouldnt_raise_((function(){
  51163. return $core.withContext(function($ctx2) {
  51164. $1=$self._collection();
  51165. $ctx2.sendIdx["collection"]=1;
  51166. return $recv($1)._detect_((function(){
  51167. return true;
  51168. }));
  51169. $ctx2.sendIdx["detect:"]=1;
  51170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51171. }),$globals.Error);
  51172. $self._should_raise_((function(){
  51173. return $core.withContext(function($ctx2) {
  51174. $2=$self._collection();
  51175. $ctx2.sendIdx["collection"]=2;
  51176. return $recv($2)._detect_((function(){
  51177. return false;
  51178. }));
  51179. $ctx2.sendIdx["detect:"]=2;
  51180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51181. }),$globals.Error);
  51182. $ctx1.sendIdx["should:raise:"]=1;
  51183. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  51184. return true;
  51185. }));
  51186. $ctx1.sendIdx["detect:"]=3;
  51187. $4=$self._sampleNewValue();
  51188. $ctx1.sendIdx["sampleNewValue"]=1;
  51189. $self._assert_equals_($3,$4);
  51190. $ctx1.sendIdx["assert:equals:"]=1;
  51191. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  51192. return $core.withContext(function($ctx2) {
  51193. $6=$self._sampleNewValue();
  51194. $ctx2.sendIdx["sampleNewValue"]=2;
  51195. return $recv(each).__eq($6);
  51196. $ctx2.sendIdx["="]=1;
  51197. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51198. }));
  51199. $ctx1.sendIdx["detect:"]=4;
  51200. $7=$self._sampleNewValue();
  51201. $ctx1.sendIdx["sampleNewValue"]=3;
  51202. $self._assert_equals_($5,$7);
  51203. $self._should_raise_((function(){
  51204. return $core.withContext(function($ctx2) {
  51205. return $recv($self._collection())._detect_((function(each){
  51206. return $core.withContext(function($ctx3) {
  51207. return $recv(each).__eq($self._sampleNewValue());
  51208. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  51209. }));
  51210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  51211. }),$globals.Error);
  51212. return self;
  51213. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  51214. },
  51215. args: [],
  51216. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  51217. referencedClasses: ["Error"],
  51218. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  51219. }),
  51220. $globals.CollectionTest);
  51221. $core.addMethod(
  51222. $core.method({
  51223. selector: "testDetectIfNone",
  51224. protocol: "tests",
  51225. fn: function (){
  51226. var self=this,$self=this;
  51227. var sentinel;
  51228. return $core.withContext(function($ctx1) {
  51229. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  51230. sentinel=$recv($globals.Object)._new();
  51231. $3=$self._collection();
  51232. $ctx1.sendIdx["collection"]=1;
  51233. $2=$recv($3)._detect_ifNone_((function(){
  51234. return true;
  51235. }),(function(){
  51236. return sentinel;
  51237. }));
  51238. $ctx1.sendIdx["detect:ifNone:"]=1;
  51239. $1=$recv($2).__tild_eq(sentinel);
  51240. $self._assert_($1);
  51241. $5=$self._collection();
  51242. $ctx1.sendIdx["collection"]=2;
  51243. $4=$recv($5)._detect_ifNone_((function(){
  51244. return false;
  51245. }),(function(){
  51246. return sentinel;
  51247. }));
  51248. $ctx1.sendIdx["detect:ifNone:"]=2;
  51249. $self._assert_equals_($4,sentinel);
  51250. $ctx1.sendIdx["assert:equals:"]=1;
  51251. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  51252. return true;
  51253. }),(function(){
  51254. return sentinel;
  51255. }));
  51256. $ctx1.sendIdx["detect:ifNone:"]=3;
  51257. $7=$self._sampleNewValue();
  51258. $ctx1.sendIdx["sampleNewValue"]=1;
  51259. $self._assert_equals_($6,$7);
  51260. $ctx1.sendIdx["assert:equals:"]=2;
  51261. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  51262. return $core.withContext(function($ctx2) {
  51263. $9=$self._sampleNewValue();
  51264. $ctx2.sendIdx["sampleNewValue"]=2;
  51265. return $recv(each).__eq($9);
  51266. $ctx2.sendIdx["="]=1;
  51267. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  51268. }),(function(){
  51269. return sentinel;
  51270. }));
  51271. $ctx1.sendIdx["detect:ifNone:"]=4;
  51272. $10=$self._sampleNewValue();
  51273. $ctx1.sendIdx["sampleNewValue"]=3;
  51274. $self._assert_equals_($8,$10);
  51275. $ctx1.sendIdx["assert:equals:"]=3;
  51276. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  51277. return $core.withContext(function($ctx2) {
  51278. return $recv(each).__eq($self._sampleNewValue());
  51279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  51280. }),(function(){
  51281. return sentinel;
  51282. })),sentinel);
  51283. return self;
  51284. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  51285. },
  51286. args: [],
  51287. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  51288. referencedClasses: ["Object"],
  51289. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  51290. }),
  51291. $globals.CollectionTest);
  51292. $core.addMethod(
  51293. $core.method({
  51294. selector: "testDo",
  51295. protocol: "tests",
  51296. fn: function (){
  51297. var self=this,$self=this;
  51298. var newCollection;
  51299. return $core.withContext(function($ctx1) {
  51300. var $1,$2;
  51301. newCollection=$recv($globals.OrderedCollection)._new();
  51302. $ctx1.sendIdx["new"]=1;
  51303. $1=$self._collection();
  51304. $ctx1.sendIdx["collection"]=1;
  51305. $recv($1)._do_((function(each){
  51306. return $core.withContext(function($ctx2) {
  51307. return $recv(newCollection)._add_(each);
  51308. $ctx2.sendIdx["add:"]=1;
  51309. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51310. }));
  51311. $ctx1.sendIdx["do:"]=1;
  51312. $self._assertSameContents_as_($self._collection(),newCollection);
  51313. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51314. newCollection=$recv($globals.OrderedCollection)._new();
  51315. $2=$self._collectionWithDuplicates();
  51316. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  51317. $recv($2)._do_((function(each){
  51318. return $core.withContext(function($ctx2) {
  51319. return $recv(newCollection)._add_(each);
  51320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51321. }));
  51322. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  51323. return self;
  51324. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  51325. },
  51326. args: [],
  51327. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  51328. referencedClasses: ["OrderedCollection"],
  51329. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  51330. }),
  51331. $globals.CollectionTest);
  51332. $core.addMethod(
  51333. $core.method({
  51334. selector: "testEquality",
  51335. protocol: "tests",
  51336. fn: function (){
  51337. var self=this,$self=this;
  51338. return $core.withContext(function($ctx1) {
  51339. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  51340. $2=$self._collectionClass();
  51341. $ctx1.sendIdx["collectionClass"]=1;
  51342. $1=$recv($2)._new();
  51343. $ctx1.sendIdx["new"]=1;
  51344. $4=$self._collectionClass();
  51345. $ctx1.sendIdx["collectionClass"]=2;
  51346. $3=$recv($4)._new();
  51347. $ctx1.sendIdx["new"]=2;
  51348. $self._assert_equals_($1,$3);
  51349. $ctx1.sendIdx["assert:equals:"]=1;
  51350. $5=$self._collection();
  51351. $ctx1.sendIdx["collection"]=1;
  51352. $6=$self._collection();
  51353. $ctx1.sendIdx["collection"]=2;
  51354. $self._assert_equals_($5,$6);
  51355. $ctx1.sendIdx["assert:equals:"]=2;
  51356. $7=$self._collectionWithNewValue();
  51357. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51358. $8=$self._collectionWithNewValue();
  51359. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51360. $self._assert_equals_($7,$8);
  51361. $11=$self._collectionClass();
  51362. $ctx1.sendIdx["collectionClass"]=3;
  51363. $10=$recv($11)._new();
  51364. $ctx1.sendIdx["new"]=3;
  51365. $12=$self._collection();
  51366. $ctx1.sendIdx["collection"]=3;
  51367. $9=$recv($10).__eq($12);
  51368. $ctx1.sendIdx["="]=1;
  51369. $self._deny_($9);
  51370. $ctx1.sendIdx["deny:"]=1;
  51371. $14=$self._collection();
  51372. $ctx1.sendIdx["collection"]=4;
  51373. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  51374. $ctx1.sendIdx["="]=2;
  51375. $self._deny_($13);
  51376. $ctx1.sendIdx["deny:"]=2;
  51377. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  51378. return self;
  51379. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  51380. },
  51381. args: [],
  51382. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new.\x0a\x09self deny: self collection = self collectionWithNewValue",
  51383. referencedClasses: [],
  51384. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  51385. }),
  51386. $globals.CollectionTest);
  51387. $core.addMethod(
  51388. $core.method({
  51389. selector: "testIfEmptyFamily",
  51390. protocol: "tests",
  51391. fn: function (){
  51392. var self=this,$self=this;
  51393. return $core.withContext(function($ctx1) {
  51394. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28;
  51395. $3=$self._collectionClass();
  51396. $ctx1.sendIdx["collectionClass"]=1;
  51397. $2=$recv($3)._new();
  51398. $ctx1.sendIdx["new"]=1;
  51399. $1=$recv($2)._ifEmpty_((function(){
  51400. return (42);
  51401. }));
  51402. $ctx1.sendIdx["ifEmpty:"]=1;
  51403. $self._assert_equals_($1,(42));
  51404. $ctx1.sendIdx["assert:equals:"]=1;
  51405. $5=$self._collection();
  51406. $ctx1.sendIdx["collection"]=1;
  51407. $4=$recv($5)._ifEmpty_((function(){
  51408. return (42);
  51409. }));
  51410. $6=$self._collection();
  51411. $ctx1.sendIdx["collection"]=2;
  51412. $self._assert_equals_($4,$6);
  51413. $ctx1.sendIdx["assert:equals:"]=2;
  51414. $9=$self._collectionClass();
  51415. $ctx1.sendIdx["collectionClass"]=2;
  51416. $8=$recv($9)._new();
  51417. $ctx1.sendIdx["new"]=2;
  51418. $7=$recv($8)._ifNotEmpty_((function(){
  51419. return (42);
  51420. }));
  51421. $ctx1.sendIdx["ifNotEmpty:"]=1;
  51422. $11=$self._collectionClass();
  51423. $ctx1.sendIdx["collectionClass"]=3;
  51424. $10=$recv($11)._new();
  51425. $ctx1.sendIdx["new"]=3;
  51426. $self._assert_equals_($7,$10);
  51427. $ctx1.sendIdx["assert:equals:"]=3;
  51428. $13=$self._collection();
  51429. $ctx1.sendIdx["collection"]=3;
  51430. $12=$recv($13)._ifNotEmpty_((function(){
  51431. return (42);
  51432. }));
  51433. $ctx1.sendIdx["ifNotEmpty:"]=2;
  51434. $self._assert_equals_($12,(42));
  51435. $ctx1.sendIdx["assert:equals:"]=4;
  51436. $15=$self._collection();
  51437. $ctx1.sendIdx["collection"]=4;
  51438. $14=$recv($15)._ifNotEmpty_((function(col){
  51439. return col;
  51440. }));
  51441. $16=$self._collection();
  51442. $ctx1.sendIdx["collection"]=5;
  51443. $self._assert_equals_($14,$16);
  51444. $ctx1.sendIdx["assert:equals:"]=5;
  51445. $19=$self._collectionClass();
  51446. $ctx1.sendIdx["collectionClass"]=4;
  51447. $18=$recv($19)._new();
  51448. $ctx1.sendIdx["new"]=4;
  51449. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  51450. return (42);
  51451. }),(function(){
  51452. return (999);
  51453. }));
  51454. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  51455. $self._assert_equals_($17,(42));
  51456. $ctx1.sendIdx["assert:equals:"]=6;
  51457. $21=$self._collection();
  51458. $ctx1.sendIdx["collection"]=6;
  51459. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  51460. return (42);
  51461. }),(function(){
  51462. return (999);
  51463. }));
  51464. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  51465. $self._assert_equals_($20,(999));
  51466. $ctx1.sendIdx["assert:equals:"]=7;
  51467. $23=$self._collection();
  51468. $ctx1.sendIdx["collection"]=7;
  51469. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  51470. return (42);
  51471. }),(function(col){
  51472. return col;
  51473. }));
  51474. $24=$self._collection();
  51475. $ctx1.sendIdx["collection"]=8;
  51476. $self._assert_equals_($22,$24);
  51477. $ctx1.sendIdx["assert:equals:"]=8;
  51478. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  51479. return (42);
  51480. }),(function(){
  51481. return (999);
  51482. }));
  51483. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  51484. $self._assert_equals_($25,(999));
  51485. $ctx1.sendIdx["assert:equals:"]=9;
  51486. $27=$self._collection();
  51487. $ctx1.sendIdx["collection"]=9;
  51488. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  51489. return (42);
  51490. }),(function(){
  51491. return (999);
  51492. }));
  51493. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  51494. $self._assert_equals_($26,(42));
  51495. $ctx1.sendIdx["assert:equals:"]=10;
  51496. $29=$self._collection();
  51497. $ctx1.sendIdx["collection"]=10;
  51498. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  51499. return col;
  51500. }),(function(){
  51501. return (999);
  51502. }));
  51503. $self._assert_equals_($28,$self._collection());
  51504. return self;
  51505. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  51506. },
  51507. args: [],
  51508. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.",
  51509. referencedClasses: [],
  51510. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  51511. }),
  51512. $globals.CollectionTest);
  51513. $core.addMethod(
  51514. $core.method({
  51515. selector: "testIsEmpty",
  51516. protocol: "tests",
  51517. fn: function (){
  51518. var self=this,$self=this;
  51519. return $core.withContext(function($ctx1) {
  51520. var $1;
  51521. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  51522. $ctx1.sendIdx["isEmpty"]=1;
  51523. $self._assert_($1);
  51524. $self._deny_($recv($self._collection())._isEmpty());
  51525. return self;
  51526. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  51527. },
  51528. args: [],
  51529. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  51530. referencedClasses: [],
  51531. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  51532. }),
  51533. $globals.CollectionTest);
  51534. $core.addMethod(
  51535. $core.method({
  51536. selector: "testNoneSatisfy",
  51537. protocol: "tests",
  51538. fn: function (){
  51539. var self=this,$self=this;
  51540. var anyOne;
  51541. return $core.withContext(function($ctx1) {
  51542. var $1,$3,$2;
  51543. $1=$self._collection();
  51544. $ctx1.sendIdx["collection"]=1;
  51545. anyOne=$recv($1)._anyOne();
  51546. $3=$self._collection();
  51547. $ctx1.sendIdx["collection"]=2;
  51548. $2=$recv($3)._noneSatisfy_((function(each){
  51549. return $core.withContext(function($ctx2) {
  51550. return $recv(each).__eq(anyOne);
  51551. $ctx2.sendIdx["="]=1;
  51552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51553. }));
  51554. $ctx1.sendIdx["noneSatisfy:"]=1;
  51555. $self._deny_($2);
  51556. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  51557. return $core.withContext(function($ctx2) {
  51558. return $recv(each).__eq($recv($globals.Object)._new());
  51559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51560. })));
  51561. return self;
  51562. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  51563. },
  51564. args: [],
  51565. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  51566. referencedClasses: ["Object"],
  51567. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  51568. }),
  51569. $globals.CollectionTest);
  51570. $core.addMethod(
  51571. $core.method({
  51572. selector: "testRemoveAll",
  51573. protocol: "tests",
  51574. fn: function (){
  51575. var self=this,$self=this;
  51576. return $core.withContext(function($ctx1) {
  51577. var $2,$1;
  51578. $2=$self._collection();
  51579. $recv($2)._removeAll();
  51580. $1=$recv($2)._yourself();
  51581. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  51582. return self;
  51583. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  51584. },
  51585. args: [],
  51586. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  51587. referencedClasses: [],
  51588. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  51589. }),
  51590. $globals.CollectionTest);
  51591. $core.addMethod(
  51592. $core.method({
  51593. selector: "testSelect",
  51594. protocol: "tests",
  51595. fn: function (){
  51596. var self=this,$self=this;
  51597. return $core.withContext(function($ctx1) {
  51598. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  51599. $2=$self._collection();
  51600. $ctx1.sendIdx["collection"]=1;
  51601. $1=$recv($2)._select_((function(){
  51602. return false;
  51603. }));
  51604. $ctx1.sendIdx["select:"]=1;
  51605. $4=$self._collectionClass();
  51606. $ctx1.sendIdx["collectionClass"]=1;
  51607. $3=$recv($4)._new();
  51608. $ctx1.sendIdx["new"]=1;
  51609. $self._assert_equals_($1,$3);
  51610. $ctx1.sendIdx["assert:equals:"]=1;
  51611. $6=$self._collection();
  51612. $ctx1.sendIdx["collection"]=2;
  51613. $5=$recv($6)._select_((function(){
  51614. return true;
  51615. }));
  51616. $ctx1.sendIdx["select:"]=2;
  51617. $7=$self._collection();
  51618. $ctx1.sendIdx["collection"]=3;
  51619. $self._assert_equals_($5,$7);
  51620. $ctx1.sendIdx["assert:equals:"]=2;
  51621. $9=$self._collectionWithNewValue();
  51622. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51623. $8=$recv($9)._select_((function(each){
  51624. return $core.withContext(function($ctx2) {
  51625. $10=$self._sampleNewValue();
  51626. $ctx2.sendIdx["sampleNewValue"]=1;
  51627. return $recv(each).__eq($10);
  51628. $ctx2.sendIdx["="]=1;
  51629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  51630. }));
  51631. $ctx1.sendIdx["select:"]=3;
  51632. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  51633. $ctx1.sendIdx["assert:equals:"]=3;
  51634. $12=$self._collectionWithNewValue();
  51635. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51636. $11=$recv($12)._select_((function(each){
  51637. return $core.withContext(function($ctx2) {
  51638. $13=$self._sampleNewValue();
  51639. $ctx2.sendIdx["sampleNewValue"]=2;
  51640. return $recv(each).__tild_eq($13);
  51641. $ctx2.sendIdx["~="]=1;
  51642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  51643. }));
  51644. $ctx1.sendIdx["select:"]=4;
  51645. $14=$self._collection();
  51646. $ctx1.sendIdx["collection"]=4;
  51647. $self._assert_equals_($11,$14);
  51648. $ctx1.sendIdx["assert:equals:"]=4;
  51649. $16=$self._collection();
  51650. $ctx1.sendIdx["collection"]=5;
  51651. $15=$recv($16)._select_((function(each){
  51652. return $core.withContext(function($ctx2) {
  51653. $17=$self._sampleNewValue();
  51654. $ctx2.sendIdx["sampleNewValue"]=3;
  51655. return $recv(each).__eq($17);
  51656. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  51657. }));
  51658. $ctx1.sendIdx["select:"]=5;
  51659. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  51660. $ctx1.sendIdx["assert:equals:"]=5;
  51661. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  51662. return $core.withContext(function($ctx2) {
  51663. return $recv(each).__tild_eq($self._sampleNewValue());
  51664. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51665. })),$self._collection());
  51666. return self;
  51667. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  51668. },
  51669. args: [],
  51670. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  51671. referencedClasses: [],
  51672. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  51673. }),
  51674. $globals.CollectionTest);
  51675. $core.addMethod(
  51676. $core.method({
  51677. selector: "testSelectThenCollect",
  51678. protocol: "tests",
  51679. fn: function (){
  51680. var self=this,$self=this;
  51681. return $core.withContext(function($ctx1) {
  51682. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  51683. $2=$self._collection();
  51684. $ctx1.sendIdx["collection"]=1;
  51685. $1=$recv($2)._select_thenCollect_((function(){
  51686. return false;
  51687. }),"isString");
  51688. $ctx1.sendIdx["select:thenCollect:"]=1;
  51689. $4=$self._collectionClass();
  51690. $ctx1.sendIdx["collectionClass"]=1;
  51691. $3=$recv($4)._new();
  51692. $ctx1.sendIdx["new"]=1;
  51693. $self._assert_equals_($1,$3);
  51694. $ctx1.sendIdx["assert:equals:"]=1;
  51695. $6=$self._collection();
  51696. $ctx1.sendIdx["collection"]=2;
  51697. $5=$recv($6)._select_thenCollect_((function(){
  51698. return true;
  51699. }),(function(x){
  51700. return x;
  51701. }));
  51702. $ctx1.sendIdx["select:thenCollect:"]=2;
  51703. $7=$self._collection();
  51704. $ctx1.sendIdx["collection"]=3;
  51705. $self._assert_equals_($5,$7);
  51706. $ctx1.sendIdx["assert:equals:"]=2;
  51707. $8=$recv($self._collection())._select_thenCollect_((function(each){
  51708. return $core.withContext(function($ctx2) {
  51709. $9=$self._sampleNewValue();
  51710. $ctx2.sendIdx["sampleNewValue"]=1;
  51711. return $recv(each).__eq($9);
  51712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  51713. }),(function(x){
  51714. return x;
  51715. }));
  51716. $ctx1.sendIdx["select:thenCollect:"]=3;
  51717. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  51718. $ctx1.sendIdx["assert:equals:"]=3;
  51719. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  51720. return $core.withContext(function($ctx2) {
  51721. return $recv(each).__tild_eq($self._sampleNewValue());
  51722. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51723. }),"printString"),$self._collectionOfPrintStrings());
  51724. return self;
  51725. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  51726. },
  51727. args: [],
  51728. source: "testSelectThenCollect\x0a\x09self assert: (self collection select: [ false ] thenCollect: #isString) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ] thenCollect: [:x|x]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ] thenCollect: [:x|x]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ] thenCollect: #printString) equals: self collectionOfPrintStrings",
  51729. referencedClasses: [],
  51730. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  51731. }),
  51732. $globals.CollectionTest);
  51733. $core.addMethod(
  51734. $core.method({
  51735. selector: "testSingle",
  51736. protocol: "tests",
  51737. fn: function (){
  51738. var self=this,$self=this;
  51739. return $core.withContext(function($ctx1) {
  51740. $self._should_raise_((function(){
  51741. return $core.withContext(function($ctx2) {
  51742. return $recv($recv($self._collectionClass())._new())._single();
  51743. $ctx2.sendIdx["single"]=1;
  51744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51745. }),$globals.Error);
  51746. $ctx1.sendIdx["should:raise:"]=1;
  51747. $self._should_raise_((function(){
  51748. return $core.withContext(function($ctx2) {
  51749. return $recv($self._collection())._single();
  51750. $ctx2.sendIdx["single"]=2;
  51751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51752. }),$globals.Error);
  51753. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  51754. return self;
  51755. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  51756. },
  51757. args: [],
  51758. source: "testSingle\x0a\x09self should: [ self collectionClass new single ] raise: Error.\x0a\x09self should: [ self collection single ] raise: Error.\x0a\x09self assert: self sampleNewValueAsCollection single equals: self sampleNewValue",
  51759. referencedClasses: ["Error"],
  51760. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  51761. }),
  51762. $globals.CollectionTest);
  51763. $core.addMethod(
  51764. $core.method({
  51765. selector: "testSize",
  51766. protocol: "tests",
  51767. fn: function (){
  51768. var self=this,$self=this;
  51769. return $core.withContext(function($ctx1) {
  51770. var $1,$2;
  51771. $1=$recv($recv($self._collectionClass())._new())._size();
  51772. $ctx1.sendIdx["size"]=1;
  51773. $self._assert_equals_($1,(0));
  51774. $ctx1.sendIdx["assert:equals:"]=1;
  51775. $2=$recv($self._sampleNewValueAsCollection())._size();
  51776. $ctx1.sendIdx["size"]=2;
  51777. $self._assert_equals_($2,(1));
  51778. $ctx1.sendIdx["assert:equals:"]=2;
  51779. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  51780. return self;
  51781. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  51782. },
  51783. args: [],
  51784. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  51785. referencedClasses: [],
  51786. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  51787. }),
  51788. $globals.CollectionTest);
  51789. $core.addMethod(
  51790. $core.method({
  51791. selector: "collectionClass",
  51792. protocol: "fixture",
  51793. fn: function (){
  51794. var self=this,$self=this;
  51795. return nil;
  51796. },
  51797. args: [],
  51798. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  51799. referencedClasses: [],
  51800. messageSends: []
  51801. }),
  51802. $globals.CollectionTest.a$cls);
  51803. $core.addMethod(
  51804. $core.method({
  51805. selector: "isAbstract",
  51806. protocol: "testing",
  51807. fn: function (){
  51808. var self=this,$self=this;
  51809. return $core.withContext(function($ctx1) {
  51810. return $recv($self._collectionClass())._isNil();
  51811. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  51812. },
  51813. args: [],
  51814. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  51815. referencedClasses: [],
  51816. messageSends: ["isNil", "collectionClass"]
  51817. }),
  51818. $globals.CollectionTest.a$cls);
  51819. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  51820. $core.addMethod(
  51821. $core.method({
  51822. selector: "collectionWithNewValue",
  51823. protocol: "fixture",
  51824. fn: function (){
  51825. var self=this,$self=this;
  51826. return $core.withContext(function($ctx1) {
  51827. $self._subclassResponsibility();
  51828. return self;
  51829. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  51830. },
  51831. args: [],
  51832. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  51833. referencedClasses: [],
  51834. messageSends: ["subclassResponsibility"]
  51835. }),
  51836. $globals.IndexableCollectionTest);
  51837. $core.addMethod(
  51838. $core.method({
  51839. selector: "sampleNewIndex",
  51840. protocol: "fixture",
  51841. fn: function (){
  51842. var self=this,$self=this;
  51843. return $core.withContext(function($ctx1) {
  51844. $self._subclassResponsibility();
  51845. return self;
  51846. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  51847. },
  51848. args: [],
  51849. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  51850. referencedClasses: [],
  51851. messageSends: ["subclassResponsibility"]
  51852. }),
  51853. $globals.IndexableCollectionTest);
  51854. $core.addMethod(
  51855. $core.method({
  51856. selector: "sampleNonIndexesDo:",
  51857. protocol: "fixture",
  51858. fn: function (aBlock){
  51859. var self=this,$self=this;
  51860. return $core.withContext(function($ctx1) {
  51861. $self._subclassResponsibility();
  51862. return self;
  51863. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  51864. },
  51865. args: ["aBlock"],
  51866. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  51867. referencedClasses: [],
  51868. messageSends: ["subclassResponsibility"]
  51869. }),
  51870. $globals.IndexableCollectionTest);
  51871. $core.addMethod(
  51872. $core.method({
  51873. selector: "samplesDo:",
  51874. protocol: "fixture",
  51875. fn: function (aBlock){
  51876. var self=this,$self=this;
  51877. return $core.withContext(function($ctx1) {
  51878. $self._subclassResponsibility();
  51879. return self;
  51880. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  51881. },
  51882. args: ["aBlock"],
  51883. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  51884. referencedClasses: [],
  51885. messageSends: ["subclassResponsibility"]
  51886. }),
  51887. $globals.IndexableCollectionTest);
  51888. $core.addMethod(
  51889. $core.method({
  51890. selector: "testAt",
  51891. protocol: "tests",
  51892. fn: function (){
  51893. var self=this,$self=this;
  51894. return $core.withContext(function($ctx1) {
  51895. var $1;
  51896. $self._nonIndexesDo_((function(each){
  51897. return $core.withContext(function($ctx2) {
  51898. return $self._should_raise_((function(){
  51899. return $core.withContext(function($ctx3) {
  51900. $1=$self._collection();
  51901. $ctx3.sendIdx["collection"]=1;
  51902. return $recv($1)._at_(each);
  51903. $ctx3.sendIdx["at:"]=1;
  51904. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51905. }),$globals.Error);
  51906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51907. }));
  51908. $self._samplesDo_((function(index,value){
  51909. return $core.withContext(function($ctx2) {
  51910. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  51911. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  51912. }));
  51913. return self;
  51914. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  51915. },
  51916. args: [],
  51917. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  51918. referencedClasses: ["Error"],
  51919. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  51920. }),
  51921. $globals.IndexableCollectionTest);
  51922. $core.addMethod(
  51923. $core.method({
  51924. selector: "testAtIfAbsent",
  51925. protocol: "tests",
  51926. fn: function (){
  51927. var self=this,$self=this;
  51928. return $core.withContext(function($ctx1) {
  51929. var $2,$1,$3;
  51930. $self._nonIndexesDo_((function(each){
  51931. return $core.withContext(function($ctx2) {
  51932. $2=$self._collection();
  51933. $ctx2.sendIdx["collection"]=1;
  51934. $1=$recv($2)._at_ifAbsent_(each,(function(){
  51935. return $core.withContext(function($ctx3) {
  51936. return $self._sampleNewValue();
  51937. $ctx3.sendIdx["sampleNewValue"]=1;
  51938. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51939. }));
  51940. $ctx2.sendIdx["at:ifAbsent:"]=1;
  51941. $3=$self._sampleNewValue();
  51942. $ctx2.sendIdx["sampleNewValue"]=2;
  51943. return $self._assert_equals_($1,$3);
  51944. $ctx2.sendIdx["assert:equals:"]=1;
  51945. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51946. }));
  51947. $self._samplesDo_((function(index,value){
  51948. return $core.withContext(function($ctx2) {
  51949. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  51950. return $core.withContext(function($ctx3) {
  51951. return $self._sampleNewValue();
  51952. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  51953. })),value);
  51954. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  51955. }));
  51956. return self;
  51957. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  51958. },
  51959. args: [],
  51960. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  51961. referencedClasses: [],
  51962. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  51963. }),
  51964. $globals.IndexableCollectionTest);
  51965. $core.addMethod(
  51966. $core.method({
  51967. selector: "testAtIfAbsentPut",
  51968. protocol: "tests",
  51969. fn: function (){
  51970. var self=this,$self=this;
  51971. var newCollection;
  51972. return $core.withContext(function($ctx1) {
  51973. var $1;
  51974. newCollection=$self._collection();
  51975. $ctx1.sendIdx["collection"]=1;
  51976. $self._samplesDo_((function(index,value){
  51977. return $core.withContext(function($ctx2) {
  51978. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  51979. return $core.withContext(function($ctx3) {
  51980. return $self._sampleNewValue();
  51981. $ctx3.sendIdx["sampleNewValue"]=1;
  51982. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51983. }));
  51984. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  51985. return $self._assert_equals_($1,value);
  51986. $ctx2.sendIdx["assert:equals:"]=1;
  51987. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51988. }));
  51989. $self._assert_equals_(newCollection,$self._collection());
  51990. $ctx1.sendIdx["assert:equals:"]=2;
  51991. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  51992. return $core.withContext(function($ctx2) {
  51993. return $self._sampleNewValue();
  51994. $ctx2.sendIdx["sampleNewValue"]=2;
  51995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51996. })),$self._sampleNewValue());
  51997. $ctx1.sendIdx["assert:equals:"]=3;
  51998. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  51999. return self;
  52000. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  52001. },
  52002. args: [],
  52003. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  52004. referencedClasses: [],
  52005. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  52006. }),
  52007. $globals.IndexableCollectionTest);
  52008. $core.addMethod(
  52009. $core.method({
  52010. selector: "testAtIfPresent",
  52011. protocol: "tests",
  52012. fn: function (){
  52013. var self=this,$self=this;
  52014. var visited,sentinel;
  52015. return $core.withContext(function($ctx1) {
  52016. var $2,$1,$4,$3;
  52017. sentinel=$recv($globals.Object)._new();
  52018. $self._nonIndexesDo_((function(each){
  52019. return $core.withContext(function($ctx2) {
  52020. visited=nil;
  52021. visited;
  52022. $2=$self._collection();
  52023. $ctx2.sendIdx["collection"]=1;
  52024. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  52025. visited=value1;
  52026. visited;
  52027. return sentinel;
  52028. }));
  52029. $ctx2.sendIdx["at:ifPresent:"]=1;
  52030. $self._assert_equals_($1,nil);
  52031. $ctx2.sendIdx["assert:equals:"]=1;
  52032. return $self._assert_($recv(visited)._isNil());
  52033. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52034. }));
  52035. $self._samplesDo_((function(index,value){
  52036. return $core.withContext(function($ctx2) {
  52037. visited=nil;
  52038. visited;
  52039. $4=$self._collection();
  52040. $ctx2.sendIdx["collection"]=2;
  52041. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  52042. visited=value2;
  52043. visited;
  52044. return sentinel;
  52045. }));
  52046. $self._assert_equals_($3,sentinel);
  52047. $ctx2.sendIdx["assert:equals:"]=2;
  52048. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  52049. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  52050. }));
  52051. return self;
  52052. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  52053. },
  52054. args: [],
  52055. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  52056. referencedClasses: ["Object"],
  52057. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  52058. }),
  52059. $globals.IndexableCollectionTest);
  52060. $core.addMethod(
  52061. $core.method({
  52062. selector: "testAtIfPresentIfAbsent",
  52063. protocol: "tests",
  52064. fn: function (){
  52065. var self=this,$self=this;
  52066. var visited,sentinel;
  52067. return $core.withContext(function($ctx1) {
  52068. var $2,$1,$3,$5,$4;
  52069. sentinel=$recv($globals.Object)._new();
  52070. $self._nonIndexesDo_((function(each){
  52071. return $core.withContext(function($ctx2) {
  52072. visited=nil;
  52073. visited;
  52074. $2=$self._collection();
  52075. $ctx2.sendIdx["collection"]=1;
  52076. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  52077. visited=value1;
  52078. visited;
  52079. return sentinel;
  52080. }),(function(){
  52081. return $core.withContext(function($ctx3) {
  52082. return $self._sampleNewValue();
  52083. $ctx3.sendIdx["sampleNewValue"]=1;
  52084. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  52085. }));
  52086. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  52087. $3=$self._sampleNewValue();
  52088. $ctx2.sendIdx["sampleNewValue"]=2;
  52089. $self._assert_equals_($1,$3);
  52090. $ctx2.sendIdx["assert:equals:"]=1;
  52091. return $self._assert_($recv(visited)._isNil());
  52092. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52093. }));
  52094. $self._samplesDo_((function(index,value){
  52095. return $core.withContext(function($ctx2) {
  52096. visited=nil;
  52097. visited;
  52098. $5=$self._collection();
  52099. $ctx2.sendIdx["collection"]=2;
  52100. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  52101. visited=value2;
  52102. visited;
  52103. return sentinel;
  52104. }),(function(){
  52105. return $core.withContext(function($ctx3) {
  52106. return $self._sampleNewValue();
  52107. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  52108. }));
  52109. $self._assert_equals_($4,sentinel);
  52110. $ctx2.sendIdx["assert:equals:"]=2;
  52111. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  52112. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  52113. }));
  52114. return self;
  52115. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  52116. },
  52117. args: [],
  52118. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  52119. referencedClasses: ["Object"],
  52120. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  52121. }),
  52122. $globals.IndexableCollectionTest);
  52123. $core.addMethod(
  52124. $core.method({
  52125. selector: "testAtPut",
  52126. protocol: "tests",
  52127. fn: function (){
  52128. var self=this,$self=this;
  52129. var newCollection;
  52130. return $core.withContext(function($ctx1) {
  52131. newCollection=$self._collection();
  52132. $ctx1.sendIdx["collection"]=1;
  52133. $self._samplesDo_((function(index,value){
  52134. return $core.withContext(function($ctx2) {
  52135. return $recv(newCollection)._at_put_(index,value);
  52136. $ctx2.sendIdx["at:put:"]=1;
  52137. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52138. }));
  52139. $self._assert_equals_(newCollection,$self._collection());
  52140. $ctx1.sendIdx["assert:equals:"]=1;
  52141. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  52142. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  52143. return self;
  52144. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  52145. },
  52146. args: [],
  52147. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  52148. referencedClasses: [],
  52149. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  52150. }),
  52151. $globals.IndexableCollectionTest);
  52152. $core.addMethod(
  52153. $core.method({
  52154. selector: "testIndexOf",
  52155. protocol: "tests",
  52156. fn: function (){
  52157. var self=this,$self=this;
  52158. return $core.withContext(function($ctx1) {
  52159. var $1;
  52160. $self._should_raise_((function(){
  52161. return $core.withContext(function($ctx2) {
  52162. $1=$self._collection();
  52163. $ctx2.sendIdx["collection"]=1;
  52164. return $recv($1)._indexOf_($self._sampleNewValue());
  52165. $ctx2.sendIdx["indexOf:"]=1;
  52166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52167. }),$globals.Error);
  52168. $self._samplesDo_((function(index,value){
  52169. return $core.withContext(function($ctx2) {
  52170. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  52171. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  52172. }));
  52173. return self;
  52174. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  52175. },
  52176. args: [],
  52177. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  52178. referencedClasses: ["Error"],
  52179. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  52180. }),
  52181. $globals.IndexableCollectionTest);
  52182. $core.addMethod(
  52183. $core.method({
  52184. selector: "testIndexOfWithNull",
  52185. protocol: "tests",
  52186. fn: function (){
  52187. var self=this,$self=this;
  52188. var jsNull;
  52189. return $core.withContext(function($ctx1) {
  52190. var $2,$1;
  52191. jsNull=$recv($globals.JSON)._parse_("null");
  52192. $self._samplesDo_((function(index,value){
  52193. return $core.withContext(function($ctx2) {
  52194. $2=$self._collection();
  52195. $recv($2)._at_put_(index,jsNull);
  52196. $1=$recv($2)._indexOf_(jsNull);
  52197. return $self._assert_equals_($1,index);
  52198. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52199. }));
  52200. return self;
  52201. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  52202. },
  52203. args: [],
  52204. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  52205. referencedClasses: ["JSON"],
  52206. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  52207. }),
  52208. $globals.IndexableCollectionTest);
  52209. $core.addMethod(
  52210. $core.method({
  52211. selector: "testWithIndexDo",
  52212. protocol: "tests",
  52213. fn: function (){
  52214. var self=this,$self=this;
  52215. var collection;
  52216. return $core.withContext(function($ctx1) {
  52217. collection=$self._collection();
  52218. $ctx1.sendIdx["collection"]=1;
  52219. $recv($self._collection())._withIndexDo_((function(each,index){
  52220. return $core.withContext(function($ctx2) {
  52221. return $self._assert_equals_($recv(collection)._at_(index),each);
  52222. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  52223. }));
  52224. return self;
  52225. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  52226. },
  52227. args: [],
  52228. source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]",
  52229. referencedClasses: [],
  52230. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  52231. }),
  52232. $globals.IndexableCollectionTest);
  52233. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  52234. $core.addMethod(
  52235. $core.method({
  52236. selector: "collectionKeys",
  52237. protocol: "fixture",
  52238. fn: function (){
  52239. var self=this,$self=this;
  52240. return $core.withContext(function($ctx1) {
  52241. $self._subclassResponsibility();
  52242. return self;
  52243. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  52244. },
  52245. args: [],
  52246. source: "collectionKeys\x0a\x09self subclassResponsibility",
  52247. referencedClasses: [],
  52248. messageSends: ["subclassResponsibility"]
  52249. }),
  52250. $globals.AssociativeCollectionTest);
  52251. $core.addMethod(
  52252. $core.method({
  52253. selector: "collectionValues",
  52254. protocol: "fixture",
  52255. fn: function (){
  52256. var self=this,$self=this;
  52257. return $core.withContext(function($ctx1) {
  52258. $self._subclassResponsibility();
  52259. return self;
  52260. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  52261. },
  52262. args: [],
  52263. source: "collectionValues\x0a\x09self subclassResponsibility",
  52264. referencedClasses: [],
  52265. messageSends: ["subclassResponsibility"]
  52266. }),
  52267. $globals.AssociativeCollectionTest);
  52268. $core.addMethod(
  52269. $core.method({
  52270. selector: "nonIndexesDo:",
  52271. protocol: "fixture",
  52272. fn: function (aBlock){
  52273. var self=this,$self=this;
  52274. return $core.withContext(function($ctx1) {
  52275. $recv(aBlock)._value_((5));
  52276. $ctx1.sendIdx["value:"]=1;
  52277. $recv(aBlock)._value_((function(){
  52278. }));
  52279. $ctx1.sendIdx["value:"]=2;
  52280. $recv(aBlock)._value_($recv($globals.Object)._new());
  52281. $ctx1.sendIdx["value:"]=3;
  52282. $recv(aBlock)._value_("z");
  52283. return self;
  52284. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  52285. },
  52286. args: ["aBlock"],
  52287. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  52288. referencedClasses: ["Object"],
  52289. messageSends: ["value:", "new"]
  52290. }),
  52291. $globals.AssociativeCollectionTest);
  52292. $core.addMethod(
  52293. $core.method({
  52294. selector: "sampleNewIndex",
  52295. protocol: "fixture",
  52296. fn: function (){
  52297. var self=this,$self=this;
  52298. return "new";
  52299. },
  52300. args: [],
  52301. source: "sampleNewIndex\x0a\x09^ 'new'",
  52302. referencedClasses: [],
  52303. messageSends: []
  52304. }),
  52305. $globals.AssociativeCollectionTest);
  52306. $core.addMethod(
  52307. $core.method({
  52308. selector: "samplesDo:",
  52309. protocol: "fixture",
  52310. fn: function (aBlock){
  52311. var self=this,$self=this;
  52312. return $core.withContext(function($ctx1) {
  52313. $recv(aBlock)._value_value_("a",(2));
  52314. return self;
  52315. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  52316. },
  52317. args: ["aBlock"],
  52318. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  52319. referencedClasses: [],
  52320. messageSends: ["value:value:"]
  52321. }),
  52322. $globals.AssociativeCollectionTest);
  52323. $core.addMethod(
  52324. $core.method({
  52325. selector: "testAddAll",
  52326. protocol: "tests",
  52327. fn: function (){
  52328. var self=this,$self=this;
  52329. return $core.withContext(function($ctx1) {
  52330. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  52331. (
  52332. $ctx1.supercall = true,
  52333. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  52334. $ctx1.supercall = false;
  52335. $2=$self._collection();
  52336. $ctx1.sendIdx["collection"]=1;
  52337. $3=$self._collection();
  52338. $ctx1.sendIdx["collection"]=2;
  52339. $recv($2)._addAll_($3);
  52340. $ctx1.sendIdx["addAll:"]=1;
  52341. $4=$recv($2)._yourself();
  52342. $ctx1.sendIdx["yourself"]=1;
  52343. $1=$4;
  52344. $5=$self._collection();
  52345. $ctx1.sendIdx["collection"]=3;
  52346. $self._assert_equals_($1,$5);
  52347. $ctx1.sendIdx["assert:equals:"]=1;
  52348. $7=$self._collection();
  52349. $ctx1.sendIdx["collection"]=4;
  52350. $8=$self._collectionWithNewValue();
  52351. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52352. $recv($7)._addAll_($8);
  52353. $ctx1.sendIdx["addAll:"]=2;
  52354. $9=$recv($7)._yourself();
  52355. $ctx1.sendIdx["yourself"]=2;
  52356. $6=$9;
  52357. $10=$self._collectionWithNewValue();
  52358. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52359. $self._assert_equals_($6,$10);
  52360. $ctx1.sendIdx["assert:equals:"]=2;
  52361. $12=$self._collectionWithNewValue();
  52362. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52363. $recv($12)._addAll_($self._collection());
  52364. $11=$recv($12)._yourself();
  52365. $self._assert_equals_($11,$self._collectionWithNewValue());
  52366. return self;
  52367. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  52368. },
  52369. args: [],
  52370. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  52371. referencedClasses: [],
  52372. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  52373. }),
  52374. $globals.AssociativeCollectionTest);
  52375. $core.addMethod(
  52376. $core.method({
  52377. selector: "testAsDictionary",
  52378. protocol: "tests",
  52379. fn: function (){
  52380. var self=this,$self=this;
  52381. return $core.withContext(function($ctx1) {
  52382. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  52383. return self;
  52384. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  52385. },
  52386. args: [],
  52387. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  52388. referencedClasses: ["Dictionary"],
  52389. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  52390. }),
  52391. $globals.AssociativeCollectionTest);
  52392. $core.addMethod(
  52393. $core.method({
  52394. selector: "testAsHashedCollection",
  52395. protocol: "tests",
  52396. fn: function (){
  52397. var self=this,$self=this;
  52398. return $core.withContext(function($ctx1) {
  52399. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  52400. return self;
  52401. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  52402. },
  52403. args: [],
  52404. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  52405. referencedClasses: ["HashedCollection"],
  52406. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  52407. }),
  52408. $globals.AssociativeCollectionTest);
  52409. $core.addMethod(
  52410. $core.method({
  52411. selector: "testComma",
  52412. protocol: "tests",
  52413. fn: function (){
  52414. var self=this,$self=this;
  52415. return $core.withContext(function($ctx1) {
  52416. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  52417. (
  52418. $ctx1.supercall = true,
  52419. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  52420. $ctx1.supercall = false;
  52421. $2=$self._collection();
  52422. $ctx1.sendIdx["collection"]=1;
  52423. $3=$self._collection();
  52424. $ctx1.sendIdx["collection"]=2;
  52425. $1=$recv($2).__comma($3);
  52426. $ctx1.sendIdx[","]=1;
  52427. $4=$self._collection();
  52428. $ctx1.sendIdx["collection"]=3;
  52429. $self._assert_equals_($1,$4);
  52430. $ctx1.sendIdx["assert:equals:"]=1;
  52431. $6=$self._collection();
  52432. $ctx1.sendIdx["collection"]=4;
  52433. $7=$self._collectionWithNewValue();
  52434. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52435. $5=$recv($6).__comma($7);
  52436. $ctx1.sendIdx[","]=2;
  52437. $8=$self._collectionWithNewValue();
  52438. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52439. $self._assert_equals_($5,$8);
  52440. $ctx1.sendIdx["assert:equals:"]=2;
  52441. $10=$self._collectionWithNewValue();
  52442. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52443. $9=$recv($10).__comma($self._collection());
  52444. $self._assert_equals_($9,$self._collectionWithNewValue());
  52445. return self;
  52446. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  52447. },
  52448. args: [],
  52449. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  52450. referencedClasses: [],
  52451. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  52452. }),
  52453. $globals.AssociativeCollectionTest);
  52454. $core.addMethod(
  52455. $core.method({
  52456. selector: "testFrom",
  52457. protocol: "tests",
  52458. fn: function (){
  52459. var self=this,$self=this;
  52460. var associations;
  52461. return $core.withContext(function($ctx1) {
  52462. var $1;
  52463. $1="a".__minus_gt((1));
  52464. $ctx1.sendIdx["->"]=1;
  52465. associations=[$1,"b".__minus_gt((2))];
  52466. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  52467. return self;
  52468. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  52469. },
  52470. args: [],
  52471. source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  52472. referencedClasses: [],
  52473. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  52474. }),
  52475. $globals.AssociativeCollectionTest);
  52476. $core.addMethod(
  52477. $core.method({
  52478. selector: "testKeys",
  52479. protocol: "tests",
  52480. fn: function (){
  52481. var self=this,$self=this;
  52482. return $core.withContext(function($ctx1) {
  52483. var $2,$1,$3,$4;
  52484. $2=$recv($recv($self._collectionClass())._new())._keys();
  52485. $ctx1.sendIdx["keys"]=1;
  52486. $1=$recv($2)._isEmpty();
  52487. $self._assert_($1);
  52488. $3=$recv($self._collection())._keys();
  52489. $ctx1.sendIdx["keys"]=2;
  52490. $4=$self._collectionKeys();
  52491. $ctx1.sendIdx["collectionKeys"]=1;
  52492. $self._assertSameContents_as_($3,$4);
  52493. $ctx1.sendIdx["assertSameContents:as:"]=1;
  52494. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  52495. return self;
  52496. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  52497. },
  52498. args: [],
  52499. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  52500. referencedClasses: [],
  52501. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  52502. }),
  52503. $globals.AssociativeCollectionTest);
  52504. $core.addMethod(
  52505. $core.method({
  52506. selector: "testNewFromPairs",
  52507. protocol: "tests",
  52508. fn: function (){
  52509. var self=this,$self=this;
  52510. var flattenedAssociations;
  52511. return $core.withContext(function($ctx1) {
  52512. flattenedAssociations=["a",(1),"b",(2)];
  52513. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  52514. return self;
  52515. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  52516. },
  52517. args: [],
  52518. source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  52519. referencedClasses: [],
  52520. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  52521. }),
  52522. $globals.AssociativeCollectionTest);
  52523. $core.addMethod(
  52524. $core.method({
  52525. selector: "testPrintString",
  52526. protocol: "tests",
  52527. fn: function (){
  52528. var self=this,$self=this;
  52529. return $core.withContext(function($ctx1) {
  52530. var $3,$2,$1,$4;
  52531. $3=$self._collectionClass();
  52532. $ctx1.sendIdx["collectionClass"]=1;
  52533. $2=$recv($3)._new();
  52534. $recv($2)._at_put_("firstname","James");
  52535. $ctx1.sendIdx["at:put:"]=1;
  52536. $recv($2)._at_put_("lastname","Bond");
  52537. $1=$recv($2)._printString();
  52538. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  52539. $ctx1.sendIdx[","]=1;
  52540. $self._assert_equals_($1,$4);
  52541. return self;
  52542. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  52543. },
  52544. args: [],
  52545. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  52546. referencedClasses: [],
  52547. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  52548. }),
  52549. $globals.AssociativeCollectionTest);
  52550. $core.addMethod(
  52551. $core.method({
  52552. selector: "testRemoveKey",
  52553. protocol: "tests",
  52554. fn: function (){
  52555. var self=this,$self=this;
  52556. return $core.withContext(function($ctx1) {
  52557. var $1,$2,$3,$5,$6,$4,$8,$7;
  52558. $self._nonIndexesDo_((function(each){
  52559. var collection;
  52560. return $core.withContext(function($ctx2) {
  52561. collection=$self._collection();
  52562. $ctx2.sendIdx["collection"]=1;
  52563. collection;
  52564. $self._should_raise_((function(){
  52565. return $core.withContext(function($ctx3) {
  52566. return $recv(collection)._removeKey_(each);
  52567. $ctx3.sendIdx["removeKey:"]=1;
  52568. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52569. }),$globals.Error);
  52570. $1=collection;
  52571. $2=$self._collection();
  52572. $ctx2.sendIdx["collection"]=2;
  52573. return $self._assert_equals_($1,$2);
  52574. $ctx2.sendIdx["assert:equals:"]=1;
  52575. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  52576. }));
  52577. $self._samplesDo_((function(index,value){
  52578. var collection;
  52579. return $core.withContext(function($ctx2) {
  52580. collection=$self._collection();
  52581. $ctx2.sendIdx["collection"]=3;
  52582. collection;
  52583. $3=$recv(collection)._removeKey_(index);
  52584. $ctx2.sendIdx["removeKey:"]=2;
  52585. $self._assert_equals_($3,value);
  52586. $ctx2.sendIdx["assert:equals:"]=2;
  52587. $5=collection;
  52588. $6=$self._collection();
  52589. $ctx2.sendIdx["collection"]=4;
  52590. $4=$recv($5).__eq($6);
  52591. return $self._deny_($4);
  52592. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  52593. }));
  52594. $8=$self._collectionWithNewValue();
  52595. $recv($8)._removeKey_($self._sampleNewIndex());
  52596. $7=$recv($8)._yourself();
  52597. $self._assert_equals_($7,$self._collection());
  52598. return self;
  52599. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  52600. },
  52601. args: [],
  52602. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  52603. referencedClasses: ["Error"],
  52604. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  52605. }),
  52606. $globals.AssociativeCollectionTest);
  52607. $core.addMethod(
  52608. $core.method({
  52609. selector: "testRemoveKeyIfAbsent",
  52610. protocol: "tests",
  52611. fn: function (){
  52612. var self=this,$self=this;
  52613. return $core.withContext(function($ctx1) {
  52614. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  52615. $self._nonIndexesDo_((function(each){
  52616. var collection;
  52617. return $core.withContext(function($ctx2) {
  52618. collection=$self._collection();
  52619. $ctx2.sendIdx["collection"]=1;
  52620. collection;
  52621. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  52622. return $core.withContext(function($ctx3) {
  52623. return $self._sampleNewValue();
  52624. $ctx3.sendIdx["sampleNewValue"]=1;
  52625. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52626. }));
  52627. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  52628. $2=$self._sampleNewValue();
  52629. $ctx2.sendIdx["sampleNewValue"]=2;
  52630. $self._assert_equals_($1,$2);
  52631. $ctx2.sendIdx["assert:equals:"]=1;
  52632. $3=collection;
  52633. $4=$self._collection();
  52634. $ctx2.sendIdx["collection"]=2;
  52635. return $self._assert_equals_($3,$4);
  52636. $ctx2.sendIdx["assert:equals:"]=2;
  52637. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  52638. }));
  52639. $self._samplesDo_((function(index,value){
  52640. var collection;
  52641. return $core.withContext(function($ctx2) {
  52642. collection=$self._collection();
  52643. $ctx2.sendIdx["collection"]=3;
  52644. collection;
  52645. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  52646. return $core.withContext(function($ctx3) {
  52647. return $self._sampleNewValue();
  52648. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  52649. }));
  52650. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  52651. $self._assert_equals_($5,value);
  52652. $ctx2.sendIdx["assert:equals:"]=3;
  52653. $7=collection;
  52654. $8=$self._collection();
  52655. $ctx2.sendIdx["collection"]=4;
  52656. $6=$recv($7).__eq($8);
  52657. return $self._deny_($6);
  52658. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  52659. }));
  52660. $10=$self._collectionWithNewValue();
  52661. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  52662. return $core.withContext(function($ctx2) {
  52663. return $self._assert_(false);
  52664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  52665. }));
  52666. $9=$recv($10)._yourself();
  52667. $self._assert_equals_($9,$self._collection());
  52668. return self;
  52669. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  52670. },
  52671. args: [],
  52672. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  52673. referencedClasses: [],
  52674. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  52675. }),
  52676. $globals.AssociativeCollectionTest);
  52677. $core.addMethod(
  52678. $core.method({
  52679. selector: "testValues",
  52680. protocol: "tests",
  52681. fn: function (){
  52682. var self=this,$self=this;
  52683. return $core.withContext(function($ctx1) {
  52684. var $2,$1,$3,$4;
  52685. $2=$recv($recv($self._collectionClass())._new())._values();
  52686. $ctx1.sendIdx["values"]=1;
  52687. $1=$recv($2)._isEmpty();
  52688. $self._assert_($1);
  52689. $3=$recv($self._collection())._values();
  52690. $ctx1.sendIdx["values"]=2;
  52691. $4=$self._collectionValues();
  52692. $ctx1.sendIdx["collectionValues"]=1;
  52693. $self._assertSameContents_as_($3,$4);
  52694. $ctx1.sendIdx["assertSameContents:as:"]=1;
  52695. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  52696. return self;
  52697. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  52698. },
  52699. args: [],
  52700. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  52701. referencedClasses: [],
  52702. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  52703. }),
  52704. $globals.AssociativeCollectionTest);
  52705. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  52706. $core.addMethod(
  52707. $core.method({
  52708. selector: "collection",
  52709. protocol: "fixture",
  52710. fn: function (){
  52711. var self=this,$self=this;
  52712. return $core.withContext(function($ctx1) {
  52713. var $1;
  52714. $1=$recv($globals.Dictionary)._new();
  52715. $recv($1)._at_put_((1),(1));
  52716. $ctx1.sendIdx["at:put:"]=1;
  52717. $recv($1)._at_put_("a",(2));
  52718. $ctx1.sendIdx["at:put:"]=2;
  52719. $recv($1)._at_put_(true,(3));
  52720. $ctx1.sendIdx["at:put:"]=3;
  52721. $recv($1)._at_put_((1).__at((3)),(-4));
  52722. $ctx1.sendIdx["at:put:"]=4;
  52723. $recv($1)._at_put_($self["@sampleBlock"],(9));
  52724. return $recv($1)._yourself();
  52725. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  52726. },
  52727. args: [],
  52728. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: sampleBlock put: 9;\x0a\x09\x09yourself",
  52729. referencedClasses: ["Dictionary"],
  52730. messageSends: ["at:put:", "new", "@", "yourself"]
  52731. }),
  52732. $globals.DictionaryTest);
  52733. $core.addMethod(
  52734. $core.method({
  52735. selector: "collectionKeys",
  52736. protocol: "fixture",
  52737. fn: function (){
  52738. var self=this,$self=this;
  52739. return $core.withContext(function($ctx1) {
  52740. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  52741. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  52742. },
  52743. args: [],
  52744. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  52745. referencedClasses: [],
  52746. messageSends: ["@"]
  52747. }),
  52748. $globals.DictionaryTest);
  52749. $core.addMethod(
  52750. $core.method({
  52751. selector: "collectionOfPrintStrings",
  52752. protocol: "fixture",
  52753. fn: function (){
  52754. var self=this,$self=this;
  52755. return $core.withContext(function($ctx1) {
  52756. var $1;
  52757. $1=$recv($globals.Dictionary)._new();
  52758. $recv($1)._at_put_((1),"1");
  52759. $ctx1.sendIdx["at:put:"]=1;
  52760. $recv($1)._at_put_("a","2");
  52761. $ctx1.sendIdx["at:put:"]=2;
  52762. $recv($1)._at_put_(true,"3");
  52763. $ctx1.sendIdx["at:put:"]=3;
  52764. $recv($1)._at_put_((1).__at((3)),"-4");
  52765. $ctx1.sendIdx["at:put:"]=4;
  52766. $recv($1)._at_put_($self["@sampleBlock"],"9");
  52767. return $recv($1)._yourself();
  52768. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  52769. },
  52770. args: [],
  52771. source: "collectionOfPrintStrings\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: '1';\x0a\x09\x09at: 'a' put: '2';\x0a\x09\x09at: true put: '3';\x0a\x09\x09at: 1@3 put: '-4';\x0a\x09\x09at: sampleBlock put: '9';\x0a\x09\x09yourself",
  52772. referencedClasses: ["Dictionary"],
  52773. messageSends: ["at:put:", "new", "@", "yourself"]
  52774. }),
  52775. $globals.DictionaryTest);
  52776. $core.addMethod(
  52777. $core.method({
  52778. selector: "collectionSize",
  52779. protocol: "fixture",
  52780. fn: function (){
  52781. var self=this,$self=this;
  52782. return (5);
  52783. },
  52784. args: [],
  52785. source: "collectionSize\x0a\x09^ 5",
  52786. referencedClasses: [],
  52787. messageSends: []
  52788. }),
  52789. $globals.DictionaryTest);
  52790. $core.addMethod(
  52791. $core.method({
  52792. selector: "collectionValues",
  52793. protocol: "fixture",
  52794. fn: function (){
  52795. var self=this,$self=this;
  52796. return [(1),(2),(3),(-4),(9)];
  52797. },
  52798. args: [],
  52799. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  52800. referencedClasses: [],
  52801. messageSends: []
  52802. }),
  52803. $globals.DictionaryTest);
  52804. $core.addMethod(
  52805. $core.method({
  52806. selector: "collectionWithDuplicates",
  52807. protocol: "fixture",
  52808. fn: function (){
  52809. var self=this,$self=this;
  52810. return $core.withContext(function($ctx1) {
  52811. var $1;
  52812. $1=$recv($globals.Dictionary)._new();
  52813. $recv($1)._at_put_((1),(1));
  52814. $ctx1.sendIdx["at:put:"]=1;
  52815. $recv($1)._at_put_("a",(2));
  52816. $ctx1.sendIdx["at:put:"]=2;
  52817. $recv($1)._at_put_(true,(3));
  52818. $ctx1.sendIdx["at:put:"]=3;
  52819. $recv($1)._at_put_((4),(-4));
  52820. $ctx1.sendIdx["at:put:"]=4;
  52821. $recv($1)._at_put_($self["@sampleBlock"],(9));
  52822. $ctx1.sendIdx["at:put:"]=5;
  52823. $recv($1)._at_put_("b",(1));
  52824. $ctx1.sendIdx["at:put:"]=6;
  52825. $recv($1)._at_put_((3),(3));
  52826. $ctx1.sendIdx["at:put:"]=7;
  52827. $recv($1)._at_put_(false,(12));
  52828. return $recv($1)._yourself();
  52829. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  52830. },
  52831. args: [],
  52832. source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: sampleBlock put: 9;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  52833. referencedClasses: ["Dictionary"],
  52834. messageSends: ["at:put:", "new", "yourself"]
  52835. }),
  52836. $globals.DictionaryTest);
  52837. $core.addMethod(
  52838. $core.method({
  52839. selector: "collectionWithNewValue",
  52840. protocol: "fixture",
  52841. fn: function (){
  52842. var self=this,$self=this;
  52843. return $core.withContext(function($ctx1) {
  52844. var $1;
  52845. $1=$recv($globals.Dictionary)._new();
  52846. $recv($1)._at_put_((1),(1));
  52847. $ctx1.sendIdx["at:put:"]=1;
  52848. $recv($1)._at_put_("a",(2));
  52849. $ctx1.sendIdx["at:put:"]=2;
  52850. $recv($1)._at_put_(true,(3));
  52851. $ctx1.sendIdx["at:put:"]=3;
  52852. $recv($1)._at_put_((1).__at((3)),(-4));
  52853. $ctx1.sendIdx["at:put:"]=4;
  52854. $recv($1)._at_put_($self["@sampleBlock"],(9));
  52855. $ctx1.sendIdx["at:put:"]=5;
  52856. $recv($1)._at_put_("new","N");
  52857. return $recv($1)._yourself();
  52858. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  52859. },
  52860. args: [],
  52861. source: "collectionWithNewValue\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: sampleBlock put: 9;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  52862. referencedClasses: ["Dictionary"],
  52863. messageSends: ["at:put:", "new", "@", "yourself"]
  52864. }),
  52865. $globals.DictionaryTest);
  52866. $core.addMethod(
  52867. $core.method({
  52868. selector: "sampleNewValueAsCollection",
  52869. protocol: "fixture",
  52870. fn: function (){
  52871. var self=this,$self=this;
  52872. return $core.withContext(function($ctx1) {
  52873. var $1;
  52874. $1=$recv($globals.Dictionary)._new();
  52875. $recv($1)._at_put_("new","N");
  52876. return $recv($1)._yourself();
  52877. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  52878. },
  52879. args: [],
  52880. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  52881. referencedClasses: ["Dictionary"],
  52882. messageSends: ["at:put:", "new", "yourself"]
  52883. }),
  52884. $globals.DictionaryTest);
  52885. $core.addMethod(
  52886. $core.method({
  52887. selector: "samplesDo:",
  52888. protocol: "fixture",
  52889. fn: function (aBlock){
  52890. var self=this,$self=this;
  52891. return $core.withContext(function($ctx1) {
  52892. (
  52893. $ctx1.supercall = true,
  52894. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  52895. $ctx1.supercall = false;
  52896. $recv(aBlock)._value_value_(true,(3));
  52897. $ctx1.sendIdx["value:value:"]=1;
  52898. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  52899. $ctx1.sendIdx["value:value:"]=2;
  52900. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  52901. return self;
  52902. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  52903. },
  52904. args: ["aBlock"],
  52905. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4.\x0a\x09aBlock value: sampleBlock value: 9",
  52906. referencedClasses: [],
  52907. messageSends: ["samplesDo:", "value:value:", "@"]
  52908. }),
  52909. $globals.DictionaryTest);
  52910. $core.addMethod(
  52911. $core.method({
  52912. selector: "testAccessing",
  52913. protocol: "tests",
  52914. fn: function (){
  52915. var self=this,$self=this;
  52916. var d;
  52917. return $core.withContext(function($ctx1) {
  52918. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  52919. d=$recv($globals.Dictionary)._new();
  52920. $recv(d)._at_put_("hello","world");
  52921. $ctx1.sendIdx["at:put:"]=1;
  52922. $1=$recv(d)._at_("hello");
  52923. $ctx1.sendIdx["at:"]=1;
  52924. $self._assert_equals_($1,"world");
  52925. $ctx1.sendIdx["assert:equals:"]=1;
  52926. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  52927. return nil;
  52928. }));
  52929. $ctx1.sendIdx["at:ifAbsent:"]=1;
  52930. $self._assert_equals_($2,"world");
  52931. $ctx1.sendIdx["assert:equals:"]=2;
  52932. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  52933. return nil;
  52934. }))).__eq("world"));
  52935. $ctx1.sendIdx["deny:"]=1;
  52936. $3=$recv(d)._includesKey_("hello");
  52937. $ctx1.sendIdx["includesKey:"]=1;
  52938. $self._assert_($3);
  52939. $ctx1.sendIdx["assert:"]=1;
  52940. $4=$recv(d)._includesKey_("foo");
  52941. $ctx1.sendIdx["includesKey:"]=2;
  52942. $self._deny_($4);
  52943. $ctx1.sendIdx["deny:"]=2;
  52944. $recv(d)._at_put_((1),(2));
  52945. $ctx1.sendIdx["at:put:"]=2;
  52946. $5=$recv(d)._at_((1));
  52947. $ctx1.sendIdx["at:"]=2;
  52948. $self._assert_equals_($5,(2));
  52949. $ctx1.sendIdx["assert:equals:"]=3;
  52950. $6=d;
  52951. $7=(1).__at((3));
  52952. $ctx1.sendIdx["@"]=1;
  52953. $recv($6)._at_put_($7,(3));
  52954. $9=d;
  52955. $10=(1).__at((3));
  52956. $ctx1.sendIdx["@"]=2;
  52957. $8=$recv($9)._at_($10);
  52958. $self._assert_equals_($8,(3));
  52959. $12=d;
  52960. $13=(1).__at((3));
  52961. $ctx1.sendIdx["@"]=3;
  52962. $11=$recv($12)._includesKey_($13);
  52963. $ctx1.sendIdx["includesKey:"]=3;
  52964. $self._assert_($11);
  52965. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  52966. return self;
  52967. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  52968. },
  52969. args: [],
  52970. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [ nil ]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [ nil ]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)",
  52971. referencedClasses: ["Dictionary"],
  52972. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  52973. }),
  52974. $globals.DictionaryTest);
  52975. $core.addMethod(
  52976. $core.method({
  52977. selector: "testDynamicDictionaries",
  52978. protocol: "tests",
  52979. fn: function (){
  52980. var self=this,$self=this;
  52981. return $core.withContext(function($ctx1) {
  52982. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  52983. return self;
  52984. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  52985. },
  52986. args: [],
  52987. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  52988. referencedClasses: ["Dictionary"],
  52989. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  52990. }),
  52991. $globals.DictionaryTest);
  52992. $core.addMethod(
  52993. $core.method({
  52994. selector: "collectionClass",
  52995. protocol: "fixture",
  52996. fn: function (){
  52997. var self=this,$self=this;
  52998. return $globals.Dictionary;
  52999. },
  53000. args: [],
  53001. source: "collectionClass\x0a\x09^ Dictionary",
  53002. referencedClasses: ["Dictionary"],
  53003. messageSends: []
  53004. }),
  53005. $globals.DictionaryTest.a$cls);
  53006. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  53007. $core.addMethod(
  53008. $core.method({
  53009. selector: "collection",
  53010. protocol: "fixture",
  53011. fn: function (){
  53012. var self=this,$self=this;
  53013. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  53014. },
  53015. args: [],
  53016. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  53017. referencedClasses: [],
  53018. messageSends: []
  53019. }),
  53020. $globals.HashedCollectionTest);
  53021. $core.addMethod(
  53022. $core.method({
  53023. selector: "collectionKeys",
  53024. protocol: "fixture",
  53025. fn: function (){
  53026. var self=this,$self=this;
  53027. return ["b","a","c","d"];
  53028. },
  53029. args: [],
  53030. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  53031. referencedClasses: [],
  53032. messageSends: []
  53033. }),
  53034. $globals.HashedCollectionTest);
  53035. $core.addMethod(
  53036. $core.method({
  53037. selector: "collectionOfPrintStrings",
  53038. protocol: "fixture",
  53039. fn: function (){
  53040. var self=this,$self=this;
  53041. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  53042. },
  53043. args: [],
  53044. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  53045. referencedClasses: [],
  53046. messageSends: []
  53047. }),
  53048. $globals.HashedCollectionTest);
  53049. $core.addMethod(
  53050. $core.method({
  53051. selector: "collectionSize",
  53052. protocol: "fixture",
  53053. fn: function (){
  53054. var self=this,$self=this;
  53055. return (4);
  53056. },
  53057. args: [],
  53058. source: "collectionSize\x0a\x09^ 4",
  53059. referencedClasses: [],
  53060. messageSends: []
  53061. }),
  53062. $globals.HashedCollectionTest);
  53063. $core.addMethod(
  53064. $core.method({
  53065. selector: "collectionValues",
  53066. protocol: "fixture",
  53067. fn: function (){
  53068. var self=this,$self=this;
  53069. return [(1),(2),(3),(-4)];
  53070. },
  53071. args: [],
  53072. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  53073. referencedClasses: [],
  53074. messageSends: []
  53075. }),
  53076. $globals.HashedCollectionTest);
  53077. $core.addMethod(
  53078. $core.method({
  53079. selector: "collectionWithDuplicates",
  53080. protocol: "fixture",
  53081. fn: function (){
  53082. var self=this,$self=this;
  53083. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  53084. },
  53085. args: [],
  53086. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  53087. referencedClasses: [],
  53088. messageSends: []
  53089. }),
  53090. $globals.HashedCollectionTest);
  53091. $core.addMethod(
  53092. $core.method({
  53093. selector: "collectionWithNewValue",
  53094. protocol: "fixture",
  53095. fn: function (){
  53096. var self=this,$self=this;
  53097. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  53098. },
  53099. args: [],
  53100. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  53101. referencedClasses: [],
  53102. messageSends: []
  53103. }),
  53104. $globals.HashedCollectionTest);
  53105. $core.addMethod(
  53106. $core.method({
  53107. selector: "sampleNewValueAsCollection",
  53108. protocol: "fixture",
  53109. fn: function (){
  53110. var self=this,$self=this;
  53111. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  53112. },
  53113. args: [],
  53114. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  53115. referencedClasses: [],
  53116. messageSends: []
  53117. }),
  53118. $globals.HashedCollectionTest);
  53119. $core.addMethod(
  53120. $core.method({
  53121. selector: "testDynamicDictionaries",
  53122. protocol: "tests",
  53123. fn: function (){
  53124. var self=this,$self=this;
  53125. return $core.withContext(function($ctx1) {
  53126. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  53127. return self;
  53128. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  53129. },
  53130. args: [],
  53131. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  53132. referencedClasses: ["HashedCollection"],
  53133. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  53134. }),
  53135. $globals.HashedCollectionTest);
  53136. $core.addMethod(
  53137. $core.method({
  53138. selector: "collectionClass",
  53139. protocol: "fixture",
  53140. fn: function (){
  53141. var self=this,$self=this;
  53142. return $globals.HashedCollection;
  53143. },
  53144. args: [],
  53145. source: "collectionClass\x0a\x09^ HashedCollection",
  53146. referencedClasses: ["HashedCollection"],
  53147. messageSends: []
  53148. }),
  53149. $globals.HashedCollectionTest.a$cls);
  53150. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  53151. $core.addMethod(
  53152. $core.method({
  53153. selector: "collectionFirst",
  53154. protocol: "fixture",
  53155. fn: function (){
  53156. var self=this,$self=this;
  53157. return $core.withContext(function($ctx1) {
  53158. $self._subclassResponsibility();
  53159. return self;
  53160. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  53161. },
  53162. args: [],
  53163. source: "collectionFirst\x0a\x09self subclassResponsibility",
  53164. referencedClasses: [],
  53165. messageSends: ["subclassResponsibility"]
  53166. }),
  53167. $globals.SequenceableCollectionTest);
  53168. $core.addMethod(
  53169. $core.method({
  53170. selector: "collectionFirstTwo",
  53171. protocol: "fixture",
  53172. fn: function (){
  53173. var self=this,$self=this;
  53174. return $core.withContext(function($ctx1) {
  53175. $self._subclassResponsibility();
  53176. return self;
  53177. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  53178. },
  53179. args: [],
  53180. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  53181. referencedClasses: [],
  53182. messageSends: ["subclassResponsibility"]
  53183. }),
  53184. $globals.SequenceableCollectionTest);
  53185. $core.addMethod(
  53186. $core.method({
  53187. selector: "collectionLast",
  53188. protocol: "fixture",
  53189. fn: function (){
  53190. var self=this,$self=this;
  53191. return $core.withContext(function($ctx1) {
  53192. $self._subclassResponsibility();
  53193. return self;
  53194. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  53195. },
  53196. args: [],
  53197. source: "collectionLast\x0a\x09self subclassResponsibility",
  53198. referencedClasses: [],
  53199. messageSends: ["subclassResponsibility"]
  53200. }),
  53201. $globals.SequenceableCollectionTest);
  53202. $core.addMethod(
  53203. $core.method({
  53204. selector: "collectionLastTwo",
  53205. protocol: "fixture",
  53206. fn: function (){
  53207. var self=this,$self=this;
  53208. return $core.withContext(function($ctx1) {
  53209. $self._subclassResponsibility();
  53210. return self;
  53211. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  53212. },
  53213. args: [],
  53214. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  53215. referencedClasses: [],
  53216. messageSends: ["subclassResponsibility"]
  53217. }),
  53218. $globals.SequenceableCollectionTest);
  53219. $core.addMethod(
  53220. $core.method({
  53221. selector: "nonIndexesDo:",
  53222. protocol: "fixture",
  53223. fn: function (aBlock){
  53224. var self=this,$self=this;
  53225. return $core.withContext(function($ctx1) {
  53226. $recv(aBlock)._value_((0));
  53227. $ctx1.sendIdx["value:"]=1;
  53228. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  53229. $ctx1.sendIdx["value:"]=2;
  53230. $recv(aBlock)._value_("z");
  53231. return self;
  53232. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  53233. },
  53234. args: ["aBlock"],
  53235. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  53236. referencedClasses: [],
  53237. messageSends: ["value:", "+", "collectionSize"]
  53238. }),
  53239. $globals.SequenceableCollectionTest);
  53240. $core.addMethod(
  53241. $core.method({
  53242. selector: "samplesDo:",
  53243. protocol: "fixture",
  53244. fn: function (aBlock){
  53245. var self=this,$self=this;
  53246. return $core.withContext(function($ctx1) {
  53247. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  53248. $ctx1.sendIdx["value:value:"]=1;
  53249. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  53250. return self;
  53251. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  53252. },
  53253. args: ["aBlock"],
  53254. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  53255. referencedClasses: [],
  53256. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  53257. }),
  53258. $globals.SequenceableCollectionTest);
  53259. $core.addMethod(
  53260. $core.method({
  53261. selector: "testBeginsWith",
  53262. protocol: "tests",
  53263. fn: function (){
  53264. var self=this,$self=this;
  53265. return $core.withContext(function($ctx1) {
  53266. var $2,$1,$4,$5,$3,$7,$6;
  53267. $2=$self._collection();
  53268. $ctx1.sendIdx["collection"]=1;
  53269. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  53270. $ctx1.sendIdx["beginsWith:"]=1;
  53271. $self._assert_($1);
  53272. $ctx1.sendIdx["assert:"]=1;
  53273. $4=$self._collection();
  53274. $ctx1.sendIdx["collection"]=2;
  53275. $5=$self._collection();
  53276. $ctx1.sendIdx["collection"]=3;
  53277. $3=$recv($4)._beginsWith_($5);
  53278. $ctx1.sendIdx["beginsWith:"]=2;
  53279. $self._assert_($3);
  53280. $ctx1.sendIdx["assert:"]=2;
  53281. $7=$self._collection();
  53282. $ctx1.sendIdx["collection"]=4;
  53283. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  53284. $ctx1.sendIdx["beginsWith:"]=3;
  53285. $self._assert_($6);
  53286. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  53287. return self;
  53288. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  53289. },
  53290. args: [],
  53291. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  53292. referencedClasses: [],
  53293. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  53294. }),
  53295. $globals.SequenceableCollectionTest);
  53296. $core.addMethod(
  53297. $core.method({
  53298. selector: "testEndsWith",
  53299. protocol: "tests",
  53300. fn: function (){
  53301. var self=this,$self=this;
  53302. return $core.withContext(function($ctx1) {
  53303. var $2,$1,$4,$5,$3,$7,$6;
  53304. $2=$self._collection();
  53305. $ctx1.sendIdx["collection"]=1;
  53306. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  53307. $ctx1.sendIdx["endsWith:"]=1;
  53308. $self._assert_($1);
  53309. $ctx1.sendIdx["assert:"]=1;
  53310. $4=$self._collection();
  53311. $ctx1.sendIdx["collection"]=2;
  53312. $5=$self._collection();
  53313. $ctx1.sendIdx["collection"]=3;
  53314. $3=$recv($4)._endsWith_($5);
  53315. $ctx1.sendIdx["endsWith:"]=2;
  53316. $self._assert_($3);
  53317. $ctx1.sendIdx["assert:"]=2;
  53318. $7=$self._collection();
  53319. $ctx1.sendIdx["collection"]=4;
  53320. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  53321. $ctx1.sendIdx["endsWith:"]=3;
  53322. $self._assert_($6);
  53323. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  53324. return self;
  53325. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  53326. },
  53327. args: [],
  53328. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  53329. referencedClasses: [],
  53330. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  53331. }),
  53332. $globals.SequenceableCollectionTest);
  53333. $core.addMethod(
  53334. $core.method({
  53335. selector: "testFirst",
  53336. protocol: "tests",
  53337. fn: function (){
  53338. var self=this,$self=this;
  53339. return $core.withContext(function($ctx1) {
  53340. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  53341. return self;
  53342. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  53343. },
  53344. args: [],
  53345. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  53346. referencedClasses: [],
  53347. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  53348. }),
  53349. $globals.SequenceableCollectionTest);
  53350. $core.addMethod(
  53351. $core.method({
  53352. selector: "testFirstN",
  53353. protocol: "tests",
  53354. fn: function (){
  53355. var self=this,$self=this;
  53356. return $core.withContext(function($ctx1) {
  53357. var $2,$1,$4,$3,$6,$5,$7;
  53358. $2=$self._collection();
  53359. $ctx1.sendIdx["collection"]=1;
  53360. $1=$recv($2)._first_((2));
  53361. $ctx1.sendIdx["first:"]=1;
  53362. $self._assert_equals_($1,$self._collectionFirstTwo());
  53363. $ctx1.sendIdx["assert:equals:"]=1;
  53364. $4=$self._collection();
  53365. $ctx1.sendIdx["collection"]=2;
  53366. $3=$recv($4)._first_((0));
  53367. $ctx1.sendIdx["first:"]=2;
  53368. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  53369. $ctx1.sendIdx["assert:equals:"]=2;
  53370. $6=$self._collection();
  53371. $ctx1.sendIdx["collection"]=3;
  53372. $5=$recv($6)._first_($self._collectionSize());
  53373. $ctx1.sendIdx["first:"]=3;
  53374. $7=$self._collection();
  53375. $ctx1.sendIdx["collection"]=4;
  53376. $self._assert_equals_($5,$7);
  53377. $self._should_raise_((function(){
  53378. return $core.withContext(function($ctx2) {
  53379. return $recv($self._collection())._first_((33));
  53380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53381. }),$globals.Error);
  53382. return self;
  53383. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  53384. },
  53385. args: [],
  53386. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  53387. referencedClasses: ["Error"],
  53388. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  53389. }),
  53390. $globals.SequenceableCollectionTest);
  53391. $core.addMethod(
  53392. $core.method({
  53393. selector: "testFourth",
  53394. protocol: "tests",
  53395. fn: function (){
  53396. var self=this,$self=this;
  53397. return $core.withContext(function($ctx1) {
  53398. var $2,$1;
  53399. $2=$self._collection();
  53400. $ctx1.sendIdx["collection"]=1;
  53401. $1=$recv($2)._fourth();
  53402. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  53403. return self;
  53404. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  53405. },
  53406. args: [],
  53407. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  53408. referencedClasses: [],
  53409. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  53410. }),
  53411. $globals.SequenceableCollectionTest);
  53412. $core.addMethod(
  53413. $core.method({
  53414. selector: "testIndexOfStartingAt",
  53415. protocol: "tests",
  53416. fn: function (){
  53417. var self=this,$self=this;
  53418. var jsNull;
  53419. return $core.withContext(function($ctx1) {
  53420. var $2,$1,$4,$3;
  53421. jsNull=$recv($globals.JSON)._parse_("null");
  53422. $self._samplesDo_((function(index,value){
  53423. return $core.withContext(function($ctx2) {
  53424. $2=$self._collection();
  53425. $ctx2.sendIdx["collection"]=1;
  53426. $1=$recv($2)._indexOf_startingAt_(value,(1));
  53427. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  53428. $self._assert_equals_($1,index);
  53429. $ctx2.sendIdx["assert:equals:"]=1;
  53430. $4=$self._collection();
  53431. $ctx2.sendIdx["collection"]=2;
  53432. $3=$recv($4)._indexOf_startingAt_(value,index);
  53433. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  53434. $self._assert_equals_($3,index);
  53435. $ctx2.sendIdx["assert:equals:"]=2;
  53436. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  53437. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53438. }));
  53439. return self;
  53440. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  53441. },
  53442. args: [],
  53443. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  53444. referencedClasses: ["JSON"],
  53445. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  53446. }),
  53447. $globals.SequenceableCollectionTest);
  53448. $core.addMethod(
  53449. $core.method({
  53450. selector: "testIndexOfStartingAtWithNull",
  53451. protocol: "tests",
  53452. fn: function (){
  53453. var self=this,$self=this;
  53454. var jsNull;
  53455. return $core.withContext(function($ctx1) {
  53456. var $1,$2;
  53457. jsNull=$recv($globals.JSON)._parse_("null");
  53458. $self._samplesDo_((function(index,value){
  53459. var collection;
  53460. return $core.withContext(function($ctx2) {
  53461. collection=$self._collection();
  53462. collection;
  53463. $recv(collection)._at_put_(index,jsNull);
  53464. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  53465. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  53466. $self._assert_equals_($1,index);
  53467. $ctx2.sendIdx["assert:equals:"]=1;
  53468. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  53469. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  53470. $self._assert_equals_($2,index);
  53471. $ctx2.sendIdx["assert:equals:"]=2;
  53472. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  53473. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  53474. }));
  53475. return self;
  53476. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  53477. },
  53478. args: [],
  53479. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  53480. referencedClasses: ["JSON"],
  53481. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  53482. }),
  53483. $globals.SequenceableCollectionTest);
  53484. $core.addMethod(
  53485. $core.method({
  53486. selector: "testLast",
  53487. protocol: "tests",
  53488. fn: function (){
  53489. var self=this,$self=this;
  53490. return $core.withContext(function($ctx1) {
  53491. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  53492. return self;
  53493. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  53494. },
  53495. args: [],
  53496. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  53497. referencedClasses: [],
  53498. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  53499. }),
  53500. $globals.SequenceableCollectionTest);
  53501. $core.addMethod(
  53502. $core.method({
  53503. selector: "testLastN",
  53504. protocol: "tests",
  53505. fn: function (){
  53506. var self=this,$self=this;
  53507. return $core.withContext(function($ctx1) {
  53508. var $2,$1,$4,$3,$6,$5,$7;
  53509. $2=$self._collection();
  53510. $ctx1.sendIdx["collection"]=1;
  53511. $1=$recv($2)._last_((2));
  53512. $ctx1.sendIdx["last:"]=1;
  53513. $self._assert_equals_($1,$self._collectionLastTwo());
  53514. $ctx1.sendIdx["assert:equals:"]=1;
  53515. $4=$self._collection();
  53516. $ctx1.sendIdx["collection"]=2;
  53517. $3=$recv($4)._last_((0));
  53518. $ctx1.sendIdx["last:"]=2;
  53519. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  53520. $ctx1.sendIdx["assert:equals:"]=2;
  53521. $6=$self._collection();
  53522. $ctx1.sendIdx["collection"]=3;
  53523. $5=$recv($6)._last_($self._collectionSize());
  53524. $ctx1.sendIdx["last:"]=3;
  53525. $7=$self._collection();
  53526. $ctx1.sendIdx["collection"]=4;
  53527. $self._assert_equals_($5,$7);
  53528. $self._should_raise_((function(){
  53529. return $core.withContext(function($ctx2) {
  53530. return $recv($self._collection())._last_((33));
  53531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53532. }),$globals.Error);
  53533. return self;
  53534. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  53535. },
  53536. args: [],
  53537. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  53538. referencedClasses: ["Error"],
  53539. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  53540. }),
  53541. $globals.SequenceableCollectionTest);
  53542. $core.addMethod(
  53543. $core.method({
  53544. selector: "testSecond",
  53545. protocol: "tests",
  53546. fn: function (){
  53547. var self=this,$self=this;
  53548. return $core.withContext(function($ctx1) {
  53549. var $2,$1;
  53550. $2=$self._collection();
  53551. $ctx1.sendIdx["collection"]=1;
  53552. $1=$recv($2)._second();
  53553. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  53554. return self;
  53555. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  53556. },
  53557. args: [],
  53558. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  53559. referencedClasses: [],
  53560. messageSends: ["assert:equals:", "second", "collection", "at:"]
  53561. }),
  53562. $globals.SequenceableCollectionTest);
  53563. $core.addMethod(
  53564. $core.method({
  53565. selector: "testThird",
  53566. protocol: "tests",
  53567. fn: function (){
  53568. var self=this,$self=this;
  53569. return $core.withContext(function($ctx1) {
  53570. var $2,$1;
  53571. $2=$self._collection();
  53572. $ctx1.sendIdx["collection"]=1;
  53573. $1=$recv($2)._third();
  53574. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  53575. return self;
  53576. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  53577. },
  53578. args: [],
  53579. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  53580. referencedClasses: [],
  53581. messageSends: ["assert:equals:", "third", "collection", "at:"]
  53582. }),
  53583. $globals.SequenceableCollectionTest);
  53584. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  53585. $core.addMethod(
  53586. $core.method({
  53587. selector: "collection",
  53588. protocol: "fixture",
  53589. fn: function (){
  53590. var self=this,$self=this;
  53591. return [(1), (2), (3), (-4)];
  53592. },
  53593. args: [],
  53594. source: "collection\x0a\x09^ #(1 2 3 -4)",
  53595. referencedClasses: [],
  53596. messageSends: []
  53597. }),
  53598. $globals.ArrayTest);
  53599. $core.addMethod(
  53600. $core.method({
  53601. selector: "collectionFirst",
  53602. protocol: "fixture",
  53603. fn: function (){
  53604. var self=this,$self=this;
  53605. return (1);
  53606. },
  53607. args: [],
  53608. source: "collectionFirst\x0a\x09^ 1",
  53609. referencedClasses: [],
  53610. messageSends: []
  53611. }),
  53612. $globals.ArrayTest);
  53613. $core.addMethod(
  53614. $core.method({
  53615. selector: "collectionFirstTwo",
  53616. protocol: "fixture",
  53617. fn: function (){
  53618. var self=this,$self=this;
  53619. return [(1), (2)];
  53620. },
  53621. args: [],
  53622. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  53623. referencedClasses: [],
  53624. messageSends: []
  53625. }),
  53626. $globals.ArrayTest);
  53627. $core.addMethod(
  53628. $core.method({
  53629. selector: "collectionLast",
  53630. protocol: "fixture",
  53631. fn: function (){
  53632. var self=this,$self=this;
  53633. return (-4);
  53634. },
  53635. args: [],
  53636. source: "collectionLast\x0a\x09^ -4",
  53637. referencedClasses: [],
  53638. messageSends: []
  53639. }),
  53640. $globals.ArrayTest);
  53641. $core.addMethod(
  53642. $core.method({
  53643. selector: "collectionLastTwo",
  53644. protocol: "fixture",
  53645. fn: function (){
  53646. var self=this,$self=this;
  53647. return [(3), (-4)];
  53648. },
  53649. args: [],
  53650. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  53651. referencedClasses: [],
  53652. messageSends: []
  53653. }),
  53654. $globals.ArrayTest);
  53655. $core.addMethod(
  53656. $core.method({
  53657. selector: "collectionOfPrintStrings",
  53658. protocol: "fixture",
  53659. fn: function (){
  53660. var self=this,$self=this;
  53661. return ["1", "2", "3", "-4"];
  53662. },
  53663. args: [],
  53664. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  53665. referencedClasses: [],
  53666. messageSends: []
  53667. }),
  53668. $globals.ArrayTest);
  53669. $core.addMethod(
  53670. $core.method({
  53671. selector: "collectionSize",
  53672. protocol: "fixture",
  53673. fn: function (){
  53674. var self=this,$self=this;
  53675. return (4);
  53676. },
  53677. args: [],
  53678. source: "collectionSize\x0a\x09^ 4",
  53679. referencedClasses: [],
  53680. messageSends: []
  53681. }),
  53682. $globals.ArrayTest);
  53683. $core.addMethod(
  53684. $core.method({
  53685. selector: "collectionWithDuplicates",
  53686. protocol: "fixture",
  53687. fn: function (){
  53688. var self=this,$self=this;
  53689. return ["a", "b", "c", (1), (2), (1), "a", []];
  53690. },
  53691. args: [],
  53692. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  53693. referencedClasses: [],
  53694. messageSends: []
  53695. }),
  53696. $globals.ArrayTest);
  53697. $core.addMethod(
  53698. $core.method({
  53699. selector: "collectionWithNewValue",
  53700. protocol: "fixture",
  53701. fn: function (){
  53702. var self=this,$self=this;
  53703. return [(1), (2), (3), (-4), "N"];
  53704. },
  53705. args: [],
  53706. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  53707. referencedClasses: [],
  53708. messageSends: []
  53709. }),
  53710. $globals.ArrayTest);
  53711. $core.addMethod(
  53712. $core.method({
  53713. selector: "sampleNewIndex",
  53714. protocol: "fixture",
  53715. fn: function (){
  53716. var self=this,$self=this;
  53717. return (5);
  53718. },
  53719. args: [],
  53720. source: "sampleNewIndex\x0a\x09^ 5",
  53721. referencedClasses: [],
  53722. messageSends: []
  53723. }),
  53724. $globals.ArrayTest);
  53725. $core.addMethod(
  53726. $core.method({
  53727. selector: "samplesDo:",
  53728. protocol: "fixture",
  53729. fn: function (aBlock){
  53730. var self=this,$self=this;
  53731. return $core.withContext(function($ctx1) {
  53732. (
  53733. $ctx1.supercall = true,
  53734. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  53735. $ctx1.supercall = false;
  53736. $recv(aBlock)._value_value_((3),(3));
  53737. return self;
  53738. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  53739. },
  53740. args: ["aBlock"],
  53741. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  53742. referencedClasses: [],
  53743. messageSends: ["samplesDo:", "value:value:"]
  53744. }),
  53745. $globals.ArrayTest);
  53746. $core.addMethod(
  53747. $core.method({
  53748. selector: "testAdd",
  53749. protocol: "tests",
  53750. fn: function (){
  53751. var self=this,$self=this;
  53752. var array;
  53753. return $core.withContext(function($ctx1) {
  53754. array=$self._collection();
  53755. $recv(array)._add_((6));
  53756. $self._assert_equals_($recv(array)._last(),(6));
  53757. return self;
  53758. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  53759. },
  53760. args: [],
  53761. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  53762. referencedClasses: [],
  53763. messageSends: ["collection", "add:", "assert:equals:", "last"]
  53764. }),
  53765. $globals.ArrayTest);
  53766. $core.addMethod(
  53767. $core.method({
  53768. selector: "testAddFirst",
  53769. protocol: "tests",
  53770. fn: function (){
  53771. var self=this,$self=this;
  53772. return $core.withContext(function($ctx1) {
  53773. var $3,$2,$1;
  53774. $3=$self._collection();
  53775. $recv($3)._addFirst_((0));
  53776. $2=$recv($3)._yourself();
  53777. $1=$recv($2)._first();
  53778. $self._assert_equals_($1,(0));
  53779. return self;
  53780. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  53781. },
  53782. args: [],
  53783. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  53784. referencedClasses: [],
  53785. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  53786. }),
  53787. $globals.ArrayTest);
  53788. $core.addMethod(
  53789. $core.method({
  53790. selector: "testPrintString",
  53791. protocol: "tests",
  53792. fn: function (){
  53793. var self=this,$self=this;
  53794. var array;
  53795. return $core.withContext(function($ctx1) {
  53796. var $1,$2,$3,$4,$5,$6,$7,$8;
  53797. array=$recv($globals.Array)._new();
  53798. $1=$recv(array)._printString();
  53799. $ctx1.sendIdx["printString"]=1;
  53800. $self._assert_equals_($1,"an Array ()");
  53801. $ctx1.sendIdx["assert:equals:"]=1;
  53802. $2=array;
  53803. $recv($2)._add_((1));
  53804. $ctx1.sendIdx["add:"]=1;
  53805. $3=$recv($2)._add_((3));
  53806. $ctx1.sendIdx["add:"]=2;
  53807. $4=$recv(array)._printString();
  53808. $ctx1.sendIdx["printString"]=2;
  53809. $self._assert_equals_($4,"an Array (1 3)");
  53810. $ctx1.sendIdx["assert:equals:"]=2;
  53811. $recv(array)._add_("foo");
  53812. $5=$recv(array)._printString();
  53813. $ctx1.sendIdx["printString"]=3;
  53814. $self._assert_equals_($5,"an Array (1 3 'foo')");
  53815. $ctx1.sendIdx["assert:equals:"]=3;
  53816. $6=array;
  53817. $recv($6)._remove_((1));
  53818. $ctx1.sendIdx["remove:"]=1;
  53819. $recv($6)._remove_((3));
  53820. $7=$recv(array)._printString();
  53821. $ctx1.sendIdx["printString"]=4;
  53822. $self._assert_equals_($7,"an Array ('foo')");
  53823. $ctx1.sendIdx["assert:equals:"]=4;
  53824. $recv(array)._addLast_((3));
  53825. $ctx1.sendIdx["addLast:"]=1;
  53826. $8=$recv(array)._printString();
  53827. $ctx1.sendIdx["printString"]=5;
  53828. $self._assert_equals_($8,"an Array ('foo' 3)");
  53829. $ctx1.sendIdx["assert:equals:"]=5;
  53830. $recv(array)._addLast_((3));
  53831. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  53832. return self;
  53833. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  53834. },
  53835. args: [],
  53836. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'an Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'an Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'an Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3 3)'.",
  53837. referencedClasses: ["Array"],
  53838. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  53839. }),
  53840. $globals.ArrayTest);
  53841. $core.addMethod(
  53842. $core.method({
  53843. selector: "testRemove",
  53844. protocol: "tests",
  53845. fn: function (){
  53846. var self=this,$self=this;
  53847. var array;
  53848. return $core.withContext(function($ctx1) {
  53849. array=[(1), (2), (3), (4), (5)];
  53850. $recv(array)._remove_((3));
  53851. $ctx1.sendIdx["remove:"]=1;
  53852. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  53853. $self._should_raise_((function(){
  53854. return $core.withContext(function($ctx2) {
  53855. return $recv(array)._remove_((3));
  53856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53857. }),$globals.Error);
  53858. return self;
  53859. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  53860. },
  53861. args: [],
  53862. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  53863. referencedClasses: ["Error"],
  53864. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  53865. }),
  53866. $globals.ArrayTest);
  53867. $core.addMethod(
  53868. $core.method({
  53869. selector: "testRemoveFromTo",
  53870. protocol: "tests",
  53871. fn: function (){
  53872. var self=this,$self=this;
  53873. return $core.withContext(function($ctx1) {
  53874. var $1,$2;
  53875. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  53876. $ctx1.sendIdx["removeFrom:to:"]=1;
  53877. $self._assert_equals_($1,[(4)]);
  53878. $ctx1.sendIdx["assert:equals:"]=1;
  53879. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  53880. $ctx1.sendIdx["removeFrom:to:"]=2;
  53881. $self._assert_equals_($2,[(1), (4)]);
  53882. $ctx1.sendIdx["assert:equals:"]=2;
  53883. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  53884. return self;
  53885. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  53886. },
  53887. args: [],
  53888. source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)",
  53889. referencedClasses: [],
  53890. messageSends: ["assert:equals:", "removeFrom:to:"]
  53891. }),
  53892. $globals.ArrayTest);
  53893. $core.addMethod(
  53894. $core.method({
  53895. selector: "testRemoveIndex",
  53896. protocol: "tests",
  53897. fn: function (){
  53898. var self=this,$self=this;
  53899. return $core.withContext(function($ctx1) {
  53900. var $1,$2;
  53901. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  53902. $ctx1.sendIdx["removeIndex:"]=1;
  53903. $self._assert_equals_($1,[(1), (3), (4)]);
  53904. $ctx1.sendIdx["assert:equals:"]=1;
  53905. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  53906. $ctx1.sendIdx["removeIndex:"]=2;
  53907. $self._assert_equals_($2,[(2), (3), (4)]);
  53908. $ctx1.sendIdx["assert:equals:"]=2;
  53909. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  53910. return self;
  53911. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  53912. },
  53913. args: [],
  53914. source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()",
  53915. referencedClasses: [],
  53916. messageSends: ["assert:equals:", "removeIndex:"]
  53917. }),
  53918. $globals.ArrayTest);
  53919. $core.addMethod(
  53920. $core.method({
  53921. selector: "testRemoveLast",
  53922. protocol: "tests",
  53923. fn: function (){
  53924. var self=this,$self=this;
  53925. var array;
  53926. return $core.withContext(function($ctx1) {
  53927. array=[(1), (2)];
  53928. $recv(array)._removeLast();
  53929. $self._assert_equals_($recv(array)._last(),(1));
  53930. return self;
  53931. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  53932. },
  53933. args: [],
  53934. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  53935. referencedClasses: [],
  53936. messageSends: ["removeLast", "assert:equals:", "last"]
  53937. }),
  53938. $globals.ArrayTest);
  53939. $core.addMethod(
  53940. $core.method({
  53941. selector: "testReversed",
  53942. protocol: "tests",
  53943. fn: function (){
  53944. var self=this,$self=this;
  53945. var array;
  53946. return $core.withContext(function($ctx1) {
  53947. array=[(5), (4), (3), (2), (1)];
  53948. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  53949. return self;
  53950. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  53951. },
  53952. args: [],
  53953. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  53954. referencedClasses: [],
  53955. messageSends: ["assert:equals:", "reversed"]
  53956. }),
  53957. $globals.ArrayTest);
  53958. $core.addMethod(
  53959. $core.method({
  53960. selector: "testSort",
  53961. protocol: "tests",
  53962. fn: function (){
  53963. var self=this,$self=this;
  53964. var array;
  53965. return $core.withContext(function($ctx1) {
  53966. array=[(10), (1), (5)];
  53967. $recv(array)._sort();
  53968. $self._assert_equals_(array,[(1), (5), (10)]);
  53969. return self;
  53970. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  53971. },
  53972. args: [],
  53973. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  53974. referencedClasses: [],
  53975. messageSends: ["sort", "assert:equals:"]
  53976. }),
  53977. $globals.ArrayTest);
  53978. $core.addMethod(
  53979. $core.method({
  53980. selector: "collectionClass",
  53981. protocol: "fixture",
  53982. fn: function (){
  53983. var self=this,$self=this;
  53984. return $globals.Array;
  53985. },
  53986. args: [],
  53987. source: "collectionClass\x0a\x09^ Array",
  53988. referencedClasses: ["Array"],
  53989. messageSends: []
  53990. }),
  53991. $globals.ArrayTest.a$cls);
  53992. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  53993. $core.addMethod(
  53994. $core.method({
  53995. selector: "collection",
  53996. protocol: "fixture",
  53997. fn: function (){
  53998. var self=this,$self=this;
  53999. return "helLo";
  54000. },
  54001. args: [],
  54002. source: "collection\x0a\x09^ 'helLo'",
  54003. referencedClasses: [],
  54004. messageSends: []
  54005. }),
  54006. $globals.StringTest);
  54007. $core.addMethod(
  54008. $core.method({
  54009. selector: "collectionFirst",
  54010. protocol: "fixture",
  54011. fn: function (){
  54012. var self=this,$self=this;
  54013. return "h";
  54014. },
  54015. args: [],
  54016. source: "collectionFirst\x0a\x09^ 'h'",
  54017. referencedClasses: [],
  54018. messageSends: []
  54019. }),
  54020. $globals.StringTest);
  54021. $core.addMethod(
  54022. $core.method({
  54023. selector: "collectionFirstTwo",
  54024. protocol: "fixture",
  54025. fn: function (){
  54026. var self=this,$self=this;
  54027. return "he";
  54028. },
  54029. args: [],
  54030. source: "collectionFirstTwo\x0a\x09^ 'he'",
  54031. referencedClasses: [],
  54032. messageSends: []
  54033. }),
  54034. $globals.StringTest);
  54035. $core.addMethod(
  54036. $core.method({
  54037. selector: "collectionLast",
  54038. protocol: "fixture",
  54039. fn: function (){
  54040. var self=this,$self=this;
  54041. return "o";
  54042. },
  54043. args: [],
  54044. source: "collectionLast\x0a\x09^ 'o'",
  54045. referencedClasses: [],
  54046. messageSends: []
  54047. }),
  54048. $globals.StringTest);
  54049. $core.addMethod(
  54050. $core.method({
  54051. selector: "collectionLastTwo",
  54052. protocol: "fixture",
  54053. fn: function (){
  54054. var self=this,$self=this;
  54055. return "Lo";
  54056. },
  54057. args: [],
  54058. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  54059. referencedClasses: [],
  54060. messageSends: []
  54061. }),
  54062. $globals.StringTest);
  54063. $core.addMethod(
  54064. $core.method({
  54065. selector: "collectionOfPrintStrings",
  54066. protocol: "fixture",
  54067. fn: function (){
  54068. var self=this,$self=this;
  54069. return "'h''e''l''L''o'";
  54070. },
  54071. args: [],
  54072. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  54073. referencedClasses: [],
  54074. messageSends: []
  54075. }),
  54076. $globals.StringTest);
  54077. $core.addMethod(
  54078. $core.method({
  54079. selector: "collectionSize",
  54080. protocol: "fixture",
  54081. fn: function (){
  54082. var self=this,$self=this;
  54083. return (5);
  54084. },
  54085. args: [],
  54086. source: "collectionSize\x0a\x09^ 5",
  54087. referencedClasses: [],
  54088. messageSends: []
  54089. }),
  54090. $globals.StringTest);
  54091. $core.addMethod(
  54092. $core.method({
  54093. selector: "collectionWithDuplicates",
  54094. protocol: "fixture",
  54095. fn: function (){
  54096. var self=this,$self=this;
  54097. return "abbaerten";
  54098. },
  54099. args: [],
  54100. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  54101. referencedClasses: [],
  54102. messageSends: []
  54103. }),
  54104. $globals.StringTest);
  54105. $core.addMethod(
  54106. $core.method({
  54107. selector: "collectionWithNewValue",
  54108. protocol: "fixture",
  54109. fn: function (){
  54110. var self=this,$self=this;
  54111. return "helLoN";
  54112. },
  54113. args: [],
  54114. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  54115. referencedClasses: [],
  54116. messageSends: []
  54117. }),
  54118. $globals.StringTest);
  54119. $core.addMethod(
  54120. $core.method({
  54121. selector: "sampleNewValueAsCollection",
  54122. protocol: "fixture",
  54123. fn: function (){
  54124. var self=this,$self=this;
  54125. return "N";
  54126. },
  54127. args: [],
  54128. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  54129. referencedClasses: [],
  54130. messageSends: []
  54131. }),
  54132. $globals.StringTest);
  54133. $core.addMethod(
  54134. $core.method({
  54135. selector: "samplesDo:",
  54136. protocol: "fixture",
  54137. fn: function (aBlock){
  54138. var self=this,$self=this;
  54139. return $core.withContext(function($ctx1) {
  54140. (
  54141. $ctx1.supercall = true,
  54142. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54143. $ctx1.supercall = false;
  54144. $recv(aBlock)._value_value_((3),"l");
  54145. return self;
  54146. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  54147. },
  54148. args: ["aBlock"],
  54149. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  54150. referencedClasses: [],
  54151. messageSends: ["samplesDo:", "value:value:"]
  54152. }),
  54153. $globals.StringTest);
  54154. $core.addMethod(
  54155. $core.method({
  54156. selector: "testAddAll",
  54157. protocol: "tests",
  54158. fn: function (){
  54159. var self=this,$self=this;
  54160. return $core.withContext(function($ctx1) {
  54161. var $1;
  54162. $self._should_raise_((function(){
  54163. return $core.withContext(function($ctx2) {
  54164. $1=$self._collection();
  54165. $ctx2.sendIdx["collection"]=1;
  54166. return $recv($1)._addAll_($self._collection());
  54167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54168. }),$globals.Error);
  54169. return self;
  54170. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  54171. },
  54172. args: [],
  54173. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  54174. referencedClasses: ["Error"],
  54175. messageSends: ["should:raise:", "addAll:", "collection"]
  54176. }),
  54177. $globals.StringTest);
  54178. $core.addMethod(
  54179. $core.method({
  54180. selector: "testAddRemove",
  54181. protocol: "tests",
  54182. fn: function (){
  54183. var self=this,$self=this;
  54184. return $core.withContext(function($ctx1) {
  54185. $self._should_raise_((function(){
  54186. return $core.withContext(function($ctx2) {
  54187. return "hello"._add_("a");
  54188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54189. }),$globals.Error);
  54190. $ctx1.sendIdx["should:raise:"]=1;
  54191. $self._should_raise_((function(){
  54192. return $core.withContext(function($ctx2) {
  54193. return "hello"._remove_("h");
  54194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54195. }),$globals.Error);
  54196. return self;
  54197. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  54198. },
  54199. args: [],
  54200. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  54201. referencedClasses: ["Error"],
  54202. messageSends: ["should:raise:", "add:", "remove:"]
  54203. }),
  54204. $globals.StringTest);
  54205. $core.addMethod(
  54206. $core.method({
  54207. selector: "testAsArray",
  54208. protocol: "tests",
  54209. fn: function (){
  54210. var self=this,$self=this;
  54211. return $core.withContext(function($ctx1) {
  54212. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  54213. return self;
  54214. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  54215. },
  54216. args: [],
  54217. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  54218. referencedClasses: [],
  54219. messageSends: ["assert:equals:", "asArray"]
  54220. }),
  54221. $globals.StringTest);
  54222. $core.addMethod(
  54223. $core.method({
  54224. selector: "testAsLowerCase",
  54225. protocol: "tests",
  54226. fn: function (){
  54227. var self=this,$self=this;
  54228. return $core.withContext(function($ctx1) {
  54229. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  54230. return self;
  54231. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  54232. },
  54233. args: [],
  54234. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  54235. referencedClasses: [],
  54236. messageSends: ["assert:equals:", "asLowercase"]
  54237. }),
  54238. $globals.StringTest);
  54239. $core.addMethod(
  54240. $core.method({
  54241. selector: "testAsNumber",
  54242. protocol: "tests",
  54243. fn: function (){
  54244. var self=this,$self=this;
  54245. return $core.withContext(function($ctx1) {
  54246. var $1,$2;
  54247. $1="3"._asNumber();
  54248. $ctx1.sendIdx["asNumber"]=1;
  54249. $self._assert_equals_($1,(3));
  54250. $ctx1.sendIdx["assert:equals:"]=1;
  54251. $2="-3"._asNumber();
  54252. $ctx1.sendIdx["asNumber"]=2;
  54253. $self._assert_equals_($2,(-3));
  54254. $ctx1.sendIdx["assert:equals:"]=2;
  54255. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  54256. return self;
  54257. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  54258. },
  54259. args: [],
  54260. source: "testAsNumber\x0a\x09self assert: '3' asNumber equals: 3.\x0a\x09self assert: '-3' asNumber equals: -3.\x0a\x09self assert: '-1.5' asNumber equals: -1.5.",
  54261. referencedClasses: [],
  54262. messageSends: ["assert:equals:", "asNumber"]
  54263. }),
  54264. $globals.StringTest);
  54265. $core.addMethod(
  54266. $core.method({
  54267. selector: "testAsUpperCase",
  54268. protocol: "tests",
  54269. fn: function (){
  54270. var self=this,$self=this;
  54271. return $core.withContext(function($ctx1) {
  54272. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  54273. return self;
  54274. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  54275. },
  54276. args: [],
  54277. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  54278. referencedClasses: [],
  54279. messageSends: ["assert:equals:", "asUppercase"]
  54280. }),
  54281. $globals.StringTest);
  54282. $core.addMethod(
  54283. $core.method({
  54284. selector: "testAsciiValue",
  54285. protocol: "tests",
  54286. fn: function (){
  54287. var self=this,$self=this;
  54288. var characterA,characterU;
  54289. return $core.withContext(function($ctx1) {
  54290. var $1;
  54291. characterA="A";
  54292. characterU="U";
  54293. $1=$recv(characterA)._asciiValue();
  54294. $ctx1.sendIdx["asciiValue"]=1;
  54295. $self._assert_equals_($1,(65));
  54296. $ctx1.sendIdx["assert:equals:"]=1;
  54297. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  54298. return self;
  54299. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  54300. },
  54301. args: [],
  54302. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  54303. referencedClasses: [],
  54304. messageSends: ["assert:equals:", "asciiValue"]
  54305. }),
  54306. $globals.StringTest);
  54307. $core.addMethod(
  54308. $core.method({
  54309. selector: "testAtIfAbsentPut",
  54310. protocol: "tests",
  54311. fn: function (){
  54312. var self=this,$self=this;
  54313. return $core.withContext(function($ctx1) {
  54314. $self._should_raise_((function(){
  54315. return $core.withContext(function($ctx2) {
  54316. return "hello"._at_ifAbsentPut_((6),(function(){
  54317. return "a";
  54318. }));
  54319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54320. }),$globals.Error);
  54321. return self;
  54322. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  54323. },
  54324. args: [],
  54325. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  54326. referencedClasses: ["Error"],
  54327. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  54328. }),
  54329. $globals.StringTest);
  54330. $core.addMethod(
  54331. $core.method({
  54332. selector: "testAtPut",
  54333. protocol: "tests",
  54334. fn: function (){
  54335. var self=this,$self=this;
  54336. return $core.withContext(function($ctx1) {
  54337. $self._should_raise_((function(){
  54338. return $core.withContext(function($ctx2) {
  54339. return "hello"._at_put_((1),"a");
  54340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54341. }),$globals.Error);
  54342. return self;
  54343. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  54344. },
  54345. args: [],
  54346. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  54347. referencedClasses: ["Error"],
  54348. messageSends: ["should:raise:", "at:put:"]
  54349. }),
  54350. $globals.StringTest);
  54351. $core.addMethod(
  54352. $core.method({
  54353. selector: "testCapitalized",
  54354. protocol: "tests",
  54355. fn: function (){
  54356. var self=this,$self=this;
  54357. return $core.withContext(function($ctx1) {
  54358. var $1,$2,$3;
  54359. $1="test"._capitalized();
  54360. $ctx1.sendIdx["capitalized"]=1;
  54361. $self._assert_equals_($1,"Test");
  54362. $ctx1.sendIdx["assert:equals:"]=1;
  54363. $2="Test"._capitalized();
  54364. $ctx1.sendIdx["capitalized"]=2;
  54365. $self._assert_equals_($2,"Test");
  54366. $ctx1.sendIdx["assert:equals:"]=2;
  54367. $self._assert_equals_(""._capitalized(),"");
  54368. $ctx1.sendIdx["assert:equals:"]=3;
  54369. $3="Test"._isCapitalized();
  54370. $ctx1.sendIdx["isCapitalized"]=1;
  54371. $self._assert_equals_($3,true);
  54372. $ctx1.sendIdx["assert:equals:"]=4;
  54373. $self._assert_equals_("test"._isCapitalized(),false);
  54374. return self;
  54375. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  54376. },
  54377. args: [],
  54378. source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.",
  54379. referencedClasses: [],
  54380. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  54381. }),
  54382. $globals.StringTest);
  54383. $core.addMethod(
  54384. $core.method({
  54385. selector: "testCharCodeAt",
  54386. protocol: "tests",
  54387. fn: function (){
  54388. var self=this,$self=this;
  54389. return $core.withContext(function($ctx1) {
  54390. var $1,$2,$3,$4,$5;
  54391. $1="jackie"._charCodeAt_((1));
  54392. $ctx1.sendIdx["charCodeAt:"]=1;
  54393. $self._assert_equals_($1,(106));
  54394. $ctx1.sendIdx["assert:equals:"]=1;
  54395. $2="jackie"._charCodeAt_((2));
  54396. $ctx1.sendIdx["charCodeAt:"]=2;
  54397. $self._assert_equals_($2,(97));
  54398. $ctx1.sendIdx["assert:equals:"]=2;
  54399. $3="jackie"._charCodeAt_((3));
  54400. $ctx1.sendIdx["charCodeAt:"]=3;
  54401. $self._assert_equals_($3,(99));
  54402. $ctx1.sendIdx["assert:equals:"]=3;
  54403. $4="jackie"._charCodeAt_((4));
  54404. $ctx1.sendIdx["charCodeAt:"]=4;
  54405. $self._assert_equals_($4,(107));
  54406. $ctx1.sendIdx["assert:equals:"]=4;
  54407. $5="jackie"._charCodeAt_((5));
  54408. $ctx1.sendIdx["charCodeAt:"]=5;
  54409. $self._assert_equals_($5,(105));
  54410. $ctx1.sendIdx["assert:equals:"]=5;
  54411. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  54412. return self;
  54413. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  54414. },
  54415. args: [],
  54416. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  54417. referencedClasses: [],
  54418. messageSends: ["assert:equals:", "charCodeAt:"]
  54419. }),
  54420. $globals.StringTest);
  54421. $core.addMethod(
  54422. $core.method({
  54423. selector: "testCopyFromTo",
  54424. protocol: "tests",
  54425. fn: function (){
  54426. var self=this,$self=this;
  54427. return $core.withContext(function($ctx1) {
  54428. var $1;
  54429. $1="jackie"._copyFrom_to_((1),(3));
  54430. $ctx1.sendIdx["copyFrom:to:"]=1;
  54431. $self._assert_equals_($1,"jac");
  54432. $ctx1.sendIdx["assert:equals:"]=1;
  54433. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  54434. return self;
  54435. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  54436. },
  54437. args: [],
  54438. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  54439. referencedClasses: [],
  54440. messageSends: ["assert:equals:", "copyFrom:to:"]
  54441. }),
  54442. $globals.StringTest);
  54443. $core.addMethod(
  54444. $core.method({
  54445. selector: "testCopySeparates",
  54446. protocol: "tests",
  54447. fn: function (){
  54448. var self=this,$self=this;
  54449. return $core.withContext(function($ctx1) {
  54450. var $3,$2,$1;
  54451. $3=$self._collection();
  54452. $ctx1.sendIdx["collection"]=1;
  54453. $2=$recv($3)._copy();
  54454. $1=$recv($2).__eq_eq($self._collection());
  54455. $self._assert_($1);
  54456. return self;
  54457. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  54458. },
  54459. args: [],
  54460. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  54461. referencedClasses: [],
  54462. messageSends: ["assert:", "==", "copy", "collection"]
  54463. }),
  54464. $globals.StringTest);
  54465. $core.addMethod(
  54466. $core.method({
  54467. selector: "testCopyWithoutAll",
  54468. protocol: "tests",
  54469. fn: function (){
  54470. var self=this,$self=this;
  54471. return $core.withContext(function($ctx1) {
  54472. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  54473. return self;
  54474. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  54475. },
  54476. args: [],
  54477. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  54478. referencedClasses: [],
  54479. messageSends: ["assert:equals:", "copyWithoutAll:"]
  54480. }),
  54481. $globals.StringTest);
  54482. $core.addMethod(
  54483. $core.method({
  54484. selector: "testEquality",
  54485. protocol: "tests",
  54486. fn: function (){
  54487. var self=this,$self=this;
  54488. return $core.withContext(function($ctx1) {
  54489. var $1,$2,$3;
  54490. $self._assert_equals_("hello","hello");
  54491. $ctx1.sendIdx["assert:equals:"]=1;
  54492. $1="hello".__eq("world");
  54493. $ctx1.sendIdx["="]=1;
  54494. $self._deny_($1);
  54495. $ctx1.sendIdx["deny:"]=1;
  54496. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  54497. })));
  54498. $ctx1.sendIdx["="]=2;
  54499. $self._deny_($2);
  54500. $ctx1.sendIdx["deny:"]=2;
  54501. $3="hello"._yourself();
  54502. $ctx1.sendIdx["yourself"]=1;
  54503. $self._assert_equals_("hello",$3);
  54504. $ctx1.sendIdx["assert:equals:"]=2;
  54505. $self._assert_equals_("hello"._yourself(),"hello");
  54506. $self._deny_("".__eq((0)));
  54507. return self;
  54508. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  54509. },
  54510. args: [],
  54511. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  54512. referencedClasses: [],
  54513. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  54514. }),
  54515. $globals.StringTest);
  54516. $core.addMethod(
  54517. $core.method({
  54518. selector: "testIdentity",
  54519. protocol: "tests",
  54520. fn: function (){
  54521. var self=this,$self=this;
  54522. return $core.withContext(function($ctx1) {
  54523. var $1,$2,$4,$3,$5;
  54524. $1="hello".__eq_eq("hello");
  54525. $ctx1.sendIdx["=="]=1;
  54526. $self._assert_($1);
  54527. $ctx1.sendIdx["assert:"]=1;
  54528. $2="hello".__eq_eq("world");
  54529. $ctx1.sendIdx["=="]=2;
  54530. $self._deny_($2);
  54531. $ctx1.sendIdx["deny:"]=1;
  54532. $4="hello"._yourself();
  54533. $ctx1.sendIdx["yourself"]=1;
  54534. $3="hello".__eq_eq($4);
  54535. $ctx1.sendIdx["=="]=3;
  54536. $self._assert_($3);
  54537. $ctx1.sendIdx["assert:"]=2;
  54538. $5=$recv("hello"._yourself()).__eq_eq("hello");
  54539. $ctx1.sendIdx["=="]=4;
  54540. $self._assert_($5);
  54541. $self._deny_("".__eq_eq((0)));
  54542. return self;
  54543. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  54544. },
  54545. args: [],
  54546. source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0",
  54547. referencedClasses: [],
  54548. messageSends: ["assert:", "==", "deny:", "yourself"]
  54549. }),
  54550. $globals.StringTest);
  54551. $core.addMethod(
  54552. $core.method({
  54553. selector: "testIncludesSubString",
  54554. protocol: "tests",
  54555. fn: function (){
  54556. var self=this,$self=this;
  54557. return $core.withContext(function($ctx1) {
  54558. var $1;
  54559. $1="amber"._includesSubString_("ber");
  54560. $ctx1.sendIdx["includesSubString:"]=1;
  54561. $self._assert_($1);
  54562. $self._deny_("amber"._includesSubString_("zork"));
  54563. return self;
  54564. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  54565. },
  54566. args: [],
  54567. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  54568. referencedClasses: [],
  54569. messageSends: ["assert:", "includesSubString:", "deny:"]
  54570. }),
  54571. $globals.StringTest);
  54572. $core.addMethod(
  54573. $core.method({
  54574. selector: "testIndexOfStartingAtWithNull",
  54575. protocol: "tests",
  54576. fn: function (){
  54577. var self=this,$self=this;
  54578. return self;
  54579. },
  54580. args: [],
  54581. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  54582. referencedClasses: [],
  54583. messageSends: []
  54584. }),
  54585. $globals.StringTest);
  54586. $core.addMethod(
  54587. $core.method({
  54588. selector: "testIndexOfWithNull",
  54589. protocol: "tests",
  54590. fn: function (){
  54591. var self=this,$self=this;
  54592. return self;
  54593. },
  54594. args: [],
  54595. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  54596. referencedClasses: [],
  54597. messageSends: []
  54598. }),
  54599. $globals.StringTest);
  54600. $core.addMethod(
  54601. $core.method({
  54602. selector: "testIsVowel",
  54603. protocol: "tests",
  54604. fn: function (){
  54605. var self=this,$self=this;
  54606. var vowel,consonant;
  54607. return $core.withContext(function($ctx1) {
  54608. var $1;
  54609. vowel="u";
  54610. consonant="z";
  54611. $1=$recv(vowel)._isVowel();
  54612. $ctx1.sendIdx["isVowel"]=1;
  54613. $self._assert_equals_($1,true);
  54614. $ctx1.sendIdx["assert:equals:"]=1;
  54615. $self._assert_equals_($recv(consonant)._isVowel(),false);
  54616. return self;
  54617. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  54618. },
  54619. args: [],
  54620. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  54621. referencedClasses: [],
  54622. messageSends: ["assert:equals:", "isVowel"]
  54623. }),
  54624. $globals.StringTest);
  54625. $core.addMethod(
  54626. $core.method({
  54627. selector: "testJoin",
  54628. protocol: "tests",
  54629. fn: function (){
  54630. var self=this,$self=this;
  54631. return $core.withContext(function($ctx1) {
  54632. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  54633. return self;
  54634. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  54635. },
  54636. args: [],
  54637. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  54638. referencedClasses: [],
  54639. messageSends: ["assert:equals:", "join:"]
  54640. }),
  54641. $globals.StringTest);
  54642. $core.addMethod(
  54643. $core.method({
  54644. selector: "testRemoveAll",
  54645. protocol: "tests",
  54646. fn: function (){
  54647. var self=this,$self=this;
  54648. return $core.withContext(function($ctx1) {
  54649. $self._should_raise_((function(){
  54650. return $core.withContext(function($ctx2) {
  54651. return $recv($self._collection())._removeAll();
  54652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54653. }),$globals.Error);
  54654. return self;
  54655. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  54656. },
  54657. args: [],
  54658. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  54659. referencedClasses: ["Error"],
  54660. messageSends: ["should:raise:", "removeAll", "collection"]
  54661. }),
  54662. $globals.StringTest);
  54663. $core.addMethod(
  54664. $core.method({
  54665. selector: "testReversed",
  54666. protocol: "tests",
  54667. fn: function (){
  54668. var self=this,$self=this;
  54669. return $core.withContext(function($ctx1) {
  54670. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  54671. return self;
  54672. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  54673. },
  54674. args: [],
  54675. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  54676. referencedClasses: [],
  54677. messageSends: ["assert:equals:", "reversed"]
  54678. }),
  54679. $globals.StringTest);
  54680. $core.addMethod(
  54681. $core.method({
  54682. selector: "testStreamContents",
  54683. protocol: "tests",
  54684. fn: function (){
  54685. var self=this,$self=this;
  54686. return $core.withContext(function($ctx1) {
  54687. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  54688. return $core.withContext(function($ctx2) {
  54689. $recv(aStream)._nextPutAll_("hello");
  54690. $ctx2.sendIdx["nextPutAll:"]=1;
  54691. $recv(aStream)._space();
  54692. return $recv(aStream)._nextPutAll_("world");
  54693. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  54694. })),"hello world");
  54695. return self;
  54696. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  54697. },
  54698. args: [],
  54699. source: "testStreamContents\x0a\x09self\x0a\x09\x09assert: (String streamContents: [ :aStream |\x0a\x09\x09\x09aStream\x0a\x09\x09\x09\x09nextPutAll: 'hello'; space;\x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'",
  54700. referencedClasses: ["String"],
  54701. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  54702. }),
  54703. $globals.StringTest);
  54704. $core.addMethod(
  54705. $core.method({
  54706. selector: "testSubStrings",
  54707. protocol: "tests",
  54708. fn: function (){
  54709. var self=this,$self=this;
  54710. return $core.withContext(function($ctx1) {
  54711. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  54712. return self;
  54713. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  54714. },
  54715. args: [],
  54716. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  54717. referencedClasses: [],
  54718. messageSends: ["assert:equals:", "subStrings:"]
  54719. }),
  54720. $globals.StringTest);
  54721. $core.addMethod(
  54722. $core.method({
  54723. selector: "testTrim",
  54724. protocol: "tests",
  54725. fn: function (){
  54726. var self=this,$self=this;
  54727. return $core.withContext(function($ctx1) {
  54728. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  54729. $ctx1.sendIdx["assert:equals:"]=1;
  54730. $self._assert_equals_("jackie "._trimRight(),"jackie");
  54731. return self;
  54732. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  54733. },
  54734. args: [],
  54735. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  54736. referencedClasses: [],
  54737. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  54738. }),
  54739. $globals.StringTest);
  54740. $core.addMethod(
  54741. $core.method({
  54742. selector: "testValue",
  54743. protocol: "tests",
  54744. fn: function (){
  54745. var self=this,$self=this;
  54746. return $core.withContext(function($ctx1) {
  54747. $self._assert_equals_("asString"._value_((1)),"1");
  54748. $ctx1.sendIdx["assert:equals:"]=1;
  54749. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  54750. return self;
  54751. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  54752. },
  54753. args: [],
  54754. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  54755. referencedClasses: [],
  54756. messageSends: ["assert:equals:", "value:", "collect:"]
  54757. }),
  54758. $globals.StringTest);
  54759. $core.addMethod(
  54760. $core.method({
  54761. selector: "collectionClass",
  54762. protocol: "fixture",
  54763. fn: function (){
  54764. var self=this,$self=this;
  54765. return $globals.String;
  54766. },
  54767. args: [],
  54768. source: "collectionClass\x0a\x09^ String",
  54769. referencedClasses: ["String"],
  54770. messageSends: []
  54771. }),
  54772. $globals.StringTest.a$cls);
  54773. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  54774. $core.addMethod(
  54775. $core.method({
  54776. selector: "collection",
  54777. protocol: "fixture",
  54778. fn: function (){
  54779. var self=this,$self=this;
  54780. return $core.withContext(function($ctx1) {
  54781. var $1;
  54782. $1=$recv($globals.Set)._new();
  54783. $recv($1)._add_($globals.Smalltalk);
  54784. $ctx1.sendIdx["add:"]=1;
  54785. $recv($1)._add_(nil);
  54786. $ctx1.sendIdx["add:"]=2;
  54787. $recv($1)._add_((3).__at((3)));
  54788. $ctx1.sendIdx["add:"]=3;
  54789. $recv($1)._add_(false);
  54790. $ctx1.sendIdx["add:"]=4;
  54791. $recv($1)._add_($self["@sampleBlock"]);
  54792. return $recv($1)._yourself();
  54793. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  54794. },
  54795. args: [],
  54796. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09add: sampleBlock;\x0a\x09\x09yourself",
  54797. referencedClasses: ["Set", "Smalltalk"],
  54798. messageSends: ["add:", "new", "@", "yourself"]
  54799. }),
  54800. $globals.SetTest);
  54801. $core.addMethod(
  54802. $core.method({
  54803. selector: "collectionOfPrintStrings",
  54804. protocol: "fixture",
  54805. fn: function (){
  54806. var self=this,$self=this;
  54807. return $core.withContext(function($ctx1) {
  54808. var $1;
  54809. $1=$recv($globals.Set)._new();
  54810. $recv($1)._add_("a SmalltalkImage");
  54811. $ctx1.sendIdx["add:"]=1;
  54812. $recv($1)._add_("nil");
  54813. $ctx1.sendIdx["add:"]=2;
  54814. $recv($1)._add_("3@3");
  54815. $ctx1.sendIdx["add:"]=3;
  54816. $recv($1)._add_("false");
  54817. $ctx1.sendIdx["add:"]=4;
  54818. $recv($1)._add_("a BlockClosure");
  54819. return $recv($1)._yourself();
  54820. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  54821. },
  54822. args: [],
  54823. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09add: 'a BlockClosure';\x0a\x09\x09yourself",
  54824. referencedClasses: ["Set"],
  54825. messageSends: ["add:", "new", "yourself"]
  54826. }),
  54827. $globals.SetTest);
  54828. $core.addMethod(
  54829. $core.method({
  54830. selector: "collectionSize",
  54831. protocol: "fixture",
  54832. fn: function (){
  54833. var self=this,$self=this;
  54834. return (5);
  54835. },
  54836. args: [],
  54837. source: "collectionSize\x0a\x09^ 5",
  54838. referencedClasses: [],
  54839. messageSends: []
  54840. }),
  54841. $globals.SetTest);
  54842. $core.addMethod(
  54843. $core.method({
  54844. selector: "collectionWithDuplicates",
  54845. protocol: "fixture",
  54846. fn: function (){
  54847. var self=this,$self=this;
  54848. return $core.withContext(function($ctx1) {
  54849. var $1;
  54850. $1=$self._collection();
  54851. $recv($1)._add_((0));
  54852. return $recv($1)._yourself();
  54853. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  54854. },
  54855. args: [],
  54856. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  54857. referencedClasses: [],
  54858. messageSends: ["add:", "collection", "yourself"]
  54859. }),
  54860. $globals.SetTest);
  54861. $core.addMethod(
  54862. $core.method({
  54863. selector: "collectionWithNewValue",
  54864. protocol: "fixture",
  54865. fn: function (){
  54866. var self=this,$self=this;
  54867. return $core.withContext(function($ctx1) {
  54868. var $1;
  54869. $1=$recv($globals.Set)._new();
  54870. $recv($1)._add_($globals.Smalltalk);
  54871. $ctx1.sendIdx["add:"]=1;
  54872. $recv($1)._add_(nil);
  54873. $ctx1.sendIdx["add:"]=2;
  54874. $recv($1)._add_((3).__at((3)));
  54875. $ctx1.sendIdx["add:"]=3;
  54876. $recv($1)._add_("N");
  54877. $ctx1.sendIdx["add:"]=4;
  54878. $recv($1)._add_(false);
  54879. $ctx1.sendIdx["add:"]=5;
  54880. $recv($1)._add_($self["@sampleBlock"]);
  54881. return $recv($1)._yourself();
  54882. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  54883. },
  54884. args: [],
  54885. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09add: sampleBlock;\x0a\x09\x09yourself",
  54886. referencedClasses: ["Set", "Smalltalk"],
  54887. messageSends: ["add:", "new", "@", "yourself"]
  54888. }),
  54889. $globals.SetTest);
  54890. $core.addMethod(
  54891. $core.method({
  54892. selector: "testAddAll",
  54893. protocol: "tests",
  54894. fn: function (){
  54895. var self=this,$self=this;
  54896. return $core.withContext(function($ctx1) {
  54897. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  54898. (
  54899. $ctx1.supercall = true,
  54900. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  54901. $ctx1.supercall = false;
  54902. $2=$self._collection();
  54903. $ctx1.sendIdx["collection"]=1;
  54904. $3=$self._collection();
  54905. $ctx1.sendIdx["collection"]=2;
  54906. $recv($2)._addAll_($3);
  54907. $ctx1.sendIdx["addAll:"]=1;
  54908. $4=$recv($2)._yourself();
  54909. $ctx1.sendIdx["yourself"]=1;
  54910. $1=$4;
  54911. $5=$self._collection();
  54912. $ctx1.sendIdx["collection"]=3;
  54913. $self._assert_equals_($1,$5);
  54914. $ctx1.sendIdx["assert:equals:"]=1;
  54915. $7=$self._collection();
  54916. $ctx1.sendIdx["collection"]=4;
  54917. $8=$self._collectionWithNewValue();
  54918. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54919. $recv($7)._addAll_($8);
  54920. $ctx1.sendIdx["addAll:"]=2;
  54921. $9=$recv($7)._yourself();
  54922. $ctx1.sendIdx["yourself"]=2;
  54923. $6=$9;
  54924. $10=$self._collectionWithNewValue();
  54925. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54926. $self._assert_equals_($6,$10);
  54927. $ctx1.sendIdx["assert:equals:"]=2;
  54928. $12=$self._collectionWithNewValue();
  54929. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54930. $recv($12)._addAll_($self._collection());
  54931. $11=$recv($12)._yourself();
  54932. $self._assert_equals_($11,$self._collectionWithNewValue());
  54933. return self;
  54934. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  54935. },
  54936. args: [],
  54937. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  54938. referencedClasses: [],
  54939. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54940. }),
  54941. $globals.SetTest);
  54942. $core.addMethod(
  54943. $core.method({
  54944. selector: "testAddRemove",
  54945. protocol: "tests",
  54946. fn: function (){
  54947. var self=this,$self=this;
  54948. var set;
  54949. return $core.withContext(function($ctx1) {
  54950. var $1,$2;
  54951. set=$recv($globals.Set)._new();
  54952. $self._assert_($recv(set)._isEmpty());
  54953. $ctx1.sendIdx["assert:"]=1;
  54954. $recv(set)._add_((3));
  54955. $ctx1.sendIdx["add:"]=1;
  54956. $1=$recv(set)._includes_((3));
  54957. $ctx1.sendIdx["includes:"]=1;
  54958. $self._assert_($1);
  54959. $ctx1.sendIdx["assert:"]=2;
  54960. $recv(set)._add_((5));
  54961. $2=$recv(set)._includes_((5));
  54962. $ctx1.sendIdx["includes:"]=2;
  54963. $self._assert_($2);
  54964. $recv(set)._remove_((3));
  54965. $self._deny_($recv(set)._includes_((3)));
  54966. return self;
  54967. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  54968. },
  54969. args: [],
  54970. source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)",
  54971. referencedClasses: ["Set"],
  54972. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  54973. }),
  54974. $globals.SetTest);
  54975. $core.addMethod(
  54976. $core.method({
  54977. selector: "testAt",
  54978. protocol: "tests",
  54979. fn: function (){
  54980. var self=this,$self=this;
  54981. return $core.withContext(function($ctx1) {
  54982. $self._should_raise_((function(){
  54983. return $core.withContext(function($ctx2) {
  54984. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  54985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54986. }),$globals.Error);
  54987. return self;
  54988. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  54989. },
  54990. args: [],
  54991. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  54992. referencedClasses: ["Set", "Error"],
  54993. messageSends: ["should:raise:", "at:put:", "new"]
  54994. }),
  54995. $globals.SetTest);
  54996. $core.addMethod(
  54997. $core.method({
  54998. selector: "testCollect",
  54999. protocol: "tests",
  55000. fn: function (){
  55001. var self=this,$self=this;
  55002. return $core.withContext(function($ctx1) {
  55003. var $2,$1;
  55004. (
  55005. $ctx1.supercall = true,
  55006. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  55007. $ctx1.supercall = false;
  55008. $2=[(5), (6), (8)]._asSet();
  55009. $ctx1.sendIdx["asSet"]=1;
  55010. $1=$recv($2)._collect_((function(x){
  55011. return $core.withContext(function($ctx2) {
  55012. return $recv(x).__backslash_backslash((3));
  55013. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55014. }));
  55015. $self._assert_equals_($1,[(0), (2)]._asSet());
  55016. return self;
  55017. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  55018. },
  55019. args: [],
  55020. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  55021. referencedClasses: [],
  55022. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  55023. }),
  55024. $globals.SetTest);
  55025. $core.addMethod(
  55026. $core.method({
  55027. selector: "testComma",
  55028. protocol: "tests",
  55029. fn: function (){
  55030. var self=this,$self=this;
  55031. return $core.withContext(function($ctx1) {
  55032. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  55033. (
  55034. $ctx1.supercall = true,
  55035. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  55036. $ctx1.supercall = false;
  55037. $2=$self._collection();
  55038. $ctx1.sendIdx["collection"]=1;
  55039. $3=$self._collection();
  55040. $ctx1.sendIdx["collection"]=2;
  55041. $1=$recv($2).__comma($3);
  55042. $ctx1.sendIdx[","]=1;
  55043. $4=$self._collection();
  55044. $ctx1.sendIdx["collection"]=3;
  55045. $self._assert_equals_($1,$4);
  55046. $ctx1.sendIdx["assert:equals:"]=1;
  55047. $6=$self._collection();
  55048. $ctx1.sendIdx["collection"]=4;
  55049. $7=$self._collectionWithNewValue();
  55050. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55051. $5=$recv($6).__comma($7);
  55052. $ctx1.sendIdx[","]=2;
  55053. $8=$self._collectionWithNewValue();
  55054. $ctx1.sendIdx["collectionWithNewValue"]=2;
  55055. $self._assert_equals_($5,$8);
  55056. $ctx1.sendIdx["assert:equals:"]=2;
  55057. $10=$self._collectionWithNewValue();
  55058. $ctx1.sendIdx["collectionWithNewValue"]=3;
  55059. $9=$recv($10).__comma($self._collection());
  55060. $self._assert_equals_($9,$self._collectionWithNewValue());
  55061. return self;
  55062. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  55063. },
  55064. args: [],
  55065. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  55066. referencedClasses: [],
  55067. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  55068. }),
  55069. $globals.SetTest);
  55070. $core.addMethod(
  55071. $core.method({
  55072. selector: "testComparing",
  55073. protocol: "tests",
  55074. fn: function (){
  55075. var self=this,$self=this;
  55076. return $core.withContext(function($ctx1) {
  55077. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  55078. $1=[(0), (2)]._asSet();
  55079. $ctx1.sendIdx["asSet"]=1;
  55080. $2=[(0), (2)]._asSet();
  55081. $ctx1.sendIdx["asSet"]=2;
  55082. $self._assert_equals_($1,$2);
  55083. $ctx1.sendIdx["assert:equals:"]=1;
  55084. $3=[(2), (0)]._asSet();
  55085. $ctx1.sendIdx["asSet"]=3;
  55086. $4=[(0), (2)]._asSet();
  55087. $ctx1.sendIdx["asSet"]=4;
  55088. $self._assert_equals_($3,$4);
  55089. $6=[(0), (2), (3)]._asSet();
  55090. $ctx1.sendIdx["asSet"]=5;
  55091. $7=[(0), (2)]._asSet();
  55092. $ctx1.sendIdx["asSet"]=6;
  55093. $5=$recv($6).__eq($7);
  55094. $ctx1.sendIdx["="]=1;
  55095. $self._deny_($5);
  55096. $ctx1.sendIdx["deny:"]=1;
  55097. $9=[(1), (2)]._asSet();
  55098. $ctx1.sendIdx["asSet"]=7;
  55099. $8=$recv($9).__eq([(0), (2)]._asSet());
  55100. $self._deny_($8);
  55101. return self;
  55102. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  55103. },
  55104. args: [],
  55105. source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a\x09self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a\x09self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a\x09self deny: #(1 2) asSet = #(0 2) asSet",
  55106. referencedClasses: [],
  55107. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  55108. }),
  55109. $globals.SetTest);
  55110. $core.addMethod(
  55111. $core.method({
  55112. selector: "testPrintString",
  55113. protocol: "tests",
  55114. fn: function (){
  55115. var self=this,$self=this;
  55116. var set;
  55117. return $core.withContext(function($ctx1) {
  55118. var $1,$2,$3,$4,$5,$6,$7,$8;
  55119. set=$recv($globals.Set)._new();
  55120. $1=$recv(set)._printString();
  55121. $ctx1.sendIdx["printString"]=1;
  55122. $self._assert_equals_($1,"a Set ()");
  55123. $ctx1.sendIdx["assert:equals:"]=1;
  55124. $2=set;
  55125. $recv($2)._add_((1));
  55126. $ctx1.sendIdx["add:"]=1;
  55127. $3=$recv($2)._add_((3));
  55128. $ctx1.sendIdx["add:"]=2;
  55129. $4=$recv(set)._printString();
  55130. $ctx1.sendIdx["printString"]=2;
  55131. $self._assert_equals_($4,"a Set (1 3)");
  55132. $ctx1.sendIdx["assert:equals:"]=2;
  55133. $recv(set)._add_("foo");
  55134. $ctx1.sendIdx["add:"]=3;
  55135. $5=$recv(set)._printString();
  55136. $ctx1.sendIdx["printString"]=3;
  55137. $self._assert_equals_($5,"a Set (1 3 'foo')");
  55138. $ctx1.sendIdx["assert:equals:"]=3;
  55139. $6=set;
  55140. $recv($6)._remove_((1));
  55141. $ctx1.sendIdx["remove:"]=1;
  55142. $recv($6)._remove_((3));
  55143. $7=$recv(set)._printString();
  55144. $ctx1.sendIdx["printString"]=4;
  55145. $self._assert_equals_($7,"a Set ('foo')");
  55146. $ctx1.sendIdx["assert:equals:"]=4;
  55147. $recv(set)._add_((3));
  55148. $ctx1.sendIdx["add:"]=4;
  55149. $8=$recv(set)._printString();
  55150. $ctx1.sendIdx["printString"]=5;
  55151. $self._assert_equals_($8,"a Set (3 'foo')");
  55152. $ctx1.sendIdx["assert:equals:"]=5;
  55153. $recv(set)._add_((3));
  55154. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  55155. return self;
  55156. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  55157. },
  55158. args: [],
  55159. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  55160. referencedClasses: ["Set"],
  55161. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  55162. }),
  55163. $globals.SetTest);
  55164. $core.addMethod(
  55165. $core.method({
  55166. selector: "testUnboxedObjects",
  55167. protocol: "tests",
  55168. fn: function (){
  55169. var self=this,$self=this;
  55170. return $core.withContext(function($ctx1) {
  55171. var $4,$3,$2,$1;
  55172. $4="foo"._yourself();
  55173. $ctx1.sendIdx["yourself"]=1;
  55174. $3=[$4,"foo"._yourself()];
  55175. $2=$recv($3)._asSet();
  55176. $1=$recv($2)._asArray();
  55177. $self._assert_equals_($1,["foo"]);
  55178. return self;
  55179. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  55180. },
  55181. args: [],
  55182. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  55183. referencedClasses: [],
  55184. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  55185. }),
  55186. $globals.SetTest);
  55187. $core.addMethod(
  55188. $core.method({
  55189. selector: "testUnicity",
  55190. protocol: "tests",
  55191. fn: function (){
  55192. var self=this,$self=this;
  55193. var set;
  55194. return $core.withContext(function($ctx1) {
  55195. var $1;
  55196. set=$recv($globals.Set)._new();
  55197. $recv(set)._add_((21));
  55198. $ctx1.sendIdx["add:"]=1;
  55199. $recv(set)._add_("hello");
  55200. $ctx1.sendIdx["add:"]=2;
  55201. $recv(set)._add_((21));
  55202. $ctx1.sendIdx["add:"]=3;
  55203. $1=$recv(set)._size();
  55204. $ctx1.sendIdx["size"]=1;
  55205. $self._assert_equals_($1,(2));
  55206. $ctx1.sendIdx["assert:equals:"]=1;
  55207. $recv(set)._add_("hello");
  55208. $self._assert_equals_($recv(set)._size(),(2));
  55209. $ctx1.sendIdx["assert:equals:"]=2;
  55210. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  55211. return self;
  55212. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  55213. },
  55214. args: [],
  55215. source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  55216. referencedClasses: ["Set"],
  55217. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  55218. }),
  55219. $globals.SetTest);
  55220. $core.addMethod(
  55221. $core.method({
  55222. selector: "collectionClass",
  55223. protocol: "fixture",
  55224. fn: function (){
  55225. var self=this,$self=this;
  55226. return $globals.Set;
  55227. },
  55228. args: [],
  55229. source: "collectionClass\x0a\x09^ Set",
  55230. referencedClasses: ["Set"],
  55231. messageSends: []
  55232. }),
  55233. $globals.SetTest.a$cls);
  55234. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  55235. $core.addMethod(
  55236. $core.method({
  55237. selector: "testShow",
  55238. protocol: "tests",
  55239. fn: function (){
  55240. var self=this,$self=this;
  55241. var originalTranscript;
  55242. return $core.withContext(function($ctx1) {
  55243. originalTranscript=$recv($globals.Transcript)._current();
  55244. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  55245. $ctx1.sendIdx["register:"]=1;
  55246. $self._shouldnt_raise_((function(){
  55247. return $core.withContext(function($ctx2) {
  55248. return $recv($globals.Transcript)._show_("Hello console!");
  55249. $ctx2.sendIdx["show:"]=1;
  55250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55251. }),$globals.Error);
  55252. $ctx1.sendIdx["shouldnt:raise:"]=1;
  55253. $self._shouldnt_raise_((function(){
  55254. return $core.withContext(function($ctx2) {
  55255. return $recv($globals.Transcript)._show_(console);
  55256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55257. }),$globals.Error);
  55258. $recv($globals.Transcript)._register_(originalTranscript);
  55259. return self;
  55260. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  55261. },
  55262. args: [],
  55263. source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.",
  55264. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  55265. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  55266. }),
  55267. $globals.ConsoleTranscriptTest);
  55268. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  55269. $core.addMethod(
  55270. $core.method({
  55271. selector: "testEquality",
  55272. protocol: "tests",
  55273. fn: function (){
  55274. var self=this,$self=this;
  55275. var now;
  55276. return $core.withContext(function($ctx1) {
  55277. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  55278. now=$recv($globals.Date)._new();
  55279. $1=$recv(now).__eq(now);
  55280. $ctx1.sendIdx["="]=1;
  55281. $self._assert_($1);
  55282. $ctx1.sendIdx["assert:"]=1;
  55283. $3=now;
  55284. $4=$recv($globals.Date)._fromMilliseconds_((0));
  55285. $ctx1.sendIdx["fromMilliseconds:"]=1;
  55286. $2=$recv($3).__eq($4);
  55287. $ctx1.sendIdx["="]=2;
  55288. $self._deny_($2);
  55289. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  55290. $ctx1.sendIdx["fromMilliseconds:"]=2;
  55291. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  55292. $ctx1.sendIdx["fromMilliseconds:"]=3;
  55293. $5=$recv($6).__eq($7);
  55294. $ctx1.sendIdx["="]=3;
  55295. $self._assert_($5);
  55296. $ctx1.sendIdx["assert:"]=2;
  55297. $9=now;
  55298. $11=$recv(now)._asMilliseconds();
  55299. $ctx1.sendIdx["asMilliseconds"]=1;
  55300. $10=$recv($globals.Date)._fromMilliseconds_($11);
  55301. $ctx1.sendIdx["fromMilliseconds:"]=4;
  55302. $8=$recv($9).__eq($10);
  55303. $ctx1.sendIdx["="]=4;
  55304. $self._assert_($8);
  55305. $ctx1.sendIdx["assert:"]=3;
  55306. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  55307. return self;
  55308. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  55309. },
  55310. args: [],
  55311. source: "testEquality\x0a\x09| now |\x0a\x09now := Date new.\x0a\x0a\x09self assert: now = now.\x0a\x0a\x09self deny: now = (Date fromMilliseconds: 0).\x0a\x0a\x09self assert: (Date fromMilliseconds: 12345678) = (Date fromMilliseconds: 12345678).\x0a\x09self assert: now = (Date fromMilliseconds: now asMilliseconds).\x0a\x09self assert: (Date fromMilliseconds: now asMilliseconds) = now",
  55312. referencedClasses: ["Date"],
  55313. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  55314. }),
  55315. $globals.DateTest);
  55316. $core.addMethod(
  55317. $core.method({
  55318. selector: "testIdentity",
  55319. protocol: "tests",
  55320. fn: function (){
  55321. var self=this,$self=this;
  55322. var now;
  55323. return $core.withContext(function($ctx1) {
  55324. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  55325. now=$recv($globals.Date)._new();
  55326. $1=$recv(now).__eq_eq(now);
  55327. $ctx1.sendIdx["=="]=1;
  55328. $self._assert_($1);
  55329. $3=now;
  55330. $4=$recv($globals.Date)._fromMilliseconds_((0));
  55331. $ctx1.sendIdx["fromMilliseconds:"]=1;
  55332. $2=$recv($3).__eq_eq($4);
  55333. $ctx1.sendIdx["=="]=2;
  55334. $self._deny_($2);
  55335. $ctx1.sendIdx["deny:"]=1;
  55336. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  55337. $ctx1.sendIdx["fromMilliseconds:"]=2;
  55338. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  55339. $ctx1.sendIdx["fromMilliseconds:"]=3;
  55340. $5=$recv($6).__eq_eq($7);
  55341. $ctx1.sendIdx["=="]=3;
  55342. $self._deny_($5);
  55343. $ctx1.sendIdx["deny:"]=2;
  55344. $9=now;
  55345. $11=$recv(now)._asMilliseconds();
  55346. $ctx1.sendIdx["asMilliseconds"]=1;
  55347. $10=$recv($globals.Date)._fromMilliseconds_($11);
  55348. $ctx1.sendIdx["fromMilliseconds:"]=4;
  55349. $8=$recv($9).__eq_eq($10);
  55350. $ctx1.sendIdx["=="]=4;
  55351. $self._deny_($8);
  55352. $ctx1.sendIdx["deny:"]=3;
  55353. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  55354. return self;
  55355. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  55356. },
  55357. args: [],
  55358. source: "testIdentity\x0a\x09| now |\x0a\x09now := Date new.\x0a\x0a\x09self assert: now == now.\x0a\x0a\x09self deny: now == (Date fromMilliseconds: 0).\x0a\x0a\x09self deny: (Date fromMilliseconds: 12345678) == (Date fromMilliseconds: 12345678).\x0a\x09self deny: now == (Date fromMilliseconds: now asMilliseconds).\x0a\x09self deny: (Date fromMilliseconds: now asMilliseconds) == now",
  55359. referencedClasses: ["Date"],
  55360. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  55361. }),
  55362. $globals.DateTest);
  55363. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  55364. $core.addMethod(
  55365. $core.method({
  55366. selector: "jsNull",
  55367. protocol: "accessing",
  55368. fn: function (){
  55369. var self=this,$self=this;
  55370. return $core.withContext(function($ctx1) {
  55371. return null;
  55372. return self;
  55373. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  55374. },
  55375. args: [],
  55376. source: "jsNull\x0a\x09<inlineJS: 'return null'>",
  55377. referencedClasses: [],
  55378. messageSends: []
  55379. }),
  55380. $globals.JSObjectProxyTest);
  55381. $core.addMethod(
  55382. $core.method({
  55383. selector: "jsObject",
  55384. protocol: "accessing",
  55385. fn: function (){
  55386. var self=this,$self=this;
  55387. return $core.withContext(function($ctx1) {
  55388. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  55389. return self;
  55390. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  55391. },
  55392. args: [],
  55393. source: "jsObject\x0a\x09<inlineJS: \x0a\x09\x09'return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: \x22\x22, \x22e\x22: null, \x22f\x22: void 0}'>",
  55394. referencedClasses: [],
  55395. messageSends: []
  55396. }),
  55397. $globals.JSObjectProxyTest);
  55398. $core.addMethod(
  55399. $core.method({
  55400. selector: "jsUndefined",
  55401. protocol: "accessing",
  55402. fn: function (){
  55403. var self=this,$self=this;
  55404. return $core.withContext(function($ctx1) {
  55405. return;
  55406. return self;
  55407. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  55408. },
  55409. args: [],
  55410. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  55411. referencedClasses: [],
  55412. messageSends: []
  55413. }),
  55414. $globals.JSObjectProxyTest);
  55415. $core.addMethod(
  55416. $core.method({
  55417. selector: "testAtIfAbsent",
  55418. protocol: "tests",
  55419. fn: function (){
  55420. var self=this,$self=this;
  55421. var testObject;
  55422. return $core.withContext(function($ctx1) {
  55423. var $1,$2,$3;
  55424. testObject=$self._jsObject();
  55425. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  55426. return "Property does not exist";
  55427. }));
  55428. $ctx1.sendIdx["at:ifAbsent:"]=1;
  55429. $self._assert_equals_($1,"Property does not exist");
  55430. $ctx1.sendIdx["assert:equals:"]=1;
  55431. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  55432. return "Property does not exist";
  55433. }));
  55434. $ctx1.sendIdx["at:ifAbsent:"]=2;
  55435. $self._assert_equals_($2,nil);
  55436. $ctx1.sendIdx["assert:equals:"]=2;
  55437. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  55438. return "Property does not exist";
  55439. }));
  55440. $ctx1.sendIdx["at:ifAbsent:"]=3;
  55441. $self._assert_equals_($3,(1));
  55442. $ctx1.sendIdx["assert:equals:"]=3;
  55443. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  55444. return "Property does not exist";
  55445. })),nil);
  55446. return self;
  55447. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  55448. },
  55449. args: [],
  55450. source: "testAtIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: [ 'Property does not exist' ]) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: [ 'Property does not exist' ]) equals: nil.\x0a\x09self assert: (testObject at: 'a' ifAbsent: [ 'Property does not exist' ]) equals: 1.\x0a\x09self assert: (testObject at: 'f' ifAbsent: [ 'Property does not exist' ]) equals: nil.",
  55451. referencedClasses: [],
  55452. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  55453. }),
  55454. $globals.JSObjectProxyTest);
  55455. $core.addMethod(
  55456. $core.method({
  55457. selector: "testAtIfPresent",
  55458. protocol: "tests",
  55459. fn: function (){
  55460. var self=this,$self=this;
  55461. var testObject;
  55462. return $core.withContext(function($ctx1) {
  55463. var $2,$1,$4,$3,$6,$5;
  55464. testObject=$self._jsObject();
  55465. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  55466. return $core.withContext(function($ctx2) {
  55467. $2=$recv(x)._asString();
  55468. $ctx2.sendIdx["asString"]=1;
  55469. return "hello ".__comma($2);
  55470. $ctx2.sendIdx[","]=1;
  55471. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55472. }));
  55473. $ctx1.sendIdx["at:ifPresent:"]=1;
  55474. $self._assert_equals_($1,nil);
  55475. $ctx1.sendIdx["assert:equals:"]=1;
  55476. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  55477. return $core.withContext(function($ctx2) {
  55478. $4=$recv(x)._asString();
  55479. $ctx2.sendIdx["asString"]=2;
  55480. return "hello ".__comma($4);
  55481. $ctx2.sendIdx[","]=2;
  55482. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  55483. }));
  55484. $ctx1.sendIdx["at:ifPresent:"]=2;
  55485. $self._assert_equals_($3,"hello nil");
  55486. $ctx1.sendIdx["assert:equals:"]=2;
  55487. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  55488. return $core.withContext(function($ctx2) {
  55489. $6=$recv(x)._asString();
  55490. $ctx2.sendIdx["asString"]=3;
  55491. return "hello ".__comma($6);
  55492. $ctx2.sendIdx[","]=3;
  55493. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  55494. }));
  55495. $ctx1.sendIdx["at:ifPresent:"]=3;
  55496. $self._assert_equals_($5,"hello 1");
  55497. $ctx1.sendIdx["assert:equals:"]=3;
  55498. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  55499. return $core.withContext(function($ctx2) {
  55500. return "hello ".__comma($recv(x)._asString());
  55501. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  55502. })),"hello nil");
  55503. return self;
  55504. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  55505. },
  55506. args: [],
  55507. source: "testAtIfPresent\x0a\x09| testObject |\x0a\x09\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x | 'hello ',x asString ]) equals: nil.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.",
  55508. referencedClasses: [],
  55509. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  55510. }),
  55511. $globals.JSObjectProxyTest);
  55512. $core.addMethod(
  55513. $core.method({
  55514. selector: "testAtIfPresentIfAbsent",
  55515. protocol: "tests",
  55516. fn: function (){
  55517. var self=this,$self=this;
  55518. var testObject;
  55519. return $core.withContext(function($ctx1) {
  55520. var $2,$1,$4,$3,$6,$5;
  55521. testObject=$self._jsObject();
  55522. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  55523. return $core.withContext(function($ctx2) {
  55524. $2=$recv(x)._asString();
  55525. $ctx2.sendIdx["asString"]=1;
  55526. return "hello ".__comma($2);
  55527. $ctx2.sendIdx[","]=1;
  55528. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55529. }),(function(){
  55530. return "not present";
  55531. }));
  55532. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  55533. $self._assert_equals_($1,"not present");
  55534. $ctx1.sendIdx["assert:equals:"]=1;
  55535. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  55536. return $core.withContext(function($ctx2) {
  55537. $4=$recv(x)._asString();
  55538. $ctx2.sendIdx["asString"]=2;
  55539. return "hello ".__comma($4);
  55540. $ctx2.sendIdx[","]=2;
  55541. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  55542. }),(function(){
  55543. return "not present";
  55544. }));
  55545. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  55546. $self._assert_equals_($3,"hello nil");
  55547. $ctx1.sendIdx["assert:equals:"]=2;
  55548. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  55549. return $core.withContext(function($ctx2) {
  55550. $6=$recv(x)._asString();
  55551. $ctx2.sendIdx["asString"]=3;
  55552. return "hello ".__comma($6);
  55553. $ctx2.sendIdx[","]=3;
  55554. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  55555. }),(function(){
  55556. return "not present";
  55557. }));
  55558. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  55559. $self._assert_equals_($5,"hello 1");
  55560. $ctx1.sendIdx["assert:equals:"]=3;
  55561. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  55562. return $core.withContext(function($ctx2) {
  55563. return "hello ".__comma($recv(x)._asString());
  55564. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  55565. }),(function(){
  55566. return "not present";
  55567. })),"hello nil");
  55568. return self;
  55569. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  55570. },
  55571. args: [],
  55572. source: "testAtIfPresentIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'not present'.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.",
  55573. referencedClasses: [],
  55574. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  55575. }),
  55576. $globals.JSObjectProxyTest);
  55577. $core.addMethod(
  55578. $core.method({
  55579. selector: "testAtPut",
  55580. protocol: "tests",
  55581. fn: function (){
  55582. var self=this,$self=this;
  55583. var testObject;
  55584. return $core.withContext(function($ctx1) {
  55585. var $2,$1;
  55586. testObject=$self._jsObject();
  55587. $2=$recv(testObject)._at_("abc");
  55588. $ctx1.sendIdx["at:"]=1;
  55589. $1=$recv($2).__tild_eq("xyz");
  55590. $self._assert_($1);
  55591. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  55592. $ctx1.sendIdx["assert:equals:"]=1;
  55593. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  55594. return self;
  55595. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  55596. },
  55597. args: [],
  55598. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  55599. referencedClasses: [],
  55600. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  55601. }),
  55602. $globals.JSObjectProxyTest);
  55603. $core.addMethod(
  55604. $core.method({
  55605. selector: "testComparison",
  55606. protocol: "tests",
  55607. fn: function (){
  55608. var self=this,$self=this;
  55609. return $core.withContext(function($ctx1) {
  55610. var $1,$2;
  55611. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  55612. $1=$recv(console).__eq(console);
  55613. $ctx1.sendIdx["="]=1;
  55614. $self._assert_($1);
  55615. $2=$recv(console).__eq($recv($globals.Object)._new());
  55616. $ctx1.sendIdx["="]=2;
  55617. $self._deny_($2);
  55618. $ctx1.sendIdx["deny:"]=1;
  55619. $self._deny_($recv(console).__eq($self._jsObject()));
  55620. return self;
  55621. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  55622. },
  55623. args: [],
  55624. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  55625. referencedClasses: ["Object"],
  55626. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  55627. }),
  55628. $globals.JSObjectProxyTest);
  55629. $core.addMethod(
  55630. $core.method({
  55631. selector: "testDNU",
  55632. protocol: "tests",
  55633. fn: function (){
  55634. var self=this,$self=this;
  55635. return $core.withContext(function($ctx1) {
  55636. $self._should_raise_((function(){
  55637. return $core.withContext(function($ctx2) {
  55638. return $recv($self._jsObject())._foo();
  55639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55640. }),$globals.MessageNotUnderstood);
  55641. return self;
  55642. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  55643. },
  55644. args: [],
  55645. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  55646. referencedClasses: ["MessageNotUnderstood"],
  55647. messageSends: ["should:raise:", "foo", "jsObject"]
  55648. }),
  55649. $globals.JSObjectProxyTest);
  55650. $core.addMethod(
  55651. $core.method({
  55652. selector: "testDNUWithAllowJavaScriptCalls",
  55653. protocol: "tests",
  55654. fn: function (){
  55655. var self=this,$self=this;
  55656. var jsObject;
  55657. return $core.withContext(function($ctx1) {
  55658. jsObject=[];
  55659. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  55660. $self._should_raise_((function(){
  55661. return $core.withContext(function($ctx2) {
  55662. return $recv(jsObject)._foo();
  55663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55664. }),$globals.MessageNotUnderstood);
  55665. return self;
  55666. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55667. },
  55668. args: [],
  55669. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  55670. referencedClasses: ["MessageNotUnderstood"],
  55671. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  55672. }),
  55673. $globals.JSObjectProxyTest);
  55674. $core.addMethod(
  55675. $core.method({
  55676. selector: "testMessageSend",
  55677. protocol: "tests",
  55678. fn: function (){
  55679. var self=this,$self=this;
  55680. return $core.withContext(function($ctx1) {
  55681. var $2,$1,$4,$3;
  55682. $2=$self._jsObject();
  55683. $ctx1.sendIdx["jsObject"]=1;
  55684. $1=$recv($2)._a();
  55685. $self._assert_equals_($1,(1));
  55686. $ctx1.sendIdx["assert:equals:"]=1;
  55687. $4=$self._jsObject();
  55688. $ctx1.sendIdx["jsObject"]=2;
  55689. $3=$recv($4)._b();
  55690. $self._assert_equals_($3,(2));
  55691. $ctx1.sendIdx["assert:equals:"]=2;
  55692. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  55693. return self;
  55694. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  55695. },
  55696. args: [],
  55697. source: "testMessageSend\x0a\x0a\x09self assert: self jsObject a equals: 1.\x0a\x09self assert: self jsObject b equals: 2.\x0a\x09self assert: (self jsObject c: 3) equals: 3",
  55698. referencedClasses: [],
  55699. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  55700. }),
  55701. $globals.JSObjectProxyTest);
  55702. $core.addMethod(
  55703. $core.method({
  55704. selector: "testMethodWithArguments",
  55705. protocol: "tests",
  55706. fn: function (){
  55707. var self=this,$self=this;
  55708. return $core.withContext(function($ctx1) {
  55709. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  55710. return self;
  55711. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  55712. },
  55713. args: [],
  55714. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  55715. referencedClasses: [],
  55716. messageSends: ["assert:equals:", "c:", "jsObject"]
  55717. }),
  55718. $globals.JSObjectProxyTest);
  55719. $core.addMethod(
  55720. $core.method({
  55721. selector: "testPrinting",
  55722. protocol: "tests",
  55723. fn: function (){
  55724. var self=this,$self=this;
  55725. return $core.withContext(function($ctx1) {
  55726. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  55727. return self;
  55728. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  55729. },
  55730. args: [],
  55731. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  55732. referencedClasses: [],
  55733. messageSends: ["assert:equals:", "printString", "jsObject"]
  55734. }),
  55735. $globals.JSObjectProxyTest);
  55736. $core.addMethod(
  55737. $core.method({
  55738. selector: "testPropertyThatReturnsEmptyString",
  55739. protocol: "tests",
  55740. fn: function (){
  55741. var self=this,$self=this;
  55742. var object;
  55743. return $core.withContext(function($ctx1) {
  55744. var $1;
  55745. object=$self._jsObject();
  55746. $1=$recv(object)._d();
  55747. $ctx1.sendIdx["d"]=1;
  55748. $self._assert_equals_($1,"");
  55749. $ctx1.sendIdx["assert:equals:"]=1;
  55750. $recv(object)._d_("hello");
  55751. $self._assert_equals_($recv(object)._d(),"hello");
  55752. return self;
  55753. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  55754. },
  55755. args: [],
  55756. source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: object d equals: ''.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: object d equals: 'hello'",
  55757. referencedClasses: [],
  55758. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  55759. }),
  55760. $globals.JSObjectProxyTest);
  55761. $core.addMethod(
  55762. $core.method({
  55763. selector: "testPropertyThatReturnsUndefined",
  55764. protocol: "tests",
  55765. fn: function (){
  55766. var self=this,$self=this;
  55767. var object;
  55768. return $core.withContext(function($ctx1) {
  55769. object=$self._jsObject();
  55770. $self._shouldnt_raise_((function(){
  55771. return $core.withContext(function($ctx2) {
  55772. return $recv(object)._e();
  55773. $ctx2.sendIdx["e"]=1;
  55774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55775. }),$globals.MessageNotUnderstood);
  55776. $self._assert_($recv($recv(object)._e())._isNil());
  55777. return self;
  55778. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  55779. },
  55780. args: [],
  55781. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  55782. referencedClasses: ["MessageNotUnderstood"],
  55783. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  55784. }),
  55785. $globals.JSObjectProxyTest);
  55786. $core.addMethod(
  55787. $core.method({
  55788. selector: "testSetPropertyWithFalsyValue",
  55789. protocol: "tests",
  55790. fn: function (){
  55791. var self=this,$self=this;
  55792. var jsObject;
  55793. return $core.withContext(function($ctx1) {
  55794. var $1,$2,$3,$4,$5;
  55795. jsObject=$self._jsObject();
  55796. $1=$recv(jsObject)._a();
  55797. $ctx1.sendIdx["a"]=1;
  55798. $self._assert_equals_($1,(1));
  55799. $ctx1.sendIdx["assert:equals:"]=1;
  55800. $recv(jsObject)._a_($self._jsNull());
  55801. $ctx1.sendIdx["a:"]=1;
  55802. $2=$recv(jsObject)._a();
  55803. $ctx1.sendIdx["a"]=2;
  55804. $self._assert_equals_($2,nil);
  55805. $ctx1.sendIdx["assert:equals:"]=2;
  55806. $recv(jsObject)._a_((0));
  55807. $ctx1.sendIdx["a:"]=2;
  55808. $3=$recv(jsObject)._a();
  55809. $ctx1.sendIdx["a"]=3;
  55810. $self._assert_equals_($3,(0));
  55811. $ctx1.sendIdx["assert:equals:"]=3;
  55812. $recv(jsObject)._a_($self._jsUndefined());
  55813. $ctx1.sendIdx["a:"]=3;
  55814. $4=$recv(jsObject)._a();
  55815. $ctx1.sendIdx["a"]=4;
  55816. $self._assert_equals_($4,nil);
  55817. $ctx1.sendIdx["assert:equals:"]=4;
  55818. $recv(jsObject)._a_("");
  55819. $ctx1.sendIdx["a:"]=4;
  55820. $5=$recv(jsObject)._a();
  55821. $ctx1.sendIdx["a"]=5;
  55822. $self._assert_equals_($5,"");
  55823. $ctx1.sendIdx["assert:equals:"]=5;
  55824. $recv(jsObject)._a_(false);
  55825. $self._assert_equals_($recv(jsObject)._a(),false);
  55826. return self;
  55827. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55828. },
  55829. args: [],
  55830. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  55831. referencedClasses: [],
  55832. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  55833. }),
  55834. $globals.JSObjectProxyTest);
  55835. $core.addMethod(
  55836. $core.method({
  55837. selector: "testValue",
  55838. protocol: "tests",
  55839. fn: function (){
  55840. var self=this,$self=this;
  55841. var testObject;
  55842. return $core.withContext(function($ctx1) {
  55843. testObject=$self._jsObject();
  55844. $recv(testObject)._at_put_("value","aValue");
  55845. $self._assert_equals_($recv(testObject)._value(),"aValue");
  55846. return self;
  55847. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  55848. },
  55849. args: [],
  55850. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  55851. referencedClasses: [],
  55852. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  55853. }),
  55854. $globals.JSObjectProxyTest);
  55855. $core.addMethod(
  55856. $core.method({
  55857. selector: "testYourself",
  55858. protocol: "tests",
  55859. fn: function (){
  55860. var self=this,$self=this;
  55861. var object;
  55862. return $core.withContext(function($ctx1) {
  55863. var $1;
  55864. $1=$self._jsObject();
  55865. $recv($1)._d_("test");
  55866. object=$recv($1)._yourself();
  55867. $self._assert_equals_($recv(object)._d(),"test");
  55868. return self;
  55869. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  55870. },
  55871. args: [],
  55872. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  55873. referencedClasses: [],
  55874. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  55875. }),
  55876. $globals.JSObjectProxyTest);
  55877. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  55878. $core.addMethod(
  55879. $core.method({
  55880. selector: "testCatchingException",
  55881. protocol: "tests",
  55882. fn: function (){
  55883. var self=this,$self=this;
  55884. return $core.withContext(function($ctx1) {
  55885. $recv((function(){
  55886. return $core.withContext(function($ctx2) {
  55887. return $self._throwException();
  55888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55889. }))._on_do_($globals.Error,(function(error){
  55890. return $core.withContext(function($ctx2) {
  55891. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  55892. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  55893. }));
  55894. return self;
  55895. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  55896. },
  55897. args: [],
  55898. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  55899. referencedClasses: ["Error"],
  55900. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  55901. }),
  55902. $globals.JavaScriptExceptionTest);
  55903. $core.addMethod(
  55904. $core.method({
  55905. selector: "testRaisingException",
  55906. protocol: "tests",
  55907. fn: function (){
  55908. var self=this,$self=this;
  55909. return $core.withContext(function($ctx1) {
  55910. $self._should_raise_((function(){
  55911. return $core.withContext(function($ctx2) {
  55912. return $self._throwException();
  55913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55914. }),$globals.JavaScriptException);
  55915. return self;
  55916. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  55917. },
  55918. args: [],
  55919. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  55920. referencedClasses: ["JavaScriptException"],
  55921. messageSends: ["should:raise:", "throwException"]
  55922. }),
  55923. $globals.JavaScriptExceptionTest);
  55924. $core.addMethod(
  55925. $core.method({
  55926. selector: "throwException",
  55927. protocol: "helpers",
  55928. fn: function (){
  55929. var self=this,$self=this;
  55930. return $core.withContext(function($ctx1) {
  55931. throw "test";
  55932. return self;
  55933. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  55934. },
  55935. args: [],
  55936. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  55937. referencedClasses: [],
  55938. messageSends: []
  55939. }),
  55940. $globals.JavaScriptExceptionTest);
  55941. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  55942. $core.addMethod(
  55943. $core.method({
  55944. selector: "testValue",
  55945. protocol: "tests",
  55946. fn: function (){
  55947. var self=this,$self=this;
  55948. var messageSend;
  55949. return $core.withContext(function($ctx1) {
  55950. var $1;
  55951. $1=$recv($globals.MessageSend)._new();
  55952. $ctx1.sendIdx["new"]=1;
  55953. $recv($1)._receiver_($recv($globals.Object)._new());
  55954. $recv($1)._selector_("asString");
  55955. messageSend=$recv($1)._yourself();
  55956. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  55957. return self;
  55958. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  55959. },
  55960. args: [],
  55961. source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'",
  55962. referencedClasses: ["MessageSend", "Object"],
  55963. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  55964. }),
  55965. $globals.MessageSendTest);
  55966. $core.addMethod(
  55967. $core.method({
  55968. selector: "testValueWithArguments",
  55969. protocol: "tests",
  55970. fn: function (){
  55971. var self=this,$self=this;
  55972. var messageSend;
  55973. return $core.withContext(function($ctx1) {
  55974. var $1;
  55975. $1=$recv($globals.MessageSend)._new();
  55976. $recv($1)._receiver_((2));
  55977. $recv($1)._selector_("+");
  55978. messageSend=$recv($1)._yourself();
  55979. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  55980. $ctx1.sendIdx["assert:equals:"]=1;
  55981. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  55982. return self;
  55983. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  55984. },
  55985. args: [],
  55986. source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6",
  55987. referencedClasses: ["MessageSend"],
  55988. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  55989. }),
  55990. $globals.MessageSendTest);
  55991. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  55992. $core.addMethod(
  55993. $core.method({
  55994. selector: "codeGeneratorClass",
  55995. protocol: "accessing",
  55996. fn: function (){
  55997. var self=this,$self=this;
  55998. return $globals.CodeGenerator;
  55999. },
  56000. args: [],
  56001. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  56002. referencedClasses: ["CodeGenerator"],
  56003. messageSends: []
  56004. }),
  56005. $globals.MethodInheritanceTest);
  56006. $core.addMethod(
  56007. $core.method({
  56008. selector: "compiler",
  56009. protocol: "factory",
  56010. fn: function (){
  56011. var self=this,$self=this;
  56012. return $core.withContext(function($ctx1) {
  56013. var $1;
  56014. $1=$recv($globals.Compiler)._new();
  56015. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  56016. return $recv($1)._yourself();
  56017. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  56018. },
  56019. args: [],
  56020. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  56021. referencedClasses: ["Compiler"],
  56022. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  56023. }),
  56024. $globals.MethodInheritanceTest);
  56025. $core.addMethod(
  56026. $core.method({
  56027. selector: "deinstallBottom",
  56028. protocol: "testing",
  56029. fn: function (){
  56030. var self=this,$self=this;
  56031. return $core.withContext(function($ctx1) {
  56032. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  56033. return self;
  56034. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  56035. },
  56036. args: [],
  56037. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  56038. referencedClasses: [],
  56039. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  56040. }),
  56041. $globals.MethodInheritanceTest);
  56042. $core.addMethod(
  56043. $core.method({
  56044. selector: "deinstallMiddle",
  56045. protocol: "testing",
  56046. fn: function (){
  56047. var self=this,$self=this;
  56048. return $core.withContext(function($ctx1) {
  56049. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  56050. return self;
  56051. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  56052. },
  56053. args: [],
  56054. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  56055. referencedClasses: [],
  56056. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  56057. }),
  56058. $globals.MethodInheritanceTest);
  56059. $core.addMethod(
  56060. $core.method({
  56061. selector: "deinstallTop",
  56062. protocol: "testing",
  56063. fn: function (){
  56064. var self=this,$self=this;
  56065. return $core.withContext(function($ctx1) {
  56066. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  56067. return self;
  56068. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  56069. },
  56070. args: [],
  56071. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  56072. referencedClasses: [],
  56073. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  56074. }),
  56075. $globals.MethodInheritanceTest);
  56076. $core.addMethod(
  56077. $core.method({
  56078. selector: "installBottom:",
  56079. protocol: "testing",
  56080. fn: function (aString){
  56081. var self=this,$self=this;
  56082. return $core.withContext(function($ctx1) {
  56083. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  56084. return self;
  56085. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  56086. },
  56087. args: ["aString"],
  56088. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  56089. referencedClasses: [],
  56090. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  56091. }),
  56092. $globals.MethodInheritanceTest);
  56093. $core.addMethod(
  56094. $core.method({
  56095. selector: "installMiddle:",
  56096. protocol: "testing",
  56097. fn: function (aString){
  56098. var self=this,$self=this;
  56099. return $core.withContext(function($ctx1) {
  56100. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  56101. return self;
  56102. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  56103. },
  56104. args: ["aString"],
  56105. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  56106. referencedClasses: [],
  56107. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  56108. }),
  56109. $globals.MethodInheritanceTest);
  56110. $core.addMethod(
  56111. $core.method({
  56112. selector: "installTop:",
  56113. protocol: "testing",
  56114. fn: function (aString){
  56115. var self=this,$self=this;
  56116. return $core.withContext(function($ctx1) {
  56117. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  56118. return self;
  56119. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  56120. },
  56121. args: ["aString"],
  56122. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  56123. referencedClasses: [],
  56124. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  56125. }),
  56126. $globals.MethodInheritanceTest);
  56127. $core.addMethod(
  56128. $core.method({
  56129. selector: "setUp",
  56130. protocol: "initialization",
  56131. fn: function (){
  56132. var self=this,$self=this;
  56133. return $core.withContext(function($ctx1) {
  56134. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  56135. $ctx1.sendIdx["new"]=1;
  56136. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  56137. $ctx1.sendIdx["new"]=2;
  56138. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  56139. $self["@method"]=nil;
  56140. $self["@performBlock"]=(function(){
  56141. return $core.withContext(function($ctx2) {
  56142. return $self._error_("performBlock not initialized");
  56143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56144. });
  56145. return self;
  56146. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  56147. },
  56148. args: [],
  56149. source: "setUp\x0a\x09receiverTop := self targetClassTop new.\x0a\x09receiverMiddle := self targetClassMiddle new.\x0a\x09receiverBottom := self targetClassBottom new.\x0a\x09method := nil.\x0a\x09performBlock := [ self error: 'performBlock not initialized' ]",
  56150. referencedClasses: [],
  56151. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  56152. }),
  56153. $globals.MethodInheritanceTest);
  56154. $core.addMethod(
  56155. $core.method({
  56156. selector: "shouldMNU",
  56157. protocol: "testing",
  56158. fn: function (){
  56159. var self=this,$self=this;
  56160. return $core.withContext(function($ctx1) {
  56161. $self._shouldMNUTop();
  56162. $self._shouldMNUMiddle();
  56163. $self._shouldMNUBottom();
  56164. return self;
  56165. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  56166. },
  56167. args: [],
  56168. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  56169. referencedClasses: [],
  56170. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  56171. }),
  56172. $globals.MethodInheritanceTest);
  56173. $core.addMethod(
  56174. $core.method({
  56175. selector: "shouldMNUBottom",
  56176. protocol: "testing",
  56177. fn: function (){
  56178. var self=this,$self=this;
  56179. return $core.withContext(function($ctx1) {
  56180. $self._should_raise_((function(){
  56181. return $core.withContext(function($ctx2) {
  56182. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  56183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56184. }),$globals.MessageNotUnderstood);
  56185. return self;
  56186. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  56187. },
  56188. args: [],
  56189. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  56190. referencedClasses: ["MessageNotUnderstood"],
  56191. messageSends: ["should:raise:", "value:"]
  56192. }),
  56193. $globals.MethodInheritanceTest);
  56194. $core.addMethod(
  56195. $core.method({
  56196. selector: "shouldMNUMiddle",
  56197. protocol: "testing",
  56198. fn: function (){
  56199. var self=this,$self=this;
  56200. return $core.withContext(function($ctx1) {
  56201. $self._should_raise_((function(){
  56202. return $core.withContext(function($ctx2) {
  56203. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  56204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56205. }),$globals.MessageNotUnderstood);
  56206. return self;
  56207. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  56208. },
  56209. args: [],
  56210. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  56211. referencedClasses: ["MessageNotUnderstood"],
  56212. messageSends: ["should:raise:", "value:"]
  56213. }),
  56214. $globals.MethodInheritanceTest);
  56215. $core.addMethod(
  56216. $core.method({
  56217. selector: "shouldMNUTop",
  56218. protocol: "testing",
  56219. fn: function (){
  56220. var self=this,$self=this;
  56221. return $core.withContext(function($ctx1) {
  56222. $self._should_raise_((function(){
  56223. return $core.withContext(function($ctx2) {
  56224. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  56225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56226. }),$globals.MessageNotUnderstood);
  56227. return self;
  56228. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  56229. },
  56230. args: [],
  56231. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  56232. referencedClasses: ["MessageNotUnderstood"],
  56233. messageSends: ["should:raise:", "value:"]
  56234. }),
  56235. $globals.MethodInheritanceTest);
  56236. $core.addMethod(
  56237. $core.method({
  56238. selector: "shouldReturn:",
  56239. protocol: "testing",
  56240. fn: function (anObject){
  56241. var self=this,$self=this;
  56242. var result;
  56243. return $core.withContext(function($ctx1) {
  56244. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  56245. $ctx1.sendIdx["value:"]=1;
  56246. $self._assert_equals_(["top",anObject],["top",result]);
  56247. $ctx1.sendIdx["assert:equals:"]=1;
  56248. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  56249. $ctx1.sendIdx["value:"]=2;
  56250. $self._assert_equals_(["middle",anObject],["middle",result]);
  56251. $ctx1.sendIdx["assert:equals:"]=2;
  56252. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  56253. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  56254. return self;
  56255. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  56256. },
  56257. args: ["anObject"],
  56258. source: "shouldReturn: anObject\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject } equals: { 'bottom'. result }",
  56259. referencedClasses: [],
  56260. messageSends: ["value:", "assert:equals:"]
  56261. }),
  56262. $globals.MethodInheritanceTest);
  56263. $core.addMethod(
  56264. $core.method({
  56265. selector: "shouldReturn:and:and:",
  56266. protocol: "testing",
  56267. fn: function (anObject,anObject2,anObject3){
  56268. var self=this,$self=this;
  56269. var result;
  56270. return $core.withContext(function($ctx1) {
  56271. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  56272. $ctx1.sendIdx["value:"]=1;
  56273. $self._assert_equals_(["top",anObject],["top",result]);
  56274. $ctx1.sendIdx["assert:equals:"]=1;
  56275. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  56276. $ctx1.sendIdx["value:"]=2;
  56277. $self._assert_equals_(["middle",anObject2],["middle",result]);
  56278. $ctx1.sendIdx["assert:equals:"]=2;
  56279. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  56280. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  56281. return self;
  56282. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  56283. },
  56284. args: ["anObject", "anObject2", "anObject3"],
  56285. source: "shouldReturn: anObject and: anObject2 and: anObject3\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject2 } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject3 } equals: { 'bottom'. result }",
  56286. referencedClasses: [],
  56287. messageSends: ["value:", "assert:equals:"]
  56288. }),
  56289. $globals.MethodInheritanceTest);
  56290. $core.addMethod(
  56291. $core.method({
  56292. selector: "targetClassBottom",
  56293. protocol: "accessing",
  56294. fn: function (){
  56295. var self=this,$self=this;
  56296. return $globals.JavaScriptException;
  56297. },
  56298. args: [],
  56299. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  56300. referencedClasses: ["JavaScriptException"],
  56301. messageSends: []
  56302. }),
  56303. $globals.MethodInheritanceTest);
  56304. $core.addMethod(
  56305. $core.method({
  56306. selector: "targetClassMiddle",
  56307. protocol: "accessing",
  56308. fn: function (){
  56309. var self=this,$self=this;
  56310. return $globals.Error;
  56311. },
  56312. args: [],
  56313. source: "targetClassMiddle\x0a\x09^ Error",
  56314. referencedClasses: ["Error"],
  56315. messageSends: []
  56316. }),
  56317. $globals.MethodInheritanceTest);
  56318. $core.addMethod(
  56319. $core.method({
  56320. selector: "targetClassTop",
  56321. protocol: "accessing",
  56322. fn: function (){
  56323. var self=this,$self=this;
  56324. return $globals.Object;
  56325. },
  56326. args: [],
  56327. source: "targetClassTop\x0a\x09^ Object",
  56328. referencedClasses: ["Object"],
  56329. messageSends: []
  56330. }),
  56331. $globals.MethodInheritanceTest);
  56332. $core.addMethod(
  56333. $core.method({
  56334. selector: "tearDown",
  56335. protocol: "initialization",
  56336. fn: function (){
  56337. var self=this,$self=this;
  56338. return $core.withContext(function($ctx1) {
  56339. $recv((function(){
  56340. return $core.withContext(function($ctx2) {
  56341. return $self._deinstallTop();
  56342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56343. }))._on_do_($globals.Error,(function(){
  56344. }));
  56345. $ctx1.sendIdx["on:do:"]=1;
  56346. $recv((function(){
  56347. return $core.withContext(function($ctx2) {
  56348. return $self._deinstallMiddle();
  56349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56350. }))._on_do_($globals.Error,(function(){
  56351. }));
  56352. $ctx1.sendIdx["on:do:"]=2;
  56353. $recv((function(){
  56354. return $core.withContext(function($ctx2) {
  56355. return $self._deinstallBottom();
  56356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  56357. }))._on_do_($globals.Error,(function(){
  56358. }));
  56359. return self;
  56360. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  56361. },
  56362. args: [],
  56363. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  56364. referencedClasses: ["Error"],
  56365. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  56366. }),
  56367. $globals.MethodInheritanceTest);
  56368. $core.addMethod(
  56369. $core.method({
  56370. selector: "testMNU11",
  56371. protocol: "tests",
  56372. fn: function (){
  56373. var self=this,$self=this;
  56374. return $core.withContext(function($ctx1) {
  56375. $self["@performBlock"]=(function(x){
  56376. return $core.withContext(function($ctx2) {
  56377. return $recv(x)._foo();
  56378. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56379. });
  56380. $self._shouldMNU();
  56381. $ctx1.sendIdx["shouldMNU"]=1;
  56382. $self._installTop_("foo ^ false");
  56383. $ctx1.sendIdx["installTop:"]=1;
  56384. $self._installTop_("foo ^ true");
  56385. $self._deinstallTop();
  56386. $self._shouldMNU();
  56387. return self;
  56388. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  56389. },
  56390. args: [],
  56391. source: "testMNU11\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self deinstallTop.\x0a\x09self shouldMNU",
  56392. referencedClasses: [],
  56393. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  56394. }),
  56395. $globals.MethodInheritanceTest);
  56396. $core.addMethod(
  56397. $core.method({
  56398. selector: "testMNU22",
  56399. protocol: "tests",
  56400. fn: function (){
  56401. var self=this,$self=this;
  56402. return $core.withContext(function($ctx1) {
  56403. $self["@performBlock"]=(function(x){
  56404. return $core.withContext(function($ctx2) {
  56405. return $recv(x)._foo();
  56406. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56407. });
  56408. $self._shouldMNU();
  56409. $ctx1.sendIdx["shouldMNU"]=1;
  56410. $self._installMiddle_("foo ^ false");
  56411. $ctx1.sendIdx["installMiddle:"]=1;
  56412. $self._installMiddle_("foo ^ true");
  56413. $self._deinstallMiddle();
  56414. $self._shouldMNU();
  56415. return self;
  56416. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  56417. },
  56418. args: [],
  56419. source: "testMNU22\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installMiddle: 'foo ^ false'.\x0a\x09self installMiddle: 'foo ^ true'.\x0a\x09self deinstallMiddle.\x0a\x09self shouldMNU",
  56420. referencedClasses: [],
  56421. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  56422. }),
  56423. $globals.MethodInheritanceTest);
  56424. $core.addMethod(
  56425. $core.method({
  56426. selector: "testReturns1",
  56427. protocol: "tests",
  56428. fn: function (){
  56429. var self=this,$self=this;
  56430. return $core.withContext(function($ctx1) {
  56431. $self["@performBlock"]=(function(x){
  56432. return $core.withContext(function($ctx2) {
  56433. return $recv(x)._foo();
  56434. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56435. });
  56436. $self._installTop_("foo ^ false");
  56437. $ctx1.sendIdx["installTop:"]=1;
  56438. $self._shouldReturn_(false);
  56439. $ctx1.sendIdx["shouldReturn:"]=1;
  56440. $self._installTop_("foo ^ true");
  56441. $self._shouldReturn_(true);
  56442. return self;
  56443. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  56444. },
  56445. args: [],
  56446. source: "testReturns1\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self shouldReturn: false.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self shouldReturn: true",
  56447. referencedClasses: [],
  56448. messageSends: ["foo", "installTop:", "shouldReturn:"]
  56449. }),
  56450. $globals.MethodInheritanceTest);
  56451. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  56452. $core.addMethod(
  56453. $core.method({
  56454. selector: "testAbs",
  56455. protocol: "tests",
  56456. fn: function (){
  56457. var self=this,$self=this;
  56458. return $core.withContext(function($ctx1) {
  56459. var $1;
  56460. $1=(4)._abs();
  56461. $ctx1.sendIdx["abs"]=1;
  56462. $self._assert_equals_($1,(4));
  56463. $ctx1.sendIdx["assert:equals:"]=1;
  56464. $self._assert_equals_((-4)._abs(),(4));
  56465. return self;
  56466. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  56467. },
  56468. args: [],
  56469. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  56470. referencedClasses: [],
  56471. messageSends: ["assert:equals:", "abs"]
  56472. }),
  56473. $globals.NumberTest);
  56474. $core.addMethod(
  56475. $core.method({
  56476. selector: "testArithmetic",
  56477. protocol: "tests",
  56478. fn: function (){
  56479. var self=this,$self=this;
  56480. return $core.withContext(function($ctx1) {
  56481. var $1,$2,$3,$5,$4;
  56482. $1=(1.5).__plus((1));
  56483. $ctx1.sendIdx["+"]=1;
  56484. $self._assert_equals_($1,(2.5));
  56485. $ctx1.sendIdx["assert:equals:"]=1;
  56486. $2=(2).__minus((1));
  56487. $ctx1.sendIdx["-"]=1;
  56488. $self._assert_equals_($2,(1));
  56489. $ctx1.sendIdx["assert:equals:"]=2;
  56490. $self._assert_equals_((-2).__minus((1)),(-3));
  56491. $ctx1.sendIdx["assert:equals:"]=3;
  56492. $self._assert_equals_((12).__slash((2)),(6));
  56493. $ctx1.sendIdx["assert:equals:"]=4;
  56494. $3=(3).__star((4));
  56495. $ctx1.sendIdx["*"]=1;
  56496. $self._assert_equals_($3,(12));
  56497. $ctx1.sendIdx["assert:equals:"]=5;
  56498. $self._assert_equals_((7).__slash_slash((2)),(3));
  56499. $ctx1.sendIdx["assert:equals:"]=6;
  56500. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  56501. $ctx1.sendIdx["assert:equals:"]=7;
  56502. $5=(1).__plus((2));
  56503. $ctx1.sendIdx["+"]=2;
  56504. $4=$recv($5).__star((3));
  56505. $ctx1.sendIdx["*"]=2;
  56506. $self._assert_equals_($4,(9));
  56507. $ctx1.sendIdx["assert:equals:"]=8;
  56508. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  56509. return self;
  56510. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  56511. },
  56512. args: [],
  56513. source: "testArithmetic\x0a\x09\x0a\x09\x22We rely on JS here, so we won't test complex behavior, just check if\x0a\x09message sends are corrects\x22\x0a\x0a\x09self assert: 1.5 + 1 equals: 2.5.\x0a\x09self assert: 2 - 1 equals: 1.\x0a\x09self assert: -2 - 1 equals: -3.\x0a\x09self assert: 12 / 2 equals: 6.\x0a\x09self assert: 3 * 4 equals: 12.\x0a\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7",
  56514. referencedClasses: [],
  56515. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  56516. }),
  56517. $globals.NumberTest);
  56518. $core.addMethod(
  56519. $core.method({
  56520. selector: "testAsNumber",
  56521. protocol: "tests",
  56522. fn: function (){
  56523. var self=this,$self=this;
  56524. return $core.withContext(function($ctx1) {
  56525. $self._assert_equals_((3)._asNumber(),(3));
  56526. return self;
  56527. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  56528. },
  56529. args: [],
  56530. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  56531. referencedClasses: [],
  56532. messageSends: ["assert:equals:", "asNumber"]
  56533. }),
  56534. $globals.NumberTest);
  56535. $core.addMethod(
  56536. $core.method({
  56537. selector: "testCeiling",
  56538. protocol: "tests",
  56539. fn: function (){
  56540. var self=this,$self=this;
  56541. return $core.withContext(function($ctx1) {
  56542. var $1,$2;
  56543. $1=(1.2)._ceiling();
  56544. $ctx1.sendIdx["ceiling"]=1;
  56545. $self._assert_equals_($1,(2));
  56546. $ctx1.sendIdx["assert:equals:"]=1;
  56547. $2=(-1.2)._ceiling();
  56548. $ctx1.sendIdx["ceiling"]=2;
  56549. $self._assert_equals_($2,(-1));
  56550. $ctx1.sendIdx["assert:equals:"]=2;
  56551. $self._assert_equals_((1)._ceiling(),(1));
  56552. return self;
  56553. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  56554. },
  56555. args: [],
  56556. source: "testCeiling\x0a\x09self assert: 1.2 ceiling equals: 2.\x0a\x09self assert: -1.2 ceiling equals: -1.\x0a\x09self assert: 1.0 ceiling equals: 1.",
  56557. referencedClasses: [],
  56558. messageSends: ["assert:equals:", "ceiling"]
  56559. }),
  56560. $globals.NumberTest);
  56561. $core.addMethod(
  56562. $core.method({
  56563. selector: "testComparison",
  56564. protocol: "tests",
  56565. fn: function (){
  56566. var self=this,$self=this;
  56567. return $core.withContext(function($ctx1) {
  56568. var $1,$2,$3,$4;
  56569. $1=(3).__gt((2));
  56570. $ctx1.sendIdx[">"]=1;
  56571. $self._assert_($1);
  56572. $ctx1.sendIdx["assert:"]=1;
  56573. $2=(2).__lt((3));
  56574. $ctx1.sendIdx["<"]=1;
  56575. $self._assert_($2);
  56576. $ctx1.sendIdx["assert:"]=2;
  56577. $self._deny_((3).__lt((2)));
  56578. $ctx1.sendIdx["deny:"]=1;
  56579. $self._deny_((2).__gt((3)));
  56580. $3=(3).__gt_eq((3));
  56581. $ctx1.sendIdx[">="]=1;
  56582. $self._assert_($3);
  56583. $ctx1.sendIdx["assert:"]=3;
  56584. $self._assert_((3.1).__gt_eq((3)));
  56585. $ctx1.sendIdx["assert:"]=4;
  56586. $4=(3).__lt_eq((3));
  56587. $ctx1.sendIdx["<="]=1;
  56588. $self._assert_($4);
  56589. $ctx1.sendIdx["assert:"]=5;
  56590. $self._assert_((3).__lt_eq((3.1)));
  56591. return self;
  56592. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  56593. },
  56594. args: [],
  56595. source: "testComparison\x0a\x0a\x09self assert: 3 > 2.\x0a\x09self assert: 2 < 3.\x0a\x09\x0a\x09self deny: 3 < 2.\x0a\x09self deny: 2 > 3.\x0a\x0a\x09self assert: 3 >= 3.\x0a\x09self assert: 3.1 >= 3.\x0a\x09self assert: 3 <= 3.\x0a\x09self assert: 3 <= 3.1",
  56596. referencedClasses: [],
  56597. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  56598. }),
  56599. $globals.NumberTest);
  56600. $core.addMethod(
  56601. $core.method({
  56602. selector: "testCopying",
  56603. protocol: "tests",
  56604. fn: function (){
  56605. var self=this,$self=this;
  56606. return $core.withContext(function($ctx1) {
  56607. var $1;
  56608. $1=$recv((1)._copy()).__eq_eq((1));
  56609. $ctx1.sendIdx["=="]=1;
  56610. $self._assert_($1);
  56611. $ctx1.sendIdx["assert:"]=1;
  56612. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  56613. return self;
  56614. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  56615. },
  56616. args: [],
  56617. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  56618. referencedClasses: [],
  56619. messageSends: ["assert:", "==", "copy", "deepCopy"]
  56620. }),
  56621. $globals.NumberTest);
  56622. $core.addMethod(
  56623. $core.method({
  56624. selector: "testEquality",
  56625. protocol: "tests",
  56626. fn: function (){
  56627. var self=this,$self=this;
  56628. return $core.withContext(function($ctx1) {
  56629. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  56630. $1=(1).__eq((1));
  56631. $ctx1.sendIdx["="]=1;
  56632. $self._assert_($1);
  56633. $ctx1.sendIdx["assert:"]=1;
  56634. $2=(0).__eq((0));
  56635. $ctx1.sendIdx["="]=2;
  56636. $self._assert_($2);
  56637. $ctx1.sendIdx["assert:"]=2;
  56638. $3=(1).__eq((0));
  56639. $ctx1.sendIdx["="]=3;
  56640. $self._deny_($3);
  56641. $ctx1.sendIdx["deny:"]=1;
  56642. $5=(1)._yourself();
  56643. $ctx1.sendIdx["yourself"]=1;
  56644. $4=$recv($5).__eq((1));
  56645. $ctx1.sendIdx["="]=4;
  56646. $self._assert_($4);
  56647. $ctx1.sendIdx["assert:"]=3;
  56648. $7=(1)._yourself();
  56649. $ctx1.sendIdx["yourself"]=2;
  56650. $6=(1).__eq($7);
  56651. $ctx1.sendIdx["="]=5;
  56652. $self._assert_($6);
  56653. $ctx1.sendIdx["assert:"]=4;
  56654. $9=(1)._yourself();
  56655. $ctx1.sendIdx["yourself"]=3;
  56656. $8=$recv($9).__eq((1)._yourself());
  56657. $ctx1.sendIdx["="]=6;
  56658. $self._assert_($8);
  56659. $10=(0).__eq(false);
  56660. $ctx1.sendIdx["="]=7;
  56661. $self._deny_($10);
  56662. $ctx1.sendIdx["deny:"]=2;
  56663. $11=false.__eq((0));
  56664. $ctx1.sendIdx["="]=8;
  56665. $self._deny_($11);
  56666. $ctx1.sendIdx["deny:"]=3;
  56667. $12="".__eq((0));
  56668. $ctx1.sendIdx["="]=9;
  56669. $self._deny_($12);
  56670. $ctx1.sendIdx["deny:"]=4;
  56671. $self._deny_((0).__eq(""));
  56672. return self;
  56673. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  56674. },
  56675. args: [],
  56676. source: "testEquality\x0a\x09self assert: (1 = 1).\x0a\x09self assert: (0 = 0).\x0a\x09self deny: (1 = 0).\x0a\x0a\x09self assert: (1 yourself = 1).\x0a\x09self assert: (1 = 1 yourself).\x0a\x09self assert: (1 yourself = 1 yourself).\x0a\x09\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = 0.\x0a\x09self deny: 0 = ''",
  56677. referencedClasses: [],
  56678. messageSends: ["assert:", "=", "deny:", "yourself"]
  56679. }),
  56680. $globals.NumberTest);
  56681. $core.addMethod(
  56682. $core.method({
  56683. selector: "testFloor",
  56684. protocol: "tests",
  56685. fn: function (){
  56686. var self=this,$self=this;
  56687. return $core.withContext(function($ctx1) {
  56688. var $1,$2;
  56689. $1=(1.2)._floor();
  56690. $ctx1.sendIdx["floor"]=1;
  56691. $self._assert_equals_($1,(1));
  56692. $ctx1.sendIdx["assert:equals:"]=1;
  56693. $2=(-1.2)._floor();
  56694. $ctx1.sendIdx["floor"]=2;
  56695. $self._assert_equals_($2,(-2));
  56696. $ctx1.sendIdx["assert:equals:"]=2;
  56697. $self._assert_equals_((1)._floor(),(1));
  56698. return self;
  56699. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  56700. },
  56701. args: [],
  56702. source: "testFloor\x0a\x09self assert: 1.2 floor equals: 1.\x0a\x09self assert: -1.2 floor equals: -2.\x0a\x09self assert: 1.0 floor equals: 1.",
  56703. referencedClasses: [],
  56704. messageSends: ["assert:equals:", "floor"]
  56705. }),
  56706. $globals.NumberTest);
  56707. $core.addMethod(
  56708. $core.method({
  56709. selector: "testHexNumbers",
  56710. protocol: "tests",
  56711. fn: function (){
  56712. var self=this,$self=this;
  56713. return $core.withContext(function($ctx1) {
  56714. var $1,$2,$3,$4,$5;
  56715. $self._assert_equals_((9),(9));
  56716. $ctx1.sendIdx["assert:equals:"]=1;
  56717. $1=(10)._truncated();
  56718. $ctx1.sendIdx["truncated"]=1;
  56719. $self._assert_equals_($1,(10));
  56720. $ctx1.sendIdx["assert:equals:"]=2;
  56721. $2=(11)._truncated();
  56722. $ctx1.sendIdx["truncated"]=2;
  56723. $self._assert_equals_($2,(11));
  56724. $ctx1.sendIdx["assert:equals:"]=3;
  56725. $3=(12)._truncated();
  56726. $ctx1.sendIdx["truncated"]=3;
  56727. $self._assert_equals_($3,(12));
  56728. $ctx1.sendIdx["assert:equals:"]=4;
  56729. $4=(13)._truncated();
  56730. $ctx1.sendIdx["truncated"]=4;
  56731. $self._assert_equals_($4,(13));
  56732. $ctx1.sendIdx["assert:equals:"]=5;
  56733. $5=(14)._truncated();
  56734. $ctx1.sendIdx["truncated"]=5;
  56735. $self._assert_equals_($5,(14));
  56736. $ctx1.sendIdx["assert:equals:"]=6;
  56737. $self._assert_equals_((15)._truncated(),(15));
  56738. return self;
  56739. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  56740. },
  56741. args: [],
  56742. source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 equals: 9.\x0a\x09self assert: 16rA truncated equals: 10.\x0a\x09self assert: 16rB truncated equals: 11.\x0a\x09self assert: 16rC truncated equals: 12.\x0a\x09self assert: 16rD truncated equals: 13.\x0a\x09self assert: 16rE truncated equals: 14.\x0a\x09self assert: 16rF truncated equals: 15",
  56743. referencedClasses: [],
  56744. messageSends: ["assert:equals:", "truncated"]
  56745. }),
  56746. $globals.NumberTest);
  56747. $core.addMethod(
  56748. $core.method({
  56749. selector: "testIdentity",
  56750. protocol: "tests",
  56751. fn: function (){
  56752. var self=this,$self=this;
  56753. return $core.withContext(function($ctx1) {
  56754. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  56755. $1=(1).__eq_eq((1));
  56756. $ctx1.sendIdx["=="]=1;
  56757. $self._assert_($1);
  56758. $ctx1.sendIdx["assert:"]=1;
  56759. $2=(0).__eq_eq((0));
  56760. $ctx1.sendIdx["=="]=2;
  56761. $self._assert_($2);
  56762. $ctx1.sendIdx["assert:"]=2;
  56763. $3=(1).__eq_eq((0));
  56764. $ctx1.sendIdx["=="]=3;
  56765. $self._deny_($3);
  56766. $ctx1.sendIdx["deny:"]=1;
  56767. $5=(1)._yourself();
  56768. $ctx1.sendIdx["yourself"]=1;
  56769. $4=$recv($5).__eq_eq((1));
  56770. $ctx1.sendIdx["=="]=4;
  56771. $self._assert_($4);
  56772. $ctx1.sendIdx["assert:"]=3;
  56773. $7=(1)._yourself();
  56774. $ctx1.sendIdx["yourself"]=2;
  56775. $6=(1).__eq_eq($7);
  56776. $ctx1.sendIdx["=="]=5;
  56777. $self._assert_($6);
  56778. $ctx1.sendIdx["assert:"]=4;
  56779. $9=(1)._yourself();
  56780. $ctx1.sendIdx["yourself"]=3;
  56781. $8=$recv($9).__eq_eq((1)._yourself());
  56782. $ctx1.sendIdx["=="]=6;
  56783. $self._assert_($8);
  56784. $self._deny_((1).__eq_eq((2)));
  56785. return self;
  56786. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  56787. },
  56788. args: [],
  56789. source: "testIdentity\x0a\x09self assert: 1 == 1.\x0a\x09self assert: 0 == 0.\x0a\x09self deny: 1 == 0.\x0a\x0a\x09self assert: 1 yourself == 1.\x0a\x09self assert: 1 == 1 yourself.\x0a\x09self assert: 1 yourself == 1 yourself.\x0a\x09\x0a\x09self deny: 1 == 2",
  56790. referencedClasses: [],
  56791. messageSends: ["assert:", "==", "deny:", "yourself"]
  56792. }),
  56793. $globals.NumberTest);
  56794. $core.addMethod(
  56795. $core.method({
  56796. selector: "testInvalidHexNumbers",
  56797. protocol: "tests",
  56798. fn: function (){
  56799. var self=this,$self=this;
  56800. return $core.withContext(function($ctx1) {
  56801. $self._should_raise_((function(){
  56802. return $core.withContext(function($ctx2) {
  56803. return (16)._rG();
  56804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56805. }),$globals.MessageNotUnderstood);
  56806. $ctx1.sendIdx["should:raise:"]=1;
  56807. $self._should_raise_((function(){
  56808. return $core.withContext(function($ctx2) {
  56809. return (16)._rg();
  56810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56811. }),$globals.MessageNotUnderstood);
  56812. $ctx1.sendIdx["should:raise:"]=2;
  56813. $self._should_raise_((function(){
  56814. return $core.withContext(function($ctx2) {
  56815. return (16)._rH();
  56816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56817. }),$globals.MessageNotUnderstood);
  56818. $ctx1.sendIdx["should:raise:"]=3;
  56819. $self._should_raise_((function(){
  56820. return $core.withContext(function($ctx2) {
  56821. return (16)._rh();
  56822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  56823. }),$globals.MessageNotUnderstood);
  56824. $ctx1.sendIdx["should:raise:"]=4;
  56825. $self._should_raise_((function(){
  56826. return $core.withContext(function($ctx2) {
  56827. return (16)._rI();
  56828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  56829. }),$globals.MessageNotUnderstood);
  56830. $ctx1.sendIdx["should:raise:"]=5;
  56831. $self._should_raise_((function(){
  56832. return $core.withContext(function($ctx2) {
  56833. return (16)._ri();
  56834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  56835. }),$globals.MessageNotUnderstood);
  56836. $ctx1.sendIdx["should:raise:"]=6;
  56837. $self._should_raise_((function(){
  56838. return $core.withContext(function($ctx2) {
  56839. return (16)._rJ();
  56840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  56841. }),$globals.MessageNotUnderstood);
  56842. $ctx1.sendIdx["should:raise:"]=7;
  56843. $self._should_raise_((function(){
  56844. return $core.withContext(function($ctx2) {
  56845. return (16)._rj();
  56846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  56847. }),$globals.MessageNotUnderstood);
  56848. $ctx1.sendIdx["should:raise:"]=8;
  56849. $self._should_raise_((function(){
  56850. return $core.withContext(function($ctx2) {
  56851. return (16)._rK();
  56852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  56853. }),$globals.MessageNotUnderstood);
  56854. $ctx1.sendIdx["should:raise:"]=9;
  56855. $self._should_raise_((function(){
  56856. return $core.withContext(function($ctx2) {
  56857. return (16)._rk();
  56858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  56859. }),$globals.MessageNotUnderstood);
  56860. $ctx1.sendIdx["should:raise:"]=10;
  56861. $self._should_raise_((function(){
  56862. return $core.withContext(function($ctx2) {
  56863. return (16)._rL();
  56864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  56865. }),$globals.MessageNotUnderstood);
  56866. $ctx1.sendIdx["should:raise:"]=11;
  56867. $self._should_raise_((function(){
  56868. return $core.withContext(function($ctx2) {
  56869. return (16)._rl();
  56870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  56871. }),$globals.MessageNotUnderstood);
  56872. $ctx1.sendIdx["should:raise:"]=12;
  56873. $self._should_raise_((function(){
  56874. return $core.withContext(function($ctx2) {
  56875. return (16)._rM();
  56876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  56877. }),$globals.MessageNotUnderstood);
  56878. $ctx1.sendIdx["should:raise:"]=13;
  56879. $self._should_raise_((function(){
  56880. return $core.withContext(function($ctx2) {
  56881. return (16)._rm();
  56882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  56883. }),$globals.MessageNotUnderstood);
  56884. $ctx1.sendIdx["should:raise:"]=14;
  56885. $self._should_raise_((function(){
  56886. return $core.withContext(function($ctx2) {
  56887. return (16)._rN();
  56888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  56889. }),$globals.MessageNotUnderstood);
  56890. $ctx1.sendIdx["should:raise:"]=15;
  56891. $self._should_raise_((function(){
  56892. return $core.withContext(function($ctx2) {
  56893. return (16)._rn();
  56894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  56895. }),$globals.MessageNotUnderstood);
  56896. $ctx1.sendIdx["should:raise:"]=16;
  56897. $self._should_raise_((function(){
  56898. return $core.withContext(function($ctx2) {
  56899. return (16)._rO();
  56900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  56901. }),$globals.MessageNotUnderstood);
  56902. $ctx1.sendIdx["should:raise:"]=17;
  56903. $self._should_raise_((function(){
  56904. return $core.withContext(function($ctx2) {
  56905. return (16)._ro();
  56906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  56907. }),$globals.MessageNotUnderstood);
  56908. $ctx1.sendIdx["should:raise:"]=18;
  56909. $self._should_raise_((function(){
  56910. return $core.withContext(function($ctx2) {
  56911. return (16)._rP();
  56912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  56913. }),$globals.MessageNotUnderstood);
  56914. $ctx1.sendIdx["should:raise:"]=19;
  56915. $self._should_raise_((function(){
  56916. return $core.withContext(function($ctx2) {
  56917. return (16)._rp();
  56918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  56919. }),$globals.MessageNotUnderstood);
  56920. $ctx1.sendIdx["should:raise:"]=20;
  56921. $self._should_raise_((function(){
  56922. return $core.withContext(function($ctx2) {
  56923. return (16)._rQ();
  56924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  56925. }),$globals.MessageNotUnderstood);
  56926. $ctx1.sendIdx["should:raise:"]=21;
  56927. $self._should_raise_((function(){
  56928. return $core.withContext(function($ctx2) {
  56929. return (16)._rq();
  56930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  56931. }),$globals.MessageNotUnderstood);
  56932. $ctx1.sendIdx["should:raise:"]=22;
  56933. $self._should_raise_((function(){
  56934. return $core.withContext(function($ctx2) {
  56935. return (16)._rR();
  56936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  56937. }),$globals.MessageNotUnderstood);
  56938. $ctx1.sendIdx["should:raise:"]=23;
  56939. $self._should_raise_((function(){
  56940. return $core.withContext(function($ctx2) {
  56941. return (16)._rr();
  56942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  56943. }),$globals.MessageNotUnderstood);
  56944. $ctx1.sendIdx["should:raise:"]=24;
  56945. $self._should_raise_((function(){
  56946. return $core.withContext(function($ctx2) {
  56947. return (16)._rS();
  56948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  56949. }),$globals.MessageNotUnderstood);
  56950. $ctx1.sendIdx["should:raise:"]=25;
  56951. $self._should_raise_((function(){
  56952. return $core.withContext(function($ctx2) {
  56953. return (16)._rs();
  56954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  56955. }),$globals.MessageNotUnderstood);
  56956. $ctx1.sendIdx["should:raise:"]=26;
  56957. $self._should_raise_((function(){
  56958. return $core.withContext(function($ctx2) {
  56959. return (16)._rT();
  56960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  56961. }),$globals.MessageNotUnderstood);
  56962. $ctx1.sendIdx["should:raise:"]=27;
  56963. $self._should_raise_((function(){
  56964. return $core.withContext(function($ctx2) {
  56965. return (16)._rt();
  56966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  56967. }),$globals.MessageNotUnderstood);
  56968. $ctx1.sendIdx["should:raise:"]=28;
  56969. $self._should_raise_((function(){
  56970. return $core.withContext(function($ctx2) {
  56971. return (16)._rU();
  56972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  56973. }),$globals.MessageNotUnderstood);
  56974. $ctx1.sendIdx["should:raise:"]=29;
  56975. $self._should_raise_((function(){
  56976. return $core.withContext(function($ctx2) {
  56977. return (16)._ru();
  56978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  56979. }),$globals.MessageNotUnderstood);
  56980. $ctx1.sendIdx["should:raise:"]=30;
  56981. $self._should_raise_((function(){
  56982. return $core.withContext(function($ctx2) {
  56983. return (16)._rV();
  56984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  56985. }),$globals.MessageNotUnderstood);
  56986. $ctx1.sendIdx["should:raise:"]=31;
  56987. $self._should_raise_((function(){
  56988. return $core.withContext(function($ctx2) {
  56989. return (16)._rv();
  56990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  56991. }),$globals.MessageNotUnderstood);
  56992. $ctx1.sendIdx["should:raise:"]=32;
  56993. $self._should_raise_((function(){
  56994. return $core.withContext(function($ctx2) {
  56995. return (16)._rW();
  56996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  56997. }),$globals.MessageNotUnderstood);
  56998. $ctx1.sendIdx["should:raise:"]=33;
  56999. $self._should_raise_((function(){
  57000. return $core.withContext(function($ctx2) {
  57001. return (16)._rw();
  57002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  57003. }),$globals.MessageNotUnderstood);
  57004. $ctx1.sendIdx["should:raise:"]=34;
  57005. $self._should_raise_((function(){
  57006. return $core.withContext(function($ctx2) {
  57007. return (16)._rX();
  57008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  57009. }),$globals.MessageNotUnderstood);
  57010. $ctx1.sendIdx["should:raise:"]=35;
  57011. $self._should_raise_((function(){
  57012. return $core.withContext(function($ctx2) {
  57013. return (16)._rx();
  57014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  57015. }),$globals.MessageNotUnderstood);
  57016. $ctx1.sendIdx["should:raise:"]=36;
  57017. $self._should_raise_((function(){
  57018. return $core.withContext(function($ctx2) {
  57019. return (16)._rY();
  57020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  57021. }),$globals.MessageNotUnderstood);
  57022. $ctx1.sendIdx["should:raise:"]=37;
  57023. $self._should_raise_((function(){
  57024. return $core.withContext(function($ctx2) {
  57025. return (16)._ry();
  57026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  57027. }),$globals.MessageNotUnderstood);
  57028. $ctx1.sendIdx["should:raise:"]=38;
  57029. $self._should_raise_((function(){
  57030. return $core.withContext(function($ctx2) {
  57031. return (16)._rZ();
  57032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  57033. }),$globals.MessageNotUnderstood);
  57034. $ctx1.sendIdx["should:raise:"]=39;
  57035. $self._should_raise_((function(){
  57036. return $core.withContext(function($ctx2) {
  57037. return (16)._rz();
  57038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  57039. }),$globals.MessageNotUnderstood);
  57040. $ctx1.sendIdx["should:raise:"]=40;
  57041. $self._should_raise_((function(){
  57042. return $core.withContext(function($ctx2) {
  57043. return (11259375)._Z();
  57044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  57045. }),$globals.MessageNotUnderstood);
  57046. return self;
  57047. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  57048. },
  57049. args: [],
  57050. source: "testInvalidHexNumbers\x0a\x0a\x09self should: [ 16rG ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rg ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rH ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rh ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rI ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ri ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rJ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rj ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rK ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rk ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rL ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rl ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rM ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rm ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rN ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rn ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rO ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ro ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rP ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rp ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rQ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rq ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rR ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rr ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rS ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rs ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rT ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rt ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rU ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ru ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rV ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rv ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rW ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rw ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rX ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rx ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rY ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ry ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rZ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rz ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rABcdEfZ ] raise: MessageNotUnderstood.",
  57051. referencedClasses: ["MessageNotUnderstood"],
  57052. messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"]
  57053. }),
  57054. $globals.NumberTest);
  57055. $core.addMethod(
  57056. $core.method({
  57057. selector: "testLog",
  57058. protocol: "tests",
  57059. fn: function (){
  57060. var self=this,$self=this;
  57061. return $core.withContext(function($ctx1) {
  57062. $self._assert_equals_((10000)._log(),(4));
  57063. $ctx1.sendIdx["assert:equals:"]=1;
  57064. $self._assert_equals_((512)._log_((2)),(9));
  57065. $ctx1.sendIdx["assert:equals:"]=2;
  57066. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  57067. return self;
  57068. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  57069. },
  57070. args: [],
  57071. source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.",
  57072. referencedClasses: ["Number"],
  57073. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  57074. }),
  57075. $globals.NumberTest);
  57076. $core.addMethod(
  57077. $core.method({
  57078. selector: "testMinMax",
  57079. protocol: "tests",
  57080. fn: function (){
  57081. var self=this,$self=this;
  57082. return $core.withContext(function($ctx1) {
  57083. $self._assert_equals_((2)._max_((5)),(5));
  57084. $ctx1.sendIdx["assert:equals:"]=1;
  57085. $self._assert_equals_((2)._min_((5)),(2));
  57086. return self;
  57087. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  57088. },
  57089. args: [],
  57090. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  57091. referencedClasses: [],
  57092. messageSends: ["assert:equals:", "max:", "min:"]
  57093. }),
  57094. $globals.NumberTest);
  57095. $core.addMethod(
  57096. $core.method({
  57097. selector: "testNegated",
  57098. protocol: "tests",
  57099. fn: function (){
  57100. var self=this,$self=this;
  57101. return $core.withContext(function($ctx1) {
  57102. var $1;
  57103. $1=(3)._negated();
  57104. $ctx1.sendIdx["negated"]=1;
  57105. $self._assert_equals_($1,(-3));
  57106. $ctx1.sendIdx["assert:equals:"]=1;
  57107. $self._assert_equals_((-3)._negated(),(3));
  57108. return self;
  57109. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  57110. },
  57111. args: [],
  57112. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  57113. referencedClasses: [],
  57114. messageSends: ["assert:equals:", "negated"]
  57115. }),
  57116. $globals.NumberTest);
  57117. $core.addMethod(
  57118. $core.method({
  57119. selector: "testPrintShowingDecimalPlaces",
  57120. protocol: "tests",
  57121. fn: function (){
  57122. var self=this,$self=this;
  57123. return $core.withContext(function($ctx1) {
  57124. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  57125. $1=(23)._printShowingDecimalPlaces_((2));
  57126. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  57127. $self._assert_equals_($1,"23.00");
  57128. $ctx1.sendIdx["assert:equals:"]=1;
  57129. $2=(23.5698)._printShowingDecimalPlaces_((2));
  57130. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  57131. $self._assert_equals_($2,"23.57");
  57132. $ctx1.sendIdx["assert:equals:"]=2;
  57133. $4=(234.567)._negated();
  57134. $ctx1.sendIdx["negated"]=1;
  57135. $3=$recv($4)._printShowingDecimalPlaces_((5));
  57136. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  57137. $self._assert_equals_($3,"-234.56700");
  57138. $ctx1.sendIdx["assert:equals:"]=3;
  57139. $5=(23.4567)._printShowingDecimalPlaces_((0));
  57140. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  57141. $self._assert_equals_($5,"23");
  57142. $ctx1.sendIdx["assert:equals:"]=4;
  57143. $6=(23.5567)._printShowingDecimalPlaces_((0));
  57144. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  57145. $self._assert_equals_($6,"24");
  57146. $ctx1.sendIdx["assert:equals:"]=5;
  57147. $8=(23.4567)._negated();
  57148. $ctx1.sendIdx["negated"]=2;
  57149. $7=$recv($8)._printShowingDecimalPlaces_((0));
  57150. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  57151. $self._assert_equals_($7,"-23");
  57152. $ctx1.sendIdx["assert:equals:"]=6;
  57153. $10=(23.5567)._negated();
  57154. $ctx1.sendIdx["negated"]=3;
  57155. $9=$recv($10)._printShowingDecimalPlaces_((0));
  57156. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  57157. $self._assert_equals_($9,"-24");
  57158. $ctx1.sendIdx["assert:equals:"]=7;
  57159. $11=(100000000)._printShowingDecimalPlaces_((1));
  57160. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  57161. $self._assert_equals_($11,"100000000.0");
  57162. $ctx1.sendIdx["assert:equals:"]=8;
  57163. $12=(0.98)._printShowingDecimalPlaces_((5));
  57164. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  57165. $self._assert_equals_($12,"0.98000");
  57166. $ctx1.sendIdx["assert:equals:"]=9;
  57167. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  57168. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  57169. $self._assert_equals_($13,"-0.98");
  57170. $ctx1.sendIdx["assert:equals:"]=10;
  57171. $14=(2.567)._printShowingDecimalPlaces_((2));
  57172. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  57173. $self._assert_equals_($14,"2.57");
  57174. $ctx1.sendIdx["assert:equals:"]=11;
  57175. $15=(-2.567)._printShowingDecimalPlaces_((2));
  57176. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  57177. $self._assert_equals_($15,"-2.57");
  57178. $ctx1.sendIdx["assert:equals:"]=12;
  57179. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  57180. return self;
  57181. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  57182. },
  57183. args: [],
  57184. source: "testPrintShowingDecimalPlaces\x0a\x09self assert: (23 printShowingDecimalPlaces: 2) equals: '23.00'.\x0a\x09self assert: (23.5698 printShowingDecimalPlaces: 2) equals: '23.57'.\x0a\x09self assert: (234.567 negated printShowingDecimalPlaces: 5) equals: '-234.56700'.\x0a\x09self assert: (23.4567 printShowingDecimalPlaces: 0) equals: '23'.\x0a\x09self assert: (23.5567 printShowingDecimalPlaces: 0) equals: '24'.\x0a\x09self assert: (23.4567 negated printShowingDecimalPlaces: 0) equals: '-23'.\x0a\x09self assert: (23.5567 negated printShowingDecimalPlaces: 0) equals: '-24'.\x0a\x09self assert: (100000000 printShowingDecimalPlaces: 1) equals: '100000000.0'.\x0a\x09self assert: (0.98 printShowingDecimalPlaces: 5) equals: '0.98000'.\x0a\x09self assert: (0.98 negated printShowingDecimalPlaces: 2) equals: '-0.98'.\x0a\x09self assert: (2.567 printShowingDecimalPlaces: 2) equals: '2.57'.\x0a\x09self assert: (-2.567 printShowingDecimalPlaces: 2) equals: '-2.57'.\x0a\x09self assert: (0 printShowingDecimalPlaces: 2) equals: '0.00'.",
  57185. referencedClasses: [],
  57186. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  57187. }),
  57188. $globals.NumberTest);
  57189. $core.addMethod(
  57190. $core.method({
  57191. selector: "testRaisedTo",
  57192. protocol: "tests",
  57193. fn: function (){
  57194. var self=this,$self=this;
  57195. return $core.withContext(function($ctx1) {
  57196. var $1,$2,$3;
  57197. $1=(2)._raisedTo_((4));
  57198. $ctx1.sendIdx["raisedTo:"]=1;
  57199. $self._assert_equals_($1,(16));
  57200. $ctx1.sendIdx["assert:equals:"]=1;
  57201. $2=(2)._raisedTo_((0));
  57202. $ctx1.sendIdx["raisedTo:"]=2;
  57203. $self._assert_equals_($2,(1));
  57204. $ctx1.sendIdx["assert:equals:"]=2;
  57205. $3=(2)._raisedTo_((-3));
  57206. $ctx1.sendIdx["raisedTo:"]=3;
  57207. $self._assert_equals_($3,(0.125));
  57208. $ctx1.sendIdx["assert:equals:"]=3;
  57209. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  57210. $ctx1.sendIdx["assert:equals:"]=4;
  57211. $self._assert_equals_((2).__star_star((4)),(16));
  57212. return self;
  57213. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  57214. },
  57215. args: [],
  57216. source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.",
  57217. referencedClasses: [],
  57218. messageSends: ["assert:equals:", "raisedTo:", "**"]
  57219. }),
  57220. $globals.NumberTest);
  57221. $core.addMethod(
  57222. $core.method({
  57223. selector: "testRounded",
  57224. protocol: "tests",
  57225. fn: function (){
  57226. var self=this,$self=this;
  57227. return $core.withContext(function($ctx1) {
  57228. var $1,$2;
  57229. $1=(3)._rounded();
  57230. $ctx1.sendIdx["rounded"]=1;
  57231. $self._assert_equals_($1,(3));
  57232. $ctx1.sendIdx["assert:equals:"]=1;
  57233. $2=(3.212)._rounded();
  57234. $ctx1.sendIdx["rounded"]=2;
  57235. $self._assert_equals_($2,(3));
  57236. $ctx1.sendIdx["assert:equals:"]=2;
  57237. $self._assert_equals_((3.51)._rounded(),(4));
  57238. return self;
  57239. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  57240. },
  57241. args: [],
  57242. source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded equals: 3.\x0a\x09self assert: 3.212 rounded equals: 3.\x0a\x09self assert: 3.51 rounded equals: 4",
  57243. referencedClasses: [],
  57244. messageSends: ["assert:equals:", "rounded"]
  57245. }),
  57246. $globals.NumberTest);
  57247. $core.addMethod(
  57248. $core.method({
  57249. selector: "testSign",
  57250. protocol: "tests",
  57251. fn: function (){
  57252. var self=this,$self=this;
  57253. return $core.withContext(function($ctx1) {
  57254. var $1,$2;
  57255. $1=(5)._sign();
  57256. $ctx1.sendIdx["sign"]=1;
  57257. $self._assert_equals_($1,(1));
  57258. $ctx1.sendIdx["assert:equals:"]=1;
  57259. $2=(0)._sign();
  57260. $ctx1.sendIdx["sign"]=2;
  57261. $self._assert_equals_($2,(0));
  57262. $ctx1.sendIdx["assert:equals:"]=2;
  57263. $self._assert_equals_((-1.4)._sign(),(-1));
  57264. return self;
  57265. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  57266. },
  57267. args: [],
  57268. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  57269. referencedClasses: [],
  57270. messageSends: ["assert:equals:", "sign"]
  57271. }),
  57272. $globals.NumberTest);
  57273. $core.addMethod(
  57274. $core.method({
  57275. selector: "testSqrt",
  57276. protocol: "tests",
  57277. fn: function (){
  57278. var self=this,$self=this;
  57279. return $core.withContext(function($ctx1) {
  57280. var $1;
  57281. $1=(4)._sqrt();
  57282. $ctx1.sendIdx["sqrt"]=1;
  57283. $self._assert_equals_($1,(2));
  57284. $ctx1.sendIdx["assert:equals:"]=1;
  57285. $self._assert_equals_((16)._sqrt(),(4));
  57286. return self;
  57287. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  57288. },
  57289. args: [],
  57290. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  57291. referencedClasses: [],
  57292. messageSends: ["assert:equals:", "sqrt"]
  57293. }),
  57294. $globals.NumberTest);
  57295. $core.addMethod(
  57296. $core.method({
  57297. selector: "testSquared",
  57298. protocol: "tests",
  57299. fn: function (){
  57300. var self=this,$self=this;
  57301. return $core.withContext(function($ctx1) {
  57302. $self._assert_equals_((4)._squared(),(16));
  57303. return self;
  57304. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  57305. },
  57306. args: [],
  57307. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  57308. referencedClasses: [],
  57309. messageSends: ["assert:equals:", "squared"]
  57310. }),
  57311. $globals.NumberTest);
  57312. $core.addMethod(
  57313. $core.method({
  57314. selector: "testTimesRepeat",
  57315. protocol: "tests",
  57316. fn: function (){
  57317. var self=this,$self=this;
  57318. var i;
  57319. return $core.withContext(function($ctx1) {
  57320. i=(0);
  57321. (0)._timesRepeat_((function(){
  57322. return $core.withContext(function($ctx2) {
  57323. i=$recv(i).__plus((1));
  57324. $ctx2.sendIdx["+"]=1;
  57325. return i;
  57326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57327. }));
  57328. $ctx1.sendIdx["timesRepeat:"]=1;
  57329. $self._assert_equals_(i,(0));
  57330. $ctx1.sendIdx["assert:equals:"]=1;
  57331. (5)._timesRepeat_((function(){
  57332. return $core.withContext(function($ctx2) {
  57333. i=$recv(i).__plus((1));
  57334. return i;
  57335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57336. }));
  57337. $self._assert_equals_(i,(5));
  57338. return self;
  57339. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  57340. },
  57341. args: [],
  57342. source: "testTimesRepeat\x0a\x09| i |\x0a\x0a\x09i := 0.\x0a\x090 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 0.\x0a\x0a\x095 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 5",
  57343. referencedClasses: [],
  57344. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  57345. }),
  57346. $globals.NumberTest);
  57347. $core.addMethod(
  57348. $core.method({
  57349. selector: "testTo",
  57350. protocol: "tests",
  57351. fn: function (){
  57352. var self=this,$self=this;
  57353. return $core.withContext(function($ctx1) {
  57354. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  57355. return self;
  57356. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  57357. },
  57358. args: [],
  57359. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  57360. referencedClasses: [],
  57361. messageSends: ["assert:equals:", "to:"]
  57362. }),
  57363. $globals.NumberTest);
  57364. $core.addMethod(
  57365. $core.method({
  57366. selector: "testToBy",
  57367. protocol: "tests",
  57368. fn: function (){
  57369. var self=this,$self=this;
  57370. return $core.withContext(function($ctx1) {
  57371. var $1;
  57372. $1=(0)._to_by_((6),(2));
  57373. $ctx1.sendIdx["to:by:"]=1;
  57374. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  57375. $self._should_raise_((function(){
  57376. return $core.withContext(function($ctx2) {
  57377. return (1)._to_by_((4),(0));
  57378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57379. }),$globals.Error);
  57380. return self;
  57381. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  57382. },
  57383. args: [],
  57384. source: "testToBy\x0a\x09self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).\x0a\x0a\x09self should: [ 1 to: 4 by: 0 ] raise: Error",
  57385. referencedClasses: ["Error"],
  57386. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  57387. }),
  57388. $globals.NumberTest);
  57389. $core.addMethod(
  57390. $core.method({
  57391. selector: "testTrigonometry",
  57392. protocol: "tests",
  57393. fn: function (){
  57394. var self=this,$self=this;
  57395. return $core.withContext(function($ctx1) {
  57396. $self._assert_equals_((0)._cos(),(1));
  57397. $ctx1.sendIdx["assert:equals:"]=1;
  57398. $self._assert_equals_((0)._sin(),(0));
  57399. $ctx1.sendIdx["assert:equals:"]=2;
  57400. $self._assert_equals_((0)._tan(),(0));
  57401. $ctx1.sendIdx["assert:equals:"]=3;
  57402. $self._assert_equals_((1)._arcCos(),(0));
  57403. $ctx1.sendIdx["assert:equals:"]=4;
  57404. $self._assert_equals_((0)._arcSin(),(0));
  57405. $ctx1.sendIdx["assert:equals:"]=5;
  57406. $self._assert_equals_((0)._arcTan(),(0));
  57407. return self;
  57408. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  57409. },
  57410. args: [],
  57411. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.",
  57412. referencedClasses: [],
  57413. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  57414. }),
  57415. $globals.NumberTest);
  57416. $core.addMethod(
  57417. $core.method({
  57418. selector: "testTruncated",
  57419. protocol: "tests",
  57420. fn: function (){
  57421. var self=this,$self=this;
  57422. return $core.withContext(function($ctx1) {
  57423. var $1,$2;
  57424. $1=(3)._truncated();
  57425. $ctx1.sendIdx["truncated"]=1;
  57426. $self._assert_equals_($1,(3));
  57427. $ctx1.sendIdx["assert:equals:"]=1;
  57428. $2=(3.212)._truncated();
  57429. $ctx1.sendIdx["truncated"]=2;
  57430. $self._assert_equals_($2,(3));
  57431. $ctx1.sendIdx["assert:equals:"]=2;
  57432. $self._assert_equals_((3.51)._truncated(),(3));
  57433. return self;
  57434. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  57435. },
  57436. args: [],
  57437. source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated equals: 3.\x0a\x09self assert: 3.212 truncated equals: 3.\x0a\x09self assert: 3.51 truncated equals: 3",
  57438. referencedClasses: [],
  57439. messageSends: ["assert:equals:", "truncated"]
  57440. }),
  57441. $globals.NumberTest);
  57442. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  57443. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  57444. $core.addMethod(
  57445. $core.method({
  57446. selector: "foo",
  57447. protocol: "not yet classified",
  57448. fn: function (){
  57449. var self=this,$self=this;
  57450. return $self["@foo"];
  57451. },
  57452. args: [],
  57453. source: "foo\x0a\x09^ foo",
  57454. referencedClasses: [],
  57455. messageSends: []
  57456. }),
  57457. $globals.ObjectMock);
  57458. $core.addMethod(
  57459. $core.method({
  57460. selector: "foo:",
  57461. protocol: "not yet classified",
  57462. fn: function (anObject){
  57463. var self=this,$self=this;
  57464. $self["@foo"]=anObject;
  57465. return self;
  57466. },
  57467. args: ["anObject"],
  57468. source: "foo: anObject\x0a\x09foo := anObject",
  57469. referencedClasses: [],
  57470. messageSends: []
  57471. }),
  57472. $globals.ObjectMock);
  57473. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  57474. $core.addMethod(
  57475. $core.method({
  57476. selector: "notDefined",
  57477. protocol: "tests",
  57478. fn: function (){
  57479. var self=this,$self=this;
  57480. return $core.withContext(function($ctx1) {
  57481. return void 0;;
  57482. return self;
  57483. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  57484. },
  57485. args: [],
  57486. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  57487. referencedClasses: [],
  57488. messageSends: []
  57489. }),
  57490. $globals.ObjectTest);
  57491. $core.addMethod(
  57492. $core.method({
  57493. selector: "testBasicAccess",
  57494. protocol: "tests",
  57495. fn: function (){
  57496. var self=this,$self=this;
  57497. var o;
  57498. return $core.withContext(function($ctx1) {
  57499. var $1;
  57500. o=$recv($globals.Object)._new();
  57501. $recv(o)._basicAt_put_("a",(1));
  57502. $1=$recv(o)._basicAt_("a");
  57503. $ctx1.sendIdx["basicAt:"]=1;
  57504. $self._assert_equals_($1,(1));
  57505. $ctx1.sendIdx["assert:equals:"]=1;
  57506. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  57507. return self;
  57508. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  57509. },
  57510. args: [],
  57511. source: "testBasicAccess\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'a' put: 1.\x0a\x09self assert: (o basicAt: 'a') equals: 1.\x0a\x09self assert: (o basicAt: 'b') equals: nil",
  57512. referencedClasses: ["Object"],
  57513. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  57514. }),
  57515. $globals.ObjectTest);
  57516. $core.addMethod(
  57517. $core.method({
  57518. selector: "testBasicPerform",
  57519. protocol: "tests",
  57520. fn: function (){
  57521. var self=this,$self=this;
  57522. var o;
  57523. return $core.withContext(function($ctx1) {
  57524. o=$recv($globals.Object)._new();
  57525. $recv(o)._basicAt_put_("func",(function(){
  57526. return "hello";
  57527. }));
  57528. $ctx1.sendIdx["basicAt:put:"]=1;
  57529. $recv(o)._basicAt_put_("func2",(function(a){
  57530. return $core.withContext(function($ctx2) {
  57531. return $recv(a).__plus((1));
  57532. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  57533. }));
  57534. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  57535. $ctx1.sendIdx["assert:equals:"]=1;
  57536. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  57537. return self;
  57538. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  57539. },
  57540. args: [],
  57541. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: [ 'hello' ].\x0a\x09o basicAt: 'func2' put: [ :a | a + 1 ].\x0a\x0a\x09self assert: (o basicPerform: 'func') equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4",
  57542. referencedClasses: ["Object"],
  57543. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  57544. }),
  57545. $globals.ObjectTest);
  57546. $core.addMethod(
  57547. $core.method({
  57548. selector: "testDNU",
  57549. protocol: "tests",
  57550. fn: function (){
  57551. var self=this,$self=this;
  57552. return $core.withContext(function($ctx1) {
  57553. $self._should_raise_((function(){
  57554. return $core.withContext(function($ctx2) {
  57555. return $recv($recv($globals.Object)._new())._foo();
  57556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57557. }),$globals.MessageNotUnderstood);
  57558. return self;
  57559. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  57560. },
  57561. args: [],
  57562. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  57563. referencedClasses: ["Object", "MessageNotUnderstood"],
  57564. messageSends: ["should:raise:", "foo", "new"]
  57565. }),
  57566. $globals.ObjectTest);
  57567. $core.addMethod(
  57568. $core.method({
  57569. selector: "testEquality",
  57570. protocol: "tests",
  57571. fn: function (){
  57572. var self=this,$self=this;
  57573. var o;
  57574. return $core.withContext(function($ctx1) {
  57575. var $1,$2,$4,$3;
  57576. o=$recv($globals.Object)._new();
  57577. $ctx1.sendIdx["new"]=1;
  57578. $1=$recv(o).__eq($recv($globals.Object)._new());
  57579. $ctx1.sendIdx["="]=1;
  57580. $self._deny_($1);
  57581. $2=$recv(o).__eq(o);
  57582. $ctx1.sendIdx["="]=2;
  57583. $self._assert_($2);
  57584. $ctx1.sendIdx["assert:"]=1;
  57585. $4=$recv(o)._yourself();
  57586. $ctx1.sendIdx["yourself"]=1;
  57587. $3=$recv($4).__eq(o);
  57588. $ctx1.sendIdx["="]=3;
  57589. $self._assert_($3);
  57590. $ctx1.sendIdx["assert:"]=2;
  57591. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  57592. return self;
  57593. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  57594. },
  57595. args: [],
  57596. source: "testEquality\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o = Object new.\x0a\x09self assert: (o = o).\x0a\x09self assert: (o yourself = o).\x0a\x09self assert: (o = o yourself)",
  57597. referencedClasses: ["Object"],
  57598. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  57599. }),
  57600. $globals.ObjectTest);
  57601. $core.addMethod(
  57602. $core.method({
  57603. selector: "testHalt",
  57604. protocol: "tests",
  57605. fn: function (){
  57606. var self=this,$self=this;
  57607. return $core.withContext(function($ctx1) {
  57608. $self._should_raise_((function(){
  57609. return $core.withContext(function($ctx2) {
  57610. return $recv($recv($globals.Object)._new())._halt();
  57611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57612. }),$globals.Error);
  57613. return self;
  57614. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  57615. },
  57616. args: [],
  57617. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  57618. referencedClasses: ["Object", "Error"],
  57619. messageSends: ["should:raise:", "halt", "new"]
  57620. }),
  57621. $globals.ObjectTest);
  57622. $core.addMethod(
  57623. $core.method({
  57624. selector: "testIdentity",
  57625. protocol: "tests",
  57626. fn: function (){
  57627. var self=this,$self=this;
  57628. var o;
  57629. return $core.withContext(function($ctx1) {
  57630. var $1,$2,$4,$3;
  57631. o=$recv($globals.Object)._new();
  57632. $ctx1.sendIdx["new"]=1;
  57633. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  57634. $ctx1.sendIdx["=="]=1;
  57635. $self._deny_($1);
  57636. $2=$recv(o).__eq_eq(o);
  57637. $ctx1.sendIdx["=="]=2;
  57638. $self._assert_($2);
  57639. $ctx1.sendIdx["assert:"]=1;
  57640. $4=$recv(o)._yourself();
  57641. $ctx1.sendIdx["yourself"]=1;
  57642. $3=$recv($4).__eq_eq(o);
  57643. $ctx1.sendIdx["=="]=3;
  57644. $self._assert_($3);
  57645. $ctx1.sendIdx["assert:"]=2;
  57646. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  57647. return self;
  57648. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  57649. },
  57650. args: [],
  57651. source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself",
  57652. referencedClasses: ["Object"],
  57653. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  57654. }),
  57655. $globals.ObjectTest);
  57656. $core.addMethod(
  57657. $core.method({
  57658. selector: "testIfNil",
  57659. protocol: "tests",
  57660. fn: function (){
  57661. var self=this,$self=this;
  57662. return $core.withContext(function($ctx1) {
  57663. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  57664. $2=$recv($globals.Object)._new();
  57665. $ctx1.sendIdx["new"]=1;
  57666. $1=$recv($2)._isNil();
  57667. $self._deny_($1);
  57668. $ctx1.sendIdx["deny:"]=1;
  57669. $5=$recv($globals.Object)._new();
  57670. $ctx1.sendIdx["new"]=2;
  57671. if(($receiver = $5) == null || $receiver.a$nil){
  57672. $4=true;
  57673. } else {
  57674. $4=$5;
  57675. }
  57676. $3=$recv($4).__eq(true);
  57677. $self._deny_($3);
  57678. $7=$recv($globals.Object)._new();
  57679. $ctx1.sendIdx["new"]=3;
  57680. if(($receiver = $7) == null || $receiver.a$nil){
  57681. $6=$7;
  57682. } else {
  57683. $6=true;
  57684. }
  57685. $self._assert_equals_($6,true);
  57686. $ctx1.sendIdx["assert:equals:"]=1;
  57687. $9=$recv($globals.Object)._new();
  57688. $ctx1.sendIdx["new"]=4;
  57689. if(($receiver = $9) == null || $receiver.a$nil){
  57690. $8=false;
  57691. } else {
  57692. $8=true;
  57693. }
  57694. $self._assert_equals_($8,true);
  57695. $ctx1.sendIdx["assert:equals:"]=2;
  57696. $11=$recv($globals.Object)._new();
  57697. if(($receiver = $11) == null || $receiver.a$nil){
  57698. $10=false;
  57699. } else {
  57700. $10=true;
  57701. }
  57702. $self._assert_equals_($10,true);
  57703. return self;
  57704. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  57705. },
  57706. args: [],
  57707. source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [ true ]) = true.\x0a\x09self assert: (Object new ifNotNil: [ true ]) equals: true.\x0a\x0a\x09self assert: (Object new ifNil: [ false ] ifNotNil: [ true ]) equals: true.\x0a\x09self assert: (Object new ifNotNil: [ true ] ifNil: [ false ]) equals: true",
  57708. referencedClasses: ["Object"],
  57709. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  57710. }),
  57711. $globals.ObjectTest);
  57712. $core.addMethod(
  57713. $core.method({
  57714. selector: "testInstVars",
  57715. protocol: "tests",
  57716. fn: function (){
  57717. var self=this,$self=this;
  57718. var o;
  57719. return $core.withContext(function($ctx1) {
  57720. var $1,$2;
  57721. o=$recv($globals.ObjectMock)._new();
  57722. $1=$recv(o)._instVarAt_("foo");
  57723. $ctx1.sendIdx["instVarAt:"]=1;
  57724. $self._assert_equals_($1,nil);
  57725. $ctx1.sendIdx["assert:equals:"]=1;
  57726. $recv(o)._instVarAt_put_("foo",(1));
  57727. $2=$recv(o)._instVarAt_("foo");
  57728. $ctx1.sendIdx["instVarAt:"]=2;
  57729. $self._assert_equals_($2,(1));
  57730. $ctx1.sendIdx["assert:equals:"]=2;
  57731. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  57732. return self;
  57733. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  57734. },
  57735. args: [],
  57736. source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1",
  57737. referencedClasses: ["ObjectMock"],
  57738. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  57739. }),
  57740. $globals.ObjectTest);
  57741. $core.addMethod(
  57742. $core.method({
  57743. selector: "testNilUndefined",
  57744. protocol: "tests",
  57745. fn: function (){
  57746. var self=this,$self=this;
  57747. return $core.withContext(function($ctx1) {
  57748. $self._assert_equals_($self._notDefined(),nil);
  57749. return self;
  57750. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  57751. },
  57752. args: [],
  57753. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  57754. referencedClasses: [],
  57755. messageSends: ["assert:equals:", "notDefined"]
  57756. }),
  57757. $globals.ObjectTest);
  57758. $core.addMethod(
  57759. $core.method({
  57760. selector: "testYourself",
  57761. protocol: "tests",
  57762. fn: function (){
  57763. var self=this,$self=this;
  57764. var o;
  57765. return $core.withContext(function($ctx1) {
  57766. o=$recv($globals.ObjectMock)._new();
  57767. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  57768. return self;
  57769. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  57770. },
  57771. args: [],
  57772. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  57773. referencedClasses: ["ObjectMock"],
  57774. messageSends: ["new", "assert:", "==", "yourself"]
  57775. }),
  57776. $globals.ObjectTest);
  57777. $core.addMethod(
  57778. $core.method({
  57779. selector: "testidentityHash",
  57780. protocol: "tests",
  57781. fn: function (){
  57782. var self=this,$self=this;
  57783. var o1,o2;
  57784. return $core.withContext(function($ctx1) {
  57785. var $2,$3,$1,$5,$4;
  57786. o1=$recv($globals.Object)._new();
  57787. $ctx1.sendIdx["new"]=1;
  57788. o2=$recv($globals.Object)._new();
  57789. $2=$recv(o1)._identityHash();
  57790. $ctx1.sendIdx["identityHash"]=1;
  57791. $3=$recv(o1)._identityHash();
  57792. $ctx1.sendIdx["identityHash"]=2;
  57793. $1=$recv($2).__eq_eq($3);
  57794. $ctx1.sendIdx["=="]=1;
  57795. $self._assert_($1);
  57796. $5=$recv(o1)._identityHash();
  57797. $ctx1.sendIdx["identityHash"]=3;
  57798. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  57799. $self._deny_($4);
  57800. return self;
  57801. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  57802. },
  57803. args: [],
  57804. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  57805. referencedClasses: ["Object"],
  57806. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  57807. }),
  57808. $globals.ObjectTest);
  57809. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  57810. $core.addMethod(
  57811. $core.method({
  57812. selector: "testAccessing",
  57813. protocol: "tests",
  57814. fn: function (){
  57815. var self=this,$self=this;
  57816. return $core.withContext(function($ctx1) {
  57817. var $2,$1,$3,$6,$5,$4;
  57818. $2=$recv($globals.Point)._x_y_((3),(4));
  57819. $ctx1.sendIdx["x:y:"]=1;
  57820. $1=$recv($2)._x();
  57821. $ctx1.sendIdx["x"]=1;
  57822. $self._assert_equals_($1,(3));
  57823. $ctx1.sendIdx["assert:equals:"]=1;
  57824. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  57825. $ctx1.sendIdx["y"]=1;
  57826. $self._assert_equals_($3,(4));
  57827. $ctx1.sendIdx["assert:equals:"]=2;
  57828. $6=$recv($globals.Point)._new();
  57829. $ctx1.sendIdx["new"]=1;
  57830. $5=$recv($6)._x_((3));
  57831. $4=$recv($5)._x();
  57832. $self._assert_equals_($4,(3));
  57833. $ctx1.sendIdx["assert:equals:"]=3;
  57834. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  57835. return self;
  57836. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  57837. },
  57838. args: [],
  57839. source: "testAccessing\x0a\x09self assert: (Point x: 3 y: 4) x equals: 3.\x0a\x09self assert: (Point x: 3 y: 4) y equals: 4.\x0a\x09self assert: (Point new x: 3) x equals: 3.\x0a\x09self assert: (Point new y: 4) y equals: 4",
  57840. referencedClasses: ["Point"],
  57841. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  57842. }),
  57843. $globals.PointTest);
  57844. $core.addMethod(
  57845. $core.method({
  57846. selector: "testArithmetic",
  57847. protocol: "tests",
  57848. fn: function (){
  57849. var self=this,$self=this;
  57850. return $core.withContext(function($ctx1) {
  57851. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  57852. $2=(3).__at((4));
  57853. $ctx1.sendIdx["@"]=1;
  57854. $3=(3).__at((4));
  57855. $ctx1.sendIdx["@"]=2;
  57856. $1=$recv($2).__star($3);
  57857. $4=$recv($globals.Point)._x_y_((9),(16));
  57858. $ctx1.sendIdx["x:y:"]=1;
  57859. $self._assert_equals_($1,$4);
  57860. $ctx1.sendIdx["assert:equals:"]=1;
  57861. $6=(3).__at((4));
  57862. $ctx1.sendIdx["@"]=3;
  57863. $7=(3).__at((4));
  57864. $ctx1.sendIdx["@"]=4;
  57865. $5=$recv($6).__plus($7);
  57866. $8=$recv($globals.Point)._x_y_((6),(8));
  57867. $ctx1.sendIdx["x:y:"]=2;
  57868. $self._assert_equals_($5,$8);
  57869. $ctx1.sendIdx["assert:equals:"]=2;
  57870. $10=(3).__at((4));
  57871. $ctx1.sendIdx["@"]=5;
  57872. $11=(3).__at((4));
  57873. $ctx1.sendIdx["@"]=6;
  57874. $9=$recv($10).__minus($11);
  57875. $12=$recv($globals.Point)._x_y_((0),(0));
  57876. $ctx1.sendIdx["x:y:"]=3;
  57877. $self._assert_equals_($9,$12);
  57878. $ctx1.sendIdx["assert:equals:"]=3;
  57879. $14=(6).__at((8));
  57880. $ctx1.sendIdx["@"]=7;
  57881. $13=$recv($14).__slash((3).__at((4)));
  57882. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  57883. return self;
  57884. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  57885. },
  57886. args: [],
  57887. source: "testArithmetic\x0a\x09self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).\x0a\x09self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).\x0a\x09self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).\x0a\x09self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)",
  57888. referencedClasses: ["Point"],
  57889. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  57890. }),
  57891. $globals.PointTest);
  57892. $core.addMethod(
  57893. $core.method({
  57894. selector: "testAt",
  57895. protocol: "tests",
  57896. fn: function (){
  57897. var self=this,$self=this;
  57898. return $core.withContext(function($ctx1) {
  57899. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  57900. return self;
  57901. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  57902. },
  57903. args: [],
  57904. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  57905. referencedClasses: ["Point"],
  57906. messageSends: ["assert:equals:", "@", "x:y:"]
  57907. }),
  57908. $globals.PointTest);
  57909. $core.addMethod(
  57910. $core.method({
  57911. selector: "testComparison",
  57912. protocol: "tests",
  57913. fn: function (){
  57914. var self=this,$self=this;
  57915. return $core.withContext(function($ctx1) {
  57916. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  57917. $2=(3).__at((4));
  57918. $ctx1.sendIdx["@"]=1;
  57919. $3=(4).__at((5));
  57920. $ctx1.sendIdx["@"]=2;
  57921. $1=$recv($2).__lt($3);
  57922. $ctx1.sendIdx["<"]=1;
  57923. $self._assert_($1);
  57924. $ctx1.sendIdx["assert:"]=1;
  57925. $5=(3).__at((4));
  57926. $ctx1.sendIdx["@"]=3;
  57927. $6=(4).__at((4));
  57928. $ctx1.sendIdx["@"]=4;
  57929. $4=$recv($5).__lt($6);
  57930. $self._deny_($4);
  57931. $ctx1.sendIdx["deny:"]=1;
  57932. $8=(4).__at((5));
  57933. $ctx1.sendIdx["@"]=5;
  57934. $9=(4).__at((5));
  57935. $ctx1.sendIdx["@"]=6;
  57936. $7=$recv($8).__lt_eq($9);
  57937. $ctx1.sendIdx["<="]=1;
  57938. $self._assert_($7);
  57939. $ctx1.sendIdx["assert:"]=2;
  57940. $11=(4).__at((5));
  57941. $ctx1.sendIdx["@"]=7;
  57942. $12=(3).__at((5));
  57943. $ctx1.sendIdx["@"]=8;
  57944. $10=$recv($11).__lt_eq($12);
  57945. $self._deny_($10);
  57946. $ctx1.sendIdx["deny:"]=2;
  57947. $14=(5).__at((6));
  57948. $ctx1.sendIdx["@"]=9;
  57949. $15=(4).__at((5));
  57950. $ctx1.sendIdx["@"]=10;
  57951. $13=$recv($14).__gt($15);
  57952. $ctx1.sendIdx[">"]=1;
  57953. $self._assert_($13);
  57954. $ctx1.sendIdx["assert:"]=3;
  57955. $17=(5).__at((6));
  57956. $ctx1.sendIdx["@"]=11;
  57957. $18=(6).__at((6));
  57958. $ctx1.sendIdx["@"]=12;
  57959. $16=$recv($17).__gt($18);
  57960. $self._deny_($16);
  57961. $ctx1.sendIdx["deny:"]=3;
  57962. $20=(4).__at((5));
  57963. $ctx1.sendIdx["@"]=13;
  57964. $21=(4).__at((5));
  57965. $ctx1.sendIdx["@"]=14;
  57966. $19=$recv($20).__gt_eq($21);
  57967. $ctx1.sendIdx[">="]=1;
  57968. $self._assert_($19);
  57969. $23=(4).__at((5));
  57970. $ctx1.sendIdx["@"]=15;
  57971. $22=$recv($23).__gt_eq((5).__at((5)));
  57972. $self._deny_($22);
  57973. return self;
  57974. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  57975. },
  57976. args: [],
  57977. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  57978. referencedClasses: [],
  57979. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  57980. }),
  57981. $globals.PointTest);
  57982. $core.addMethod(
  57983. $core.method({
  57984. selector: "testEgality",
  57985. protocol: "tests",
  57986. fn: function (){
  57987. var self=this,$self=this;
  57988. return $core.withContext(function($ctx1) {
  57989. var $2,$3,$1,$5,$4;
  57990. $2=(3).__at((4));
  57991. $ctx1.sendIdx["@"]=1;
  57992. $3=(3).__at((4));
  57993. $ctx1.sendIdx["@"]=2;
  57994. $1=$recv($2).__eq($3);
  57995. $ctx1.sendIdx["="]=1;
  57996. $self._assert_($1);
  57997. $5=(3).__at((5));
  57998. $ctx1.sendIdx["@"]=3;
  57999. $4=$recv($5).__eq((3).__at((6)));
  58000. $self._deny_($4);
  58001. return self;
  58002. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  58003. },
  58004. args: [],
  58005. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  58006. referencedClasses: [],
  58007. messageSends: ["assert:", "=", "@", "deny:"]
  58008. }),
  58009. $globals.PointTest);
  58010. $core.addMethod(
  58011. $core.method({
  58012. selector: "testNew",
  58013. protocol: "tests",
  58014. fn: function (){
  58015. var self=this,$self=this;
  58016. return $core.withContext(function($ctx1) {
  58017. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  58018. $3=$recv($globals.Point)._new();
  58019. $ctx1.sendIdx["new"]=1;
  58020. $2=$recv($3)._x_((3));
  58021. $ctx1.sendIdx["x:"]=1;
  58022. $1=$recv($2)._y();
  58023. $ctx1.sendIdx["y"]=1;
  58024. $self._assert_equals_($1,nil);
  58025. $ctx1.sendIdx["assert:equals:"]=1;
  58026. $7=$recv($globals.Point)._new();
  58027. $ctx1.sendIdx["new"]=2;
  58028. $6=$recv($7)._x_((3));
  58029. $5=$recv($6)._x();
  58030. $ctx1.sendIdx["x"]=1;
  58031. $4=$recv($5).__eq((0));
  58032. $ctx1.sendIdx["="]=1;
  58033. $self._deny_($4);
  58034. $ctx1.sendIdx["deny:"]=1;
  58035. $10=$recv($globals.Point)._new();
  58036. $ctx1.sendIdx["new"]=3;
  58037. $9=$recv($10)._y_((4));
  58038. $ctx1.sendIdx["y:"]=1;
  58039. $8=$recv($9)._x();
  58040. $self._assert_equals_($8,nil);
  58041. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  58042. return self;
  58043. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  58044. },
  58045. args: [],
  58046. source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0",
  58047. referencedClasses: ["Point"],
  58048. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  58049. }),
  58050. $globals.PointTest);
  58051. $core.addMethod(
  58052. $core.method({
  58053. selector: "testTranslateBy",
  58054. protocol: "tests",
  58055. fn: function (){
  58056. var self=this,$self=this;
  58057. return $core.withContext(function($ctx1) {
  58058. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  58059. $2=(3).__at((3));
  58060. $ctx1.sendIdx["@"]=1;
  58061. $3=(0).__at((1));
  58062. $ctx1.sendIdx["@"]=2;
  58063. $1=$recv($2)._translateBy_($3);
  58064. $ctx1.sendIdx["translateBy:"]=1;
  58065. $4=(3).__at((4));
  58066. $ctx1.sendIdx["@"]=3;
  58067. $self._assert_equals_($1,$4);
  58068. $ctx1.sendIdx["assert:equals:"]=1;
  58069. $6=(3).__at((3));
  58070. $ctx1.sendIdx["@"]=4;
  58071. $8=(1)._negated();
  58072. $ctx1.sendIdx["negated"]=1;
  58073. $7=(0).__at($8);
  58074. $ctx1.sendIdx["@"]=5;
  58075. $5=$recv($6)._translateBy_($7);
  58076. $ctx1.sendIdx["translateBy:"]=2;
  58077. $9=(3).__at((2));
  58078. $ctx1.sendIdx["@"]=6;
  58079. $self._assert_equals_($5,$9);
  58080. $ctx1.sendIdx["assert:equals:"]=2;
  58081. $11=(3).__at((3));
  58082. $ctx1.sendIdx["@"]=7;
  58083. $12=(2).__at((3));
  58084. $ctx1.sendIdx["@"]=8;
  58085. $10=$recv($11)._translateBy_($12);
  58086. $ctx1.sendIdx["translateBy:"]=3;
  58087. $13=(5).__at((6));
  58088. $ctx1.sendIdx["@"]=9;
  58089. $self._assert_equals_($10,$13);
  58090. $ctx1.sendIdx["assert:equals:"]=3;
  58091. $15=(3).__at((3));
  58092. $ctx1.sendIdx["@"]=10;
  58093. $16=$recv((3)._negated()).__at((0));
  58094. $ctx1.sendIdx["@"]=11;
  58095. $14=$recv($15)._translateBy_($16);
  58096. $self._assert_equals_($14,(0).__at((3)));
  58097. return self;
  58098. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  58099. },
  58100. args: [],
  58101. source: "testTranslateBy\x0a\x09self assert: (3@3 translateBy: 0@1) equals: 3@4.\x0a\x09self assert: (3@3 translateBy: 0@1 negated) equals: 3@2.\x0a\x09self assert: (3@3 translateBy: 2@3) equals: 5@6.\x0a\x09self assert: (3@3 translateBy: 3 negated @0) equals: 0@3.",
  58102. referencedClasses: [],
  58103. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  58104. }),
  58105. $globals.PointTest);
  58106. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  58107. $core.addMethod(
  58108. $core.method({
  58109. selector: "testNextIfAbsent",
  58110. protocol: "tests",
  58111. fn: function (){
  58112. var self=this,$self=this;
  58113. var queue;
  58114. return $core.withContext(function($ctx1) {
  58115. var $2,$1;
  58116. queue=$recv($globals.Queue)._new();
  58117. $recv(queue)._nextPut_("index1");
  58118. $2=$recv(queue)._nextIfAbsent_("empty");
  58119. $ctx1.sendIdx["nextIfAbsent:"]=1;
  58120. $1=$recv($2).__eq("index1");
  58121. $ctx1.sendIdx["="]=1;
  58122. $self._assert_($1);
  58123. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  58124. return self;
  58125. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  58126. },
  58127. args: [],
  58128. source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'",
  58129. referencedClasses: ["Queue"],
  58130. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  58131. }),
  58132. $globals.QueueTest);
  58133. $core.addMethod(
  58134. $core.method({
  58135. selector: "testQueueNext",
  58136. protocol: "tests",
  58137. fn: function (){
  58138. var self=this,$self=this;
  58139. var queue;
  58140. return $core.withContext(function($ctx1) {
  58141. var $1,$3,$2,$5,$4;
  58142. queue=$recv($globals.Queue)._new();
  58143. $1=queue;
  58144. $recv($1)._nextPut_("index1");
  58145. $ctx1.sendIdx["nextPut:"]=1;
  58146. $recv($1)._nextPut_("index2");
  58147. $3=$recv(queue)._next();
  58148. $ctx1.sendIdx["next"]=1;
  58149. $2=$recv($3).__eq("index1");
  58150. $ctx1.sendIdx["="]=1;
  58151. $self._assert_($2);
  58152. $5=$recv(queue)._next();
  58153. $ctx1.sendIdx["next"]=2;
  58154. $4=$recv($5).__eq("index");
  58155. $self._deny_($4);
  58156. $self._should_raise_((function(){
  58157. return $core.withContext(function($ctx2) {
  58158. return $recv(queue)._next();
  58159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58160. }),$globals.Error);
  58161. return self;
  58162. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  58163. },
  58164. args: [],
  58165. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  58166. referencedClasses: ["Queue", "Error"],
  58167. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  58168. }),
  58169. $globals.QueueTest);
  58170. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  58171. $core.addMethod(
  58172. $core.method({
  58173. selector: "testAtRandomNumber",
  58174. protocol: "tests",
  58175. fn: function (){
  58176. var self=this,$self=this;
  58177. var val;
  58178. return $core.withContext(function($ctx1) {
  58179. (100)._timesRepeat_((function(){
  58180. return $core.withContext(function($ctx2) {
  58181. val=(10)._atRandom();
  58182. val;
  58183. $self._assert_($recv(val).__gt((0)));
  58184. $ctx2.sendIdx["assert:"]=1;
  58185. return $self._assert_($recv(val).__lt((11)));
  58186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58187. }));
  58188. return self;
  58189. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  58190. },
  58191. args: [],
  58192. source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
  58193. referencedClasses: [],
  58194. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  58195. }),
  58196. $globals.RandomTest);
  58197. $core.addMethod(
  58198. $core.method({
  58199. selector: "testAtRandomSequenceableCollection",
  58200. protocol: "tests",
  58201. fn: function (){
  58202. var self=this,$self=this;
  58203. var val;
  58204. return $core.withContext(function($ctx1) {
  58205. var $3,$4,$2,$1;
  58206. (100)._timesRepeat_((function(){
  58207. return $core.withContext(function($ctx2) {
  58208. val="abc"._atRandom();
  58209. val;
  58210. $3=$recv(val).__eq("a");
  58211. $ctx2.sendIdx["="]=1;
  58212. $4=$recv(val).__eq("b");
  58213. $ctx2.sendIdx["="]=2;
  58214. $2=$recv($3).__or($4);
  58215. $1=$recv($2).__or($recv(val).__eq("c"));
  58216. $ctx2.sendIdx["|"]=1;
  58217. return $self._assert_($1);
  58218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58219. }));
  58220. return self;
  58221. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  58222. },
  58223. args: [],
  58224. source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
  58225. referencedClasses: [],
  58226. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  58227. }),
  58228. $globals.RandomTest);
  58229. $core.addMethod(
  58230. $core.method({
  58231. selector: "textNext",
  58232. protocol: "tests",
  58233. fn: function (){
  58234. var self=this,$self=this;
  58235. return $core.withContext(function($ctx1) {
  58236. var $1;
  58237. (10000)._timesRepeat_((function(){
  58238. var current,next;
  58239. return $core.withContext(function($ctx2) {
  58240. next=$recv($recv($globals.Random)._new())._next();
  58241. next;
  58242. $self._assert_($recv(next).__gt_eq((0)));
  58243. $ctx2.sendIdx["assert:"]=1;
  58244. $self._assert_($recv(next).__lt((1)));
  58245. $1=$recv(current).__eq(next);
  58246. $ctx2.sendIdx["="]=1;
  58247. $self._deny_($1);
  58248. return $recv(next).__eq(current);
  58249. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  58250. }));
  58251. return self;
  58252. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  58253. },
  58254. args: [],
  58255. source: "textNext\x0a\x0a\x0910000 timesRepeat: [\x0a\x09\x09\x09| current next |\x0a\x09\x09\x09next := Random new next.\x0a\x09\x09\x09self assert: (next >= 0).\x0a\x09\x09\x09self assert: (next < 1).\x0a\x09\x09\x09self deny: current = next.\x0a\x09\x09\x09next = current ]",
  58256. referencedClasses: ["Random"],
  58257. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  58258. }),
  58259. $globals.RandomTest);
  58260. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  58261. $core.addMethod(
  58262. $core.method({
  58263. selector: "collectionClass",
  58264. protocol: "accessing",
  58265. fn: function (){
  58266. var self=this,$self=this;
  58267. return $core.withContext(function($ctx1) {
  58268. return $recv($self._class())._collectionClass();
  58269. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  58270. },
  58271. args: [],
  58272. source: "collectionClass\x0a\x09^ self class collectionClass",
  58273. referencedClasses: [],
  58274. messageSends: ["collectionClass", "class"]
  58275. }),
  58276. $globals.StreamTest);
  58277. $core.addMethod(
  58278. $core.method({
  58279. selector: "newCollection",
  58280. protocol: "accessing",
  58281. fn: function (){
  58282. var self=this,$self=this;
  58283. return $core.withContext(function($ctx1) {
  58284. return $recv($self._collectionClass())._new();
  58285. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  58286. },
  58287. args: [],
  58288. source: "newCollection\x0a\x09^ self collectionClass new",
  58289. referencedClasses: [],
  58290. messageSends: ["new", "collectionClass"]
  58291. }),
  58292. $globals.StreamTest);
  58293. $core.addMethod(
  58294. $core.method({
  58295. selector: "newStream",
  58296. protocol: "accessing",
  58297. fn: function (){
  58298. var self=this,$self=this;
  58299. return $core.withContext(function($ctx1) {
  58300. return $recv($recv($self._collectionClass())._new())._stream();
  58301. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  58302. },
  58303. args: [],
  58304. source: "newStream\x0a\x09^ self collectionClass new stream",
  58305. referencedClasses: [],
  58306. messageSends: ["stream", "new", "collectionClass"]
  58307. }),
  58308. $globals.StreamTest);
  58309. $core.addMethod(
  58310. $core.method({
  58311. selector: "testAtStartAtEnd",
  58312. protocol: "tests",
  58313. fn: function (){
  58314. var self=this,$self=this;
  58315. var stream;
  58316. return $core.withContext(function($ctx1) {
  58317. var $1,$2,$3,$4;
  58318. stream=$self._newStream();
  58319. $1=$recv(stream)._atStart();
  58320. $ctx1.sendIdx["atStart"]=1;
  58321. $self._assert_($1);
  58322. $ctx1.sendIdx["assert:"]=1;
  58323. $2=$recv(stream)._atEnd();
  58324. $ctx1.sendIdx["atEnd"]=1;
  58325. $self._assert_($2);
  58326. $ctx1.sendIdx["assert:"]=2;
  58327. $recv(stream)._nextPutAll_($self._newCollection());
  58328. $3=$recv(stream)._atEnd();
  58329. $ctx1.sendIdx["atEnd"]=2;
  58330. $self._assert_($3);
  58331. $4=$recv(stream)._atStart();
  58332. $ctx1.sendIdx["atStart"]=2;
  58333. $self._deny_($4);
  58334. $ctx1.sendIdx["deny:"]=1;
  58335. $recv(stream)._position_((1));
  58336. $self._deny_($recv(stream)._atEnd());
  58337. $ctx1.sendIdx["deny:"]=2;
  58338. $self._deny_($recv(stream)._atStart());
  58339. return self;
  58340. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  58341. },
  58342. args: [],
  58343. source: "testAtStartAtEnd\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream atStart.\x0a\x09self assert: stream atEnd.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self assert: stream atEnd.\x0a\x09self deny: stream atStart.\x0a\x09\x0a\x09stream position: 1.\x0a\x09self deny: stream atEnd.\x0a\x09self deny: stream atStart",
  58344. referencedClasses: [],
  58345. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  58346. }),
  58347. $globals.StreamTest);
  58348. $core.addMethod(
  58349. $core.method({
  58350. selector: "testContents",
  58351. protocol: "tests",
  58352. fn: function (){
  58353. var self=this,$self=this;
  58354. var stream;
  58355. return $core.withContext(function($ctx1) {
  58356. var $1,$2;
  58357. stream=$self._newStream();
  58358. $1=stream;
  58359. $2=$self._newCollection();
  58360. $ctx1.sendIdx["newCollection"]=1;
  58361. $recv($1)._nextPutAll_($2);
  58362. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  58363. return self;
  58364. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  58365. },
  58366. args: [],
  58367. source: "testContents\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: self newCollection.\x0a\x09\x0a\x09self assert: stream contents equals: self newCollection",
  58368. referencedClasses: [],
  58369. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  58370. }),
  58371. $globals.StreamTest);
  58372. $core.addMethod(
  58373. $core.method({
  58374. selector: "testIsEmpty",
  58375. protocol: "tests",
  58376. fn: function (){
  58377. var self=this,$self=this;
  58378. var stream;
  58379. return $core.withContext(function($ctx1) {
  58380. var $1;
  58381. stream=$self._newStream();
  58382. $1=$recv(stream)._isEmpty();
  58383. $ctx1.sendIdx["isEmpty"]=1;
  58384. $self._assert_($1);
  58385. $recv(stream)._nextPutAll_($self._newCollection());
  58386. $self._deny_($recv(stream)._isEmpty());
  58387. return self;
  58388. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  58389. },
  58390. args: [],
  58391. source: "testIsEmpty\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream isEmpty.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self deny: stream isEmpty",
  58392. referencedClasses: [],
  58393. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  58394. }),
  58395. $globals.StreamTest);
  58396. $core.addMethod(
  58397. $core.method({
  58398. selector: "testPosition",
  58399. protocol: "tests",
  58400. fn: function (){
  58401. var self=this,$self=this;
  58402. var collection,stream;
  58403. return $core.withContext(function($ctx1) {
  58404. var $1,$2,$3;
  58405. collection=$self._newCollection();
  58406. stream=$self._newStream();
  58407. $recv(stream)._nextPutAll_(collection);
  58408. $1=$recv(stream)._position();
  58409. $ctx1.sendIdx["position"]=1;
  58410. $self._assert_equals_($1,$recv(collection)._size());
  58411. $ctx1.sendIdx["assert:equals:"]=1;
  58412. $recv(stream)._position_((0));
  58413. $2=$recv(stream)._position();
  58414. $ctx1.sendIdx["position"]=2;
  58415. $self._assert_equals_($2,(0));
  58416. $ctx1.sendIdx["assert:equals:"]=2;
  58417. $recv(stream)._next();
  58418. $ctx1.sendIdx["next"]=1;
  58419. $3=$recv(stream)._position();
  58420. $ctx1.sendIdx["position"]=3;
  58421. $self._assert_equals_($3,(1));
  58422. $ctx1.sendIdx["assert:equals:"]=3;
  58423. $recv(stream)._next();
  58424. $self._assert_equals_($recv(stream)._position(),(2));
  58425. return self;
  58426. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  58427. },
  58428. args: [],
  58429. source: "testPosition\x0a\x09| collection stream |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream position equals: collection size.\x0a\x09\x0a\x09stream position: 0.\x0a\x09self assert: stream position equals: 0.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 1.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 2",
  58430. referencedClasses: [],
  58431. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  58432. }),
  58433. $globals.StreamTest);
  58434. $core.addMethod(
  58435. $core.method({
  58436. selector: "testReading",
  58437. protocol: "tests",
  58438. fn: function (){
  58439. var self=this,$self=this;
  58440. var stream,collection;
  58441. return $core.withContext(function($ctx1) {
  58442. var $1,$2;
  58443. collection=$self._newCollection();
  58444. stream=$self._newStream();
  58445. $1=stream;
  58446. $recv($1)._nextPutAll_(collection);
  58447. $recv($1)._position_((0));
  58448. $recv(collection)._do_((function(each){
  58449. return $core.withContext(function($ctx2) {
  58450. $2=$recv(stream)._next();
  58451. $ctx2.sendIdx["next"]=1;
  58452. return $self._assert_equals_($2,each);
  58453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58454. }));
  58455. $self._assert_($recv($recv(stream)._next())._isNil());
  58456. return self;
  58457. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  58458. },
  58459. args: [],
  58460. source: "testReading\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream \x0a\x09\x09nextPutAll: collection;\x0a\x09\x09position: 0.\x0a\x09\x0a\x09collection do: [ :each |\x0a\x09\x09self assert: stream next equals: each ].\x0a\x09\x09\x0a\x09self assert: stream next isNil",
  58461. referencedClasses: [],
  58462. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  58463. }),
  58464. $globals.StreamTest);
  58465. $core.addMethod(
  58466. $core.method({
  58467. selector: "testStreamContents",
  58468. protocol: "tests",
  58469. fn: function (){
  58470. var self=this,$self=this;
  58471. return self;
  58472. },
  58473. args: [],
  58474. source: "testStreamContents",
  58475. referencedClasses: [],
  58476. messageSends: []
  58477. }),
  58478. $globals.StreamTest);
  58479. $core.addMethod(
  58480. $core.method({
  58481. selector: "testWrite",
  58482. protocol: "tests",
  58483. fn: function (){
  58484. var self=this,$self=this;
  58485. var stream,collection;
  58486. return $core.withContext(function($ctx1) {
  58487. collection=$self._newCollection();
  58488. stream=$self._newStream();
  58489. $recv(collection)._do_((function(each){
  58490. return $core.withContext(function($ctx2) {
  58491. return $recv(stream).__lt_lt(each);
  58492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58493. }));
  58494. $self._assert_equals_($recv(stream)._contents(),collection);
  58495. return self;
  58496. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  58497. },
  58498. args: [],
  58499. source: "testWrite\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream << each ].\x0a\x09self assert: stream contents equals: collection",
  58500. referencedClasses: [],
  58501. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  58502. }),
  58503. $globals.StreamTest);
  58504. $core.addMethod(
  58505. $core.method({
  58506. selector: "testWriting",
  58507. protocol: "tests",
  58508. fn: function (){
  58509. var self=this,$self=this;
  58510. var stream,collection;
  58511. return $core.withContext(function($ctx1) {
  58512. var $1;
  58513. collection=$self._newCollection();
  58514. stream=$self._newStream();
  58515. $ctx1.sendIdx["newStream"]=1;
  58516. $recv(collection)._do_((function(each){
  58517. return $core.withContext(function($ctx2) {
  58518. return $recv(stream)._nextPut_(each);
  58519. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58520. }));
  58521. $1=$recv(stream)._contents();
  58522. $ctx1.sendIdx["contents"]=1;
  58523. $self._assert_equals_($1,collection);
  58524. $ctx1.sendIdx["assert:equals:"]=1;
  58525. stream=$self._newStream();
  58526. $recv(stream)._nextPutAll_(collection);
  58527. $self._assert_equals_($recv(stream)._contents(),collection);
  58528. return self;
  58529. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  58530. },
  58531. args: [],
  58532. source: "testWriting\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream nextPut: each ].\x0a\x09self assert: stream contents equals: collection.\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream contents equals: collection",
  58533. referencedClasses: [],
  58534. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  58535. }),
  58536. $globals.StreamTest);
  58537. $core.addMethod(
  58538. $core.method({
  58539. selector: "collectionClass",
  58540. protocol: "accessing",
  58541. fn: function (){
  58542. var self=this,$self=this;
  58543. return nil;
  58544. },
  58545. args: [],
  58546. source: "collectionClass\x0a\x09^ nil",
  58547. referencedClasses: [],
  58548. messageSends: []
  58549. }),
  58550. $globals.StreamTest.a$cls);
  58551. $core.addMethod(
  58552. $core.method({
  58553. selector: "isAbstract",
  58554. protocol: "testing",
  58555. fn: function (){
  58556. var self=this,$self=this;
  58557. return $core.withContext(function($ctx1) {
  58558. return $recv($self._collectionClass())._isNil();
  58559. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  58560. },
  58561. args: [],
  58562. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  58563. referencedClasses: [],
  58564. messageSends: ["isNil", "collectionClass"]
  58565. }),
  58566. $globals.StreamTest.a$cls);
  58567. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  58568. $core.addMethod(
  58569. $core.method({
  58570. selector: "newCollection",
  58571. protocol: "accessing",
  58572. fn: function (){
  58573. var self=this,$self=this;
  58574. return $core.withContext(function($ctx1) {
  58575. return [true,(1),(3).__at((4)),"foo"];
  58576. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  58577. },
  58578. args: [],
  58579. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  58580. referencedClasses: [],
  58581. messageSends: ["@"]
  58582. }),
  58583. $globals.ArrayStreamTest);
  58584. $core.addMethod(
  58585. $core.method({
  58586. selector: "collectionClass",
  58587. protocol: "accessing",
  58588. fn: function (){
  58589. var self=this,$self=this;
  58590. return $globals.Array;
  58591. },
  58592. args: [],
  58593. source: "collectionClass\x0a\x09^ Array",
  58594. referencedClasses: ["Array"],
  58595. messageSends: []
  58596. }),
  58597. $globals.ArrayStreamTest.a$cls);
  58598. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  58599. $core.addMethod(
  58600. $core.method({
  58601. selector: "newCollection",
  58602. protocol: "accessing",
  58603. fn: function (){
  58604. var self=this,$self=this;
  58605. return "hello world";
  58606. },
  58607. args: [],
  58608. source: "newCollection\x0a\x09^ 'hello world'",
  58609. referencedClasses: [],
  58610. messageSends: []
  58611. }),
  58612. $globals.StringStreamTest);
  58613. $core.addMethod(
  58614. $core.method({
  58615. selector: "collectionClass",
  58616. protocol: "accessing",
  58617. fn: function (){
  58618. var self=this,$self=this;
  58619. return $globals.String;
  58620. },
  58621. args: [],
  58622. source: "collectionClass\x0a\x09^ String",
  58623. referencedClasses: ["String"],
  58624. messageSends: []
  58625. }),
  58626. $globals.StringStreamTest.a$cls);
  58627. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  58628. $core.addMethod(
  58629. $core.method({
  58630. selector: "testCopying",
  58631. protocol: "tests",
  58632. fn: function (){
  58633. var self=this,$self=this;
  58634. return $core.withContext(function($ctx1) {
  58635. $self._assert_equals_(nil._copy(),nil);
  58636. return self;
  58637. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  58638. },
  58639. args: [],
  58640. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  58641. referencedClasses: [],
  58642. messageSends: ["assert:equals:", "copy"]
  58643. }),
  58644. $globals.UndefinedTest);
  58645. $core.addMethod(
  58646. $core.method({
  58647. selector: "testDeepCopy",
  58648. protocol: "tests",
  58649. fn: function (){
  58650. var self=this,$self=this;
  58651. return $core.withContext(function($ctx1) {
  58652. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  58653. return self;
  58654. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  58655. },
  58656. args: [],
  58657. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  58658. referencedClasses: [],
  58659. messageSends: ["assert:", "=", "deepCopy"]
  58660. }),
  58661. $globals.UndefinedTest);
  58662. $core.addMethod(
  58663. $core.method({
  58664. selector: "testIfNil",
  58665. protocol: "tests",
  58666. fn: function (){
  58667. var self=this,$self=this;
  58668. return $core.withContext(function($ctx1) {
  58669. var $1,$3,$2,$4,$6,$5,$receiver;
  58670. if(($receiver = nil) == null || $receiver.a$nil){
  58671. $1=true;
  58672. } else {
  58673. $1=nil;
  58674. }
  58675. $self._assert_equals_($1,true);
  58676. $ctx1.sendIdx["assert:equals:"]=1;
  58677. if(($receiver = nil) == null || $receiver.a$nil){
  58678. $3=nil;
  58679. } else {
  58680. $3=true;
  58681. }
  58682. $2=$recv($3).__eq(true);
  58683. $ctx1.sendIdx["="]=1;
  58684. $self._deny_($2);
  58685. $ctx1.sendIdx["deny:"]=1;
  58686. if(($receiver = nil) == null || $receiver.a$nil){
  58687. $4=true;
  58688. } else {
  58689. $4=false;
  58690. }
  58691. $self._assert_equals_($4,true);
  58692. if(($receiver = nil) == null || $receiver.a$nil){
  58693. $6=false;
  58694. } else {
  58695. $6=true;
  58696. }
  58697. $5=$recv($6).__eq(true);
  58698. $self._deny_($5);
  58699. return self;
  58700. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  58701. },
  58702. args: [],
  58703. source: "testIfNil\x0a\x09self assert: (nil ifNil: [ true ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ]) = true.\x0a\x09self assert: (nil ifNil: [ true ] ifNotNil: [ false ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ] ifNil: [ false ]) = true",
  58704. referencedClasses: [],
  58705. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  58706. }),
  58707. $globals.UndefinedTest);
  58708. $core.addMethod(
  58709. $core.method({
  58710. selector: "testIsNil",
  58711. protocol: "tests",
  58712. fn: function (){
  58713. var self=this,$self=this;
  58714. return $core.withContext(function($ctx1) {
  58715. $self._assert_(nil._isNil());
  58716. $self._deny_(nil._notNil());
  58717. return self;
  58718. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  58719. },
  58720. args: [],
  58721. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  58722. referencedClasses: [],
  58723. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  58724. }),
  58725. $globals.UndefinedTest);
  58726. });
  58727. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  58728. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  58729. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  58730. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  58731. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  58732. $core.addPackage("Platform-DOM-Tests");
  58733. $core.packages["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  58734. $core.packages["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  58735. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  58736. $core.addMethod(
  58737. $core.method({
  58738. selector: "testEntityConversion",
  58739. protocol: "testing",
  58740. fn: function (){
  58741. var self=this,$self=this;
  58742. return $core.withContext(function($ctx1) {
  58743. var $1;
  58744. $1=$recv($globals.PlatformDom)._isFeasible();
  58745. if($core.assert($1)){
  58746. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  58747. }
  58748. return self;
  58749. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  58750. },
  58751. args: [],
  58752. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  58753. referencedClasses: ["PlatformDom"],
  58754. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  58755. }),
  58756. $globals.PlatformDomTest);
  58757. $core.addMethod(
  58758. $core.method({
  58759. selector: "testTextContentDoesNotRunScript",
  58760. protocol: "testing",
  58761. fn: function (){
  58762. var self=this,$self=this;
  58763. return $core.withContext(function($ctx1) {
  58764. var $1;
  58765. $1=$recv($globals.PlatformDom)._isFeasible();
  58766. if($core.assert($1)){
  58767. $self._shouldnt_raise_((function(){
  58768. return $core.withContext(function($ctx2) {
  58769. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  58770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58771. }),$globals.Error);
  58772. }
  58773. return self;
  58774. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  58775. },
  58776. args: [],
  58777. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  58778. referencedClasses: ["PlatformDom", "Error"],
  58779. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  58780. }),
  58781. $globals.PlatformDomTest);
  58782. });
  58783. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  58784. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  58785. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  58786. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  58787. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  58788. $core.addPackage("SUnit-Tests");
  58789. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  58790. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  58791. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  58792. $globals.ExampleSetTest.comment="ExampleSetTest is taken from Pharo 1.4.\x0a\x0aTHe purpose of this class is to demonstrate a simple use case of the test framework.";
  58793. $core.addMethod(
  58794. $core.method({
  58795. selector: "setUp",
  58796. protocol: "running",
  58797. fn: function (){
  58798. var self=this,$self=this;
  58799. return $core.withContext(function($ctx1) {
  58800. $self["@empty"]=$recv($globals.Set)._new();
  58801. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  58802. return self;
  58803. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  58804. },
  58805. args: [],
  58806. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  58807. referencedClasses: ["Set"],
  58808. messageSends: ["new", "with:with:"]
  58809. }),
  58810. $globals.ExampleSetTest);
  58811. $core.addMethod(
  58812. $core.method({
  58813. selector: "testAdd",
  58814. protocol: "tests",
  58815. fn: function (){
  58816. var self=this,$self=this;
  58817. return $core.withContext(function($ctx1) {
  58818. $recv($self["@empty"])._add_((5));
  58819. $self._assert_($recv($self["@empty"])._includes_((5)));
  58820. return self;
  58821. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  58822. },
  58823. args: [],
  58824. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  58825. referencedClasses: [],
  58826. messageSends: ["add:", "assert:", "includes:"]
  58827. }),
  58828. $globals.ExampleSetTest);
  58829. $core.addMethod(
  58830. $core.method({
  58831. selector: "testGrow",
  58832. protocol: "tests",
  58833. fn: function (){
  58834. var self=this,$self=this;
  58835. return $core.withContext(function($ctx1) {
  58836. $recv($self["@empty"])._addAll_((1)._to_((100)));
  58837. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  58838. return self;
  58839. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  58840. },
  58841. args: [],
  58842. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  58843. referencedClasses: [],
  58844. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  58845. }),
  58846. $globals.ExampleSetTest);
  58847. $core.addMethod(
  58848. $core.method({
  58849. selector: "testIllegal",
  58850. protocol: "tests",
  58851. fn: function (){
  58852. var self=this,$self=this;
  58853. return $core.withContext(function($ctx1) {
  58854. $self._should_raise_((function(){
  58855. return $core.withContext(function($ctx2) {
  58856. return $recv($self["@empty"])._at_((5));
  58857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58858. }),$globals.Error);
  58859. $ctx1.sendIdx["should:raise:"]=1;
  58860. $self._should_raise_((function(){
  58861. return $core.withContext(function($ctx2) {
  58862. return $recv($self["@empty"])._at_put_((5),"abc");
  58863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58864. }),$globals.Error);
  58865. return self;
  58866. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  58867. },
  58868. args: [],
  58869. source: "testIllegal\x0a\x09self\x0a\x09\x09should: [ empty at: 5 ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ empty at: 5 put: #abc ]\x0a\x09\x09raise: Error",
  58870. referencedClasses: ["Error"],
  58871. messageSends: ["should:raise:", "at:", "at:put:"]
  58872. }),
  58873. $globals.ExampleSetTest);
  58874. $core.addMethod(
  58875. $core.method({
  58876. selector: "testIncludes",
  58877. protocol: "tests",
  58878. fn: function (){
  58879. var self=this,$self=this;
  58880. return $core.withContext(function($ctx1) {
  58881. var $1;
  58882. $1=$recv($self["@full"])._includes_((5));
  58883. $ctx1.sendIdx["includes:"]=1;
  58884. $self._assert_($1);
  58885. $ctx1.sendIdx["assert:"]=1;
  58886. $self._assert_($recv($self["@full"])._includes_("abc"));
  58887. return self;
  58888. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  58889. },
  58890. args: [],
  58891. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  58892. referencedClasses: [],
  58893. messageSends: ["assert:", "includes:"]
  58894. }),
  58895. $globals.ExampleSetTest);
  58896. $core.addMethod(
  58897. $core.method({
  58898. selector: "testOccurrences",
  58899. protocol: "tests",
  58900. fn: function (){
  58901. var self=this,$self=this;
  58902. return $core.withContext(function($ctx1) {
  58903. var $1,$2;
  58904. $1=$recv($self["@empty"])._occurrencesOf_((0));
  58905. $ctx1.sendIdx["occurrencesOf:"]=1;
  58906. $self._assert_equals_($1,(0));
  58907. $ctx1.sendIdx["assert:equals:"]=1;
  58908. $2=$recv($self["@full"])._occurrencesOf_((5));
  58909. $ctx1.sendIdx["occurrencesOf:"]=2;
  58910. $self._assert_equals_($2,(1));
  58911. $ctx1.sendIdx["assert:equals:"]=2;
  58912. $recv($self["@full"])._add_((5));
  58913. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  58914. return self;
  58915. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  58916. },
  58917. args: [],
  58918. source: "testOccurrences\x0a\x09self assert: (empty occurrencesOf: 0) equals: 0.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1.\x0a\x09full add: 5.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1",
  58919. referencedClasses: [],
  58920. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  58921. }),
  58922. $globals.ExampleSetTest);
  58923. $core.addMethod(
  58924. $core.method({
  58925. selector: "testRemove",
  58926. protocol: "tests",
  58927. fn: function (){
  58928. var self=this,$self=this;
  58929. return $core.withContext(function($ctx1) {
  58930. var $1;
  58931. $recv($self["@full"])._remove_((5));
  58932. $1=$recv($self["@full"])._includes_("abc");
  58933. $ctx1.sendIdx["includes:"]=1;
  58934. $self._assert_($1);
  58935. $self._deny_($recv($self["@full"])._includes_((5)));
  58936. return self;
  58937. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  58938. },
  58939. args: [],
  58940. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  58941. referencedClasses: [],
  58942. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  58943. }),
  58944. $globals.ExampleSetTest);
  58945. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  58946. $core.addMethod(
  58947. $core.method({
  58948. selector: "fakeError",
  58949. protocol: "helpers",
  58950. fn: function (){
  58951. var self=this,$self=this;
  58952. return $core.withContext(function($ctx1) {
  58953. $self["@flag"]="bad";
  58954. $self._timeout_((30));
  58955. $self["@flag"]=$recv($self._async_((function(){
  58956. return $core.withContext(function($ctx2) {
  58957. $self["@flag"]="ok";
  58958. $self["@flag"];
  58959. return $self._error_("Intentional");
  58960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58961. })))._valueWithTimeout_((20));
  58962. return self;
  58963. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  58964. },
  58965. args: [],
  58966. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  58967. referencedClasses: [],
  58968. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  58969. }),
  58970. $globals.SUnitAsyncTest);
  58971. $core.addMethod(
  58972. $core.method({
  58973. selector: "fakeErrorFailingInTearDown",
  58974. protocol: "helpers",
  58975. fn: function (){
  58976. var self=this,$self=this;
  58977. return $core.withContext(function($ctx1) {
  58978. $self["@flag"]="bad";
  58979. $self._timeout_((30));
  58980. $self["@flag"]=$recv($self._async_((function(){
  58981. return $core.withContext(function($ctx2) {
  58982. return $self._error_("Intentional");
  58983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58984. })))._valueWithTimeout_((20));
  58985. return self;
  58986. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  58987. },
  58988. args: [],
  58989. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  58990. referencedClasses: [],
  58991. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  58992. }),
  58993. $globals.SUnitAsyncTest);
  58994. $core.addMethod(
  58995. $core.method({
  58996. selector: "fakeFailure",
  58997. protocol: "helpers",
  58998. fn: function (){
  58999. var self=this,$self=this;
  59000. return $core.withContext(function($ctx1) {
  59001. $self["@flag"]="bad";
  59002. $self._timeout_((30));
  59003. $self["@flag"]=$recv($self._async_((function(){
  59004. return $core.withContext(function($ctx2) {
  59005. $self["@flag"]="ok";
  59006. $self["@flag"];
  59007. return $self._assert_(false);
  59008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59009. })))._valueWithTimeout_((20));
  59010. return self;
  59011. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  59012. },
  59013. args: [],
  59014. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  59015. referencedClasses: [],
  59016. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  59017. }),
  59018. $globals.SUnitAsyncTest);
  59019. $core.addMethod(
  59020. $core.method({
  59021. selector: "fakeMultipleTimeoutFailing",
  59022. protocol: "helpers",
  59023. fn: function (){
  59024. var self=this,$self=this;
  59025. return $core.withContext(function($ctx1) {
  59026. var $1;
  59027. $self._timeout_((100));
  59028. $ctx1.sendIdx["timeout:"]=1;
  59029. $1=$self._async_((function(){
  59030. return $core.withContext(function($ctx2) {
  59031. $self._timeout_((20));
  59032. return $recv($self._async_((function(){
  59033. return $core.withContext(function($ctx3) {
  59034. return $self._finished();
  59035. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59036. })))._valueWithTimeout_((30));
  59037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59038. }));
  59039. $ctx1.sendIdx["async:"]=1;
  59040. $recv($1)._valueWithTimeout_((20));
  59041. $ctx1.sendIdx["valueWithTimeout:"]=1;
  59042. return self;
  59043. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  59044. },
  59045. args: [],
  59046. source: "fakeMultipleTimeoutFailing\x0a\x09self timeout: 100.\x0a\x09(self async: [ \x0a\x09\x09self timeout: 20.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 30\x0a\x09]) valueWithTimeout: 20",
  59047. referencedClasses: [],
  59048. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  59049. }),
  59050. $globals.SUnitAsyncTest);
  59051. $core.addMethod(
  59052. $core.method({
  59053. selector: "fakeMultipleTimeoutPassing",
  59054. protocol: "helpers",
  59055. fn: function (){
  59056. var self=this,$self=this;
  59057. return $core.withContext(function($ctx1) {
  59058. var $1;
  59059. $self._timeout_((20));
  59060. $ctx1.sendIdx["timeout:"]=1;
  59061. $1=$self._async_((function(){
  59062. return $core.withContext(function($ctx2) {
  59063. $self._timeout_((40));
  59064. return $recv($self._async_((function(){
  59065. return $core.withContext(function($ctx3) {
  59066. return $self._finished();
  59067. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59068. })))._valueWithTimeout_((20));
  59069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59070. }));
  59071. $ctx1.sendIdx["async:"]=1;
  59072. $recv($1)._valueWithTimeout_((10));
  59073. $ctx1.sendIdx["valueWithTimeout:"]=1;
  59074. return self;
  59075. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  59076. },
  59077. args: [],
  59078. source: "fakeMultipleTimeoutPassing\x0a\x09self timeout: 20.\x0a\x09(self async: [\x0a\x09\x09self timeout: 40.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 20\x0a\x09]) valueWithTimeout: 10",
  59079. referencedClasses: [],
  59080. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  59081. }),
  59082. $globals.SUnitAsyncTest);
  59083. $core.addMethod(
  59084. $core.method({
  59085. selector: "fakeTimeout",
  59086. protocol: "helpers",
  59087. fn: function (){
  59088. var self=this,$self=this;
  59089. return $core.withContext(function($ctx1) {
  59090. $self._timeout_((10));
  59091. $recv($self._async_((function(){
  59092. return $core.withContext(function($ctx2) {
  59093. return $self._finished();
  59094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59095. })))._valueWithTimeout_((20));
  59096. return self;
  59097. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  59098. },
  59099. args: [],
  59100. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  59101. referencedClasses: [],
  59102. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  59103. }),
  59104. $globals.SUnitAsyncTest);
  59105. $core.addMethod(
  59106. $core.method({
  59107. selector: "selectorSetOf:",
  59108. protocol: "private",
  59109. fn: function (aCollection){
  59110. var self=this,$self=this;
  59111. return $core.withContext(function($ctx1) {
  59112. return $recv($recv(aCollection)._collect_((function(each){
  59113. return $core.withContext(function($ctx2) {
  59114. return $recv(each)._selector();
  59115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59116. })))._asSet();
  59117. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  59118. },
  59119. args: ["aCollection"],
  59120. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  59121. referencedClasses: [],
  59122. messageSends: ["asSet", "collect:", "selector"]
  59123. }),
  59124. $globals.SUnitAsyncTest);
  59125. $core.addMethod(
  59126. $core.method({
  59127. selector: "setUp",
  59128. protocol: "running",
  59129. fn: function (){
  59130. var self=this,$self=this;
  59131. $self["@flag"]="ok";
  59132. return self;
  59133. },
  59134. args: [],
  59135. source: "setUp\x0a\x09flag := 'ok'",
  59136. referencedClasses: [],
  59137. messageSends: []
  59138. }),
  59139. $globals.SUnitAsyncTest);
  59140. $core.addMethod(
  59141. $core.method({
  59142. selector: "tearDown",
  59143. protocol: "running",
  59144. fn: function (){
  59145. var self=this,$self=this;
  59146. return $core.withContext(function($ctx1) {
  59147. $self._assert_equals_("ok",$self["@flag"]);
  59148. return self;
  59149. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  59150. },
  59151. args: [],
  59152. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  59153. referencedClasses: [],
  59154. messageSends: ["assert:equals:"]
  59155. }),
  59156. $globals.SUnitAsyncTest);
  59157. $core.addMethod(
  59158. $core.method({
  59159. selector: "testAsyncErrorsAndFailures",
  59160. protocol: "tests",
  59161. fn: function (){
  59162. var self=this,$self=this;
  59163. var suite,runner,result,assertBlock;
  59164. return $core.withContext(function($ctx1) {
  59165. var $1,$2,$3,$4;
  59166. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  59167. return $core.withContext(function($ctx2) {
  59168. return $recv($self._class())._selector_(each);
  59169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59170. }));
  59171. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  59172. $self._timeout_((200));
  59173. result=$recv(runner)._result();
  59174. $ctx1.sendIdx["result"]=1;
  59175. assertBlock=$self._async_((function(){
  59176. return $core.withContext(function($ctx2) {
  59177. $1=$self._selectorSetOf_($recv(result)._errors());
  59178. $ctx2.sendIdx["selectorSetOf:"]=1;
  59179. $2=["fakeError"]._asSet();
  59180. $ctx2.sendIdx["asSet"]=1;
  59181. $self._assert_equals_($1,$2);
  59182. $ctx2.sendIdx["assert:equals:"]=1;
  59183. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  59184. return $self._finished();
  59185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59186. }));
  59187. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  59188. return $core.withContext(function($ctx2) {
  59189. $3=$recv($recv(ann)._result()).__eq_eq(result);
  59190. if($core.assert($3)){
  59191. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  59192. return $recv($4)._ifTrue_(assertBlock);
  59193. }
  59194. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  59195. }));
  59196. $recv(runner)._run();
  59197. return self;
  59198. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  59199. },
  59200. args: [],
  59201. source: "testAsyncErrorsAndFailures\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: #('fakeError') asSet.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeErrorFailingInTearDown' 'fakeFailure') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  59202. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  59203. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  59204. }),
  59205. $globals.SUnitAsyncTest);
  59206. $core.addMethod(
  59207. $core.method({
  59208. selector: "testAsyncNeedsTimeout",
  59209. protocol: "tests",
  59210. fn: function (){
  59211. var self=this,$self=this;
  59212. return $core.withContext(function($ctx1) {
  59213. $self._should_raise_((function(){
  59214. return $core.withContext(function($ctx2) {
  59215. return $self._async_((function(){
  59216. }));
  59217. $ctx2.sendIdx["async:"]=1;
  59218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59219. }),$globals.Error);
  59220. $self._timeout_((0));
  59221. $self._shouldnt_raise_((function(){
  59222. return $core.withContext(function($ctx2) {
  59223. return $self._async_((function(){
  59224. }));
  59225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59226. }),$globals.Error);
  59227. $self._finished();
  59228. return self;
  59229. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  59230. },
  59231. args: [],
  59232. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  59233. referencedClasses: ["Error"],
  59234. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  59235. }),
  59236. $globals.SUnitAsyncTest);
  59237. $core.addMethod(
  59238. $core.method({
  59239. selector: "testFinishedNeedsTimeout",
  59240. protocol: "tests",
  59241. fn: function (){
  59242. var self=this,$self=this;
  59243. return $core.withContext(function($ctx1) {
  59244. $self._should_raise_((function(){
  59245. return $core.withContext(function($ctx2) {
  59246. return $self._finished();
  59247. $ctx2.sendIdx["finished"]=1;
  59248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59249. }),$globals.Error);
  59250. $self._timeout_((0));
  59251. $self._shouldnt_raise_((function(){
  59252. return $core.withContext(function($ctx2) {
  59253. return $self._finished();
  59254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59255. }),$globals.Error);
  59256. return self;
  59257. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  59258. },
  59259. args: [],
  59260. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  59261. referencedClasses: ["Error"],
  59262. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  59263. }),
  59264. $globals.SUnitAsyncTest);
  59265. $core.addMethod(
  59266. $core.method({
  59267. selector: "testIsAsyncReturnsCorrectValues",
  59268. protocol: "tests",
  59269. fn: function (){
  59270. var self=this,$self=this;
  59271. return $core.withContext(function($ctx1) {
  59272. var $1,$2;
  59273. $1=$self._isAsync();
  59274. $ctx1.sendIdx["isAsync"]=1;
  59275. $self._deny_($1);
  59276. $ctx1.sendIdx["deny:"]=1;
  59277. $self._timeout_((0));
  59278. $2=$self._isAsync();
  59279. $ctx1.sendIdx["isAsync"]=2;
  59280. $self._assert_($2);
  59281. $self._finished();
  59282. $self._deny_($self._isAsync());
  59283. return self;
  59284. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  59285. },
  59286. args: [],
  59287. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  59288. referencedClasses: [],
  59289. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  59290. }),
  59291. $globals.SUnitAsyncTest);
  59292. $core.addMethod(
  59293. $core.method({
  59294. selector: "testPass",
  59295. protocol: "tests",
  59296. fn: function (){
  59297. var self=this,$self=this;
  59298. return $core.withContext(function($ctx1) {
  59299. $self["@flag"]="bad";
  59300. $self._timeout_((10));
  59301. $self["@flag"]=$recv($self._async_((function(){
  59302. return $core.withContext(function($ctx2) {
  59303. $self._assert_(true);
  59304. $self._finished();
  59305. $self["@flag"]="ok";
  59306. return $self["@flag"];
  59307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59308. })))._valueWithTimeout_((5));
  59309. return self;
  59310. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  59311. },
  59312. args: [],
  59313. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  59314. referencedClasses: [],
  59315. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  59316. }),
  59317. $globals.SUnitAsyncTest);
  59318. $core.addMethod(
  59319. $core.method({
  59320. selector: "testTimeouts",
  59321. protocol: "tests",
  59322. fn: function (){
  59323. var self=this,$self=this;
  59324. var suite,runner,result,assertBlock;
  59325. return $core.withContext(function($ctx1) {
  59326. var $1,$2,$3;
  59327. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  59328. return $core.withContext(function($ctx2) {
  59329. return $recv($self._class())._selector_(each);
  59330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59331. }));
  59332. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  59333. $self._timeout_((200));
  59334. result=$recv(runner)._result();
  59335. $ctx1.sendIdx["result"]=1;
  59336. assertBlock=$self._async_((function(){
  59337. return $core.withContext(function($ctx2) {
  59338. $1=$self._selectorSetOf_($recv(result)._errors());
  59339. $ctx2.sendIdx["selectorSetOf:"]=1;
  59340. $self._assert_equals_($1,$recv($globals.Set)._new());
  59341. $ctx2.sendIdx["assert:equals:"]=1;
  59342. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  59343. return $self._finished();
  59344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59345. }));
  59346. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  59347. return $core.withContext(function($ctx2) {
  59348. $2=$recv($recv(ann)._result()).__eq_eq(result);
  59349. if($core.assert($2)){
  59350. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  59351. return $recv($3)._ifTrue_(assertBlock);
  59352. }
  59353. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  59354. }));
  59355. $recv(runner)._run();
  59356. return self;
  59357. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  59358. },
  59359. args: [],
  59360. source: "testTimeouts\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeTimeout' 'fakeMultipleTimeoutFailing' 'fakeMultipleTimeoutPassing' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: Set new.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeMultipleTimeoutFailing' 'fakeTimeout') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  59361. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  59362. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  59363. }),
  59364. $globals.SUnitAsyncTest);
  59365. $core.addMethod(
  59366. $core.method({
  59367. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  59368. protocol: "tests",
  59369. fn: function (){
  59370. var self=this,$self=this;
  59371. var x;
  59372. return $core.withContext(function($ctx1) {
  59373. var $1;
  59374. $self["@flag"]="bad";
  59375. $self._timeout_((10));
  59376. x=(0);
  59377. $1=$self._async_((function(){
  59378. return $core.withContext(function($ctx2) {
  59379. $self._finished();
  59380. $ctx2.sendIdx["finished"]=1;
  59381. $self["@flag"]="ok";
  59382. $self["@flag"];
  59383. x=$recv(x).__plus((1));
  59384. $ctx2.sendIdx["+"]=1;
  59385. x;
  59386. return $self._assert_equals_(x,(1));
  59387. $ctx2.sendIdx["assert:equals:"]=1;
  59388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59389. }));
  59390. $ctx1.sendIdx["async:"]=1;
  59391. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  59392. $ctx1.sendIdx["valueWithTimeout:"]=1;
  59393. $self["@flag"]=$recv($self._async_((function(){
  59394. return $core.withContext(function($ctx2) {
  59395. $self._finished();
  59396. $self["@flag"]="ok";
  59397. $self["@flag"];
  59398. x=$recv(x).__plus((1));
  59399. x;
  59400. return $self._assert_equals_(x,(1));
  59401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59402. })))._valueWithTimeout_((0));
  59403. return self;
  59404. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  59405. },
  59406. args: [],
  59407. source: "testTwoAsyncPassesWithFinishedOnlyOneIsRun\x0a\x09| x |\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09x := 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.",
  59408. referencedClasses: [],
  59409. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  59410. }),
  59411. $globals.SUnitAsyncTest);
  59412. });
  59413. define('amber/devel',[
  59414. './lang',
  59415. './compatibility', // pre-fetch, dep of ./boot
  59416. './kernel-fundamentals', // pre-fetch, dep of ./boot
  59417. './kernel-language', // pre-fetch, dep of ./boot
  59418. './boot', // pre-fetch, dep of ./helpers
  59419. './helpers', // pre-fetch, dep of ./deploy
  59420. './deploy', // pre-fetch, dep of ./lang
  59421. // --- packages of the development only Amber begin here ---
  59422. 'amber_core/Platform-DOM',
  59423. 'amber_core/SUnit',
  59424. 'amber_core/Compiler-Tests',
  59425. 'amber_core/Kernel-Tests',
  59426. 'amber_core/Platform-DOM-Tests',
  59427. 'amber_core/SUnit-Tests'
  59428. // --- packages of the development only Amber end here ---
  59429. ], function (amber) {
  59430. return amber;
  59431. });
  59432. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  59433. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  59434. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  59435. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  59436. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  59437. $core.addPackage("AmberCli");
  59438. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  59439. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  59440. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  59441. $globals.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.";
  59442. $core.addMethod(
  59443. $core.method({
  59444. selector: "commandLineSwitches",
  59445. protocol: "commandline",
  59446. fn: function (){
  59447. var self=this,$self=this;
  59448. var switches;
  59449. return $core.withContext(function($ctx1) {
  59450. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  59451. return $core.withContext(function($ctx2) {
  59452. return $recv(each)._selector();
  59453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59454. }));
  59455. $ctx1.sendIdx["collect:"]=1;
  59456. switches=$recv(switches)._select_((function(each){
  59457. return $core.withContext(function($ctx2) {
  59458. return $recv(each)._match_("^[^:]*:$");
  59459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59460. }));
  59461. switches=$recv(switches)._collect_((function(each){
  59462. return $core.withContext(function($ctx2) {
  59463. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  59464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  59465. }));
  59466. return switches;
  59467. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  59468. },
  59469. args: [],
  59470. 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",
  59471. referencedClasses: [],
  59472. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  59473. }),
  59474. $globals.AmberCli.a$cls);
  59475. $core.addMethod(
  59476. $core.method({
  59477. selector: "config:",
  59478. protocol: "commands",
  59479. fn: function (args){
  59480. var self=this,$self=this;
  59481. return $core.withContext(function($ctx1) {
  59482. $recv($recv($globals.Configurator)._new())._start();
  59483. return self;
  59484. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  59485. },
  59486. args: ["args"],
  59487. source: "config: args\x0a\x09Configurator new start",
  59488. referencedClasses: ["Configurator"],
  59489. messageSends: ["start", "new"]
  59490. }),
  59491. $globals.AmberCli.a$cls);
  59492. $core.addMethod(
  59493. $core.method({
  59494. selector: "handleArguments:",
  59495. protocol: "commandline",
  59496. fn: function (args){
  59497. var self=this,$self=this;
  59498. var selector;
  59499. return $core.withContext(function($ctx1) {
  59500. var $1;
  59501. $1=$recv(args)._first();
  59502. $ctx1.sendIdx["first"]=1;
  59503. selector=$self._selectorForCommandLineSwitch_($1);
  59504. $recv(args)._remove_($recv(args)._first());
  59505. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  59506. return self;
  59507. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  59508. },
  59509. args: ["args"],
  59510. 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)",
  59511. referencedClasses: ["Array"],
  59512. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  59513. }),
  59514. $globals.AmberCli.a$cls);
  59515. $core.addMethod(
  59516. $core.method({
  59517. selector: "help:",
  59518. protocol: "commands",
  59519. fn: function (args){
  59520. var self=this,$self=this;
  59521. return $core.withContext(function($ctx1) {
  59522. $recv($globals.Transcript)._show_("Available commands");
  59523. $recv($self._commandLineSwitches())._do_((function(each){
  59524. return $core.withContext(function($ctx2) {
  59525. return $recv(console)._log_(each);
  59526. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59527. }));
  59528. return self;
  59529. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  59530. },
  59531. args: ["args"],
  59532. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  59533. referencedClasses: ["Transcript"],
  59534. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  59535. }),
  59536. $globals.AmberCli.a$cls);
  59537. $core.addMethod(
  59538. $core.method({
  59539. selector: "init:",
  59540. protocol: "commands",
  59541. fn: function (args){
  59542. var self=this,$self=this;
  59543. return $core.withContext(function($ctx1) {
  59544. $recv($recv($globals.Initer)._new())._start();
  59545. return self;
  59546. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  59547. },
  59548. args: ["args"],
  59549. source: "init: args\x0a\x09Initer new start",
  59550. referencedClasses: ["Initer"],
  59551. messageSends: ["start", "new"]
  59552. }),
  59553. $globals.AmberCli.a$cls);
  59554. $core.addMethod(
  59555. $core.method({
  59556. selector: "main",
  59557. protocol: "startup",
  59558. fn: function (){
  59559. var self=this,$self=this;
  59560. var args,packageJSON;
  59561. return $core.withContext(function($ctx1) {
  59562. var $7,$6,$5,$4,$3,$2,$1;
  59563. var $early={};
  59564. try {
  59565. packageJSON=$recv(require)._value_("../package.json");
  59566. $7=$recv(packageJSON)._version();
  59567. $ctx1.sendIdx["version"]=1;
  59568. $6="Welcome to Amber CLI version ".__comma($7);
  59569. $5=$recv($6).__comma(" (Amber ");
  59570. $ctx1.sendIdx[","]=5;
  59571. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  59572. $ctx1.sendIdx[","]=4;
  59573. $3=$recv($4).__comma(", NodeJS ");
  59574. $ctx1.sendIdx[","]=3;
  59575. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  59576. $ctx1.sendIdx[","]=2;
  59577. $1=$recv($2).__comma(").");
  59578. $ctx1.sendIdx[","]=1;
  59579. $recv($globals.Transcript)._show_($1);
  59580. args=$recv(process)._argv();
  59581. $recv(args)._removeFrom_to_((1),(2));
  59582. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  59583. return $core.withContext(function($ctx2) {
  59584. return $self._help_(nil);
  59585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59586. }),(function(){
  59587. return $core.withContext(function($ctx2) {
  59588. throw $early=[$self._handleArguments_(args)];
  59589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59590. }));
  59591. return self;
  59592. }
  59593. catch(e) {if(e===$early)return e[0]; throw e}
  59594. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  59595. },
  59596. args: [],
  59597. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args packageJSON |\x0a\x09\x0a\x09packageJSON := require value: '../package.json'.\x0a\x09Transcript show: 'Welcome to Amber CLI version ', packageJSON version, ' (Amber ', Smalltalk version, ', NodeJS ', process versions node, ').'.\x0a\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 2.\x0a\x09\x0a\x09args\x0a\x09\x09ifEmpty: [self help: nil]\x0a\x09\x09ifNotEmpty: [^self handleArguments: args]",
  59598. referencedClasses: ["Transcript", "Smalltalk"],
  59599. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  59600. }),
  59601. $globals.AmberCli.a$cls);
  59602. $core.addMethod(
  59603. $core.method({
  59604. selector: "repl:",
  59605. protocol: "commands",
  59606. fn: function (args){
  59607. var self=this,$self=this;
  59608. return $core.withContext(function($ctx1) {
  59609. return $recv($recv($globals.Repl)._new())._createInterface();
  59610. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  59611. },
  59612. args: ["args"],
  59613. source: "repl: args\x0a\x09^ Repl new createInterface",
  59614. referencedClasses: ["Repl"],
  59615. messageSends: ["createInterface", "new"]
  59616. }),
  59617. $globals.AmberCli.a$cls);
  59618. $core.addMethod(
  59619. $core.method({
  59620. selector: "selectorForCommandLineSwitch:",
  59621. protocol: "commandline",
  59622. fn: function (aSwitch){
  59623. var self=this,$self=this;
  59624. var command,selector;
  59625. return $core.withContext(function($ctx1) {
  59626. var $1;
  59627. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  59628. if($core.assert($1)){
  59629. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  59630. return $core.withContext(function($ctx2) {
  59631. return $recv($recv(each)._second())._asUppercase();
  59632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59633. }))).__comma(":");
  59634. selector;
  59635. } else {
  59636. selector="help:";
  59637. selector;
  59638. }
  59639. return selector;
  59640. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  59641. },
  59642. args: ["aSwitch"],
  59643. 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",
  59644. referencedClasses: [],
  59645. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  59646. }),
  59647. $globals.AmberCli.a$cls);
  59648. $core.addMethod(
  59649. $core.method({
  59650. selector: "serve:",
  59651. protocol: "commands",
  59652. fn: function (args){
  59653. var self=this,$self=this;
  59654. return $core.withContext(function($ctx1) {
  59655. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  59656. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  59657. },
  59658. args: ["args"],
  59659. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  59660. referencedClasses: ["FileServer"],
  59661. messageSends: ["start", "createServerWithArguments:"]
  59662. }),
  59663. $globals.AmberCli.a$cls);
  59664. $core.addMethod(
  59665. $core.method({
  59666. selector: "version:",
  59667. protocol: "commands",
  59668. fn: function (arguments_){
  59669. var self=this,$self=this;
  59670. return self;
  59671. },
  59672. args: ["arguments"],
  59673. source: "version: arguments",
  59674. referencedClasses: [],
  59675. messageSends: []
  59676. }),
  59677. $globals.AmberCli.a$cls);
  59678. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  59679. $core.addMethod(
  59680. $core.method({
  59681. selector: "dirname",
  59682. protocol: "private",
  59683. fn: function (){
  59684. var self=this,$self=this;
  59685. return $core.withContext(function($ctx1) {
  59686. return __dirname;
  59687. return self;
  59688. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  59689. },
  59690. args: [],
  59691. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  59692. referencedClasses: [],
  59693. messageSends: []
  59694. }),
  59695. $globals.BaseFileManipulator);
  59696. $core.addMethod(
  59697. $core.method({
  59698. selector: "initialize",
  59699. protocol: "initialization",
  59700. fn: function (){
  59701. var self=this,$self=this;
  59702. return $core.withContext(function($ctx1) {
  59703. (
  59704. $ctx1.supercall = true,
  59705. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  59706. $ctx1.supercall = false;
  59707. $self["@path"]=$recv(require)._value_("path");
  59708. $ctx1.sendIdx["value:"]=1;
  59709. $self["@fs"]=$recv(require)._value_("fs");
  59710. return self;
  59711. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  59712. },
  59713. args: [],
  59714. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  59715. referencedClasses: [],
  59716. messageSends: ["initialize", "value:"]
  59717. }),
  59718. $globals.BaseFileManipulator);
  59719. $core.addMethod(
  59720. $core.method({
  59721. selector: "rootDirname",
  59722. protocol: "private",
  59723. fn: function (){
  59724. var self=this,$self=this;
  59725. return $core.withContext(function($ctx1) {
  59726. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  59727. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  59728. },
  59729. args: [],
  59730. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  59731. referencedClasses: [],
  59732. messageSends: ["join:with:", "dirname"]
  59733. }),
  59734. $globals.BaseFileManipulator);
  59735. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  59736. $core.addMethod(
  59737. $core.method({
  59738. selector: "initialize",
  59739. protocol: "initialization",
  59740. fn: function (){
  59741. var self=this,$self=this;
  59742. return $core.withContext(function($ctx1) {
  59743. (
  59744. $ctx1.supercall = true,
  59745. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  59746. $ctx1.supercall = false;
  59747. return self;
  59748. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  59749. },
  59750. args: [],
  59751. source: "initialize\x0a\x09super initialize",
  59752. referencedClasses: [],
  59753. messageSends: ["initialize"]
  59754. }),
  59755. $globals.Configurator);
  59756. $core.addMethod(
  59757. $core.method({
  59758. selector: "start",
  59759. protocol: "action",
  59760. fn: function (){
  59761. var self=this,$self=this;
  59762. return $core.withContext(function($ctx1) {
  59763. var $receiver;
  59764. $self._writeConfigThenDo_((function(err){
  59765. return $core.withContext(function($ctx2) {
  59766. if(($receiver = err) == null || $receiver.a$nil){
  59767. return $recv(process)._exit();
  59768. } else {
  59769. return $recv(process)._exit_((111));
  59770. }
  59771. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  59772. }));
  59773. return self;
  59774. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  59775. },
  59776. args: [],
  59777. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  59778. referencedClasses: [],
  59779. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  59780. }),
  59781. $globals.Configurator);
  59782. $core.addMethod(
  59783. $core.method({
  59784. selector: "writeConfigThenDo:",
  59785. protocol: "action",
  59786. fn: function (aBlock){
  59787. var self=this,$self=this;
  59788. return $core.withContext(function($ctx1) {
  59789. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  59790. return self;
  59791. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  59792. },
  59793. args: ["aBlock"],
  59794. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  59795. referencedClasses: [],
  59796. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  59797. }),
  59798. $globals.Configurator);
  59799. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  59800. $globals.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.";
  59801. $core.addMethod(
  59802. $core.method({
  59803. selector: "base64Decode:",
  59804. protocol: "private",
  59805. fn: function (aString){
  59806. var self=this,$self=this;
  59807. return $core.withContext(function($ctx1) {
  59808. return (new Buffer(aString, "base64").toString());
  59809. return self;
  59810. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  59811. },
  59812. args: ["aString"],
  59813. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  59814. referencedClasses: [],
  59815. messageSends: []
  59816. }),
  59817. $globals.FileServer);
  59818. $core.addMethod(
  59819. $core.method({
  59820. selector: "basePath",
  59821. protocol: "accessing",
  59822. fn: function (){
  59823. var self=this,$self=this;
  59824. return $core.withContext(function($ctx1) {
  59825. var $1,$receiver;
  59826. $1=$self["@basePath"];
  59827. if(($receiver = $1) == null || $receiver.a$nil){
  59828. return $recv($self._class())._defaultBasePath();
  59829. } else {
  59830. return $1;
  59831. }
  59832. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  59833. },
  59834. args: [],
  59835. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  59836. referencedClasses: [],
  59837. messageSends: ["ifNil:", "defaultBasePath", "class"]
  59838. }),
  59839. $globals.FileServer);
  59840. $core.addMethod(
  59841. $core.method({
  59842. selector: "basePath:",
  59843. protocol: "accessing",
  59844. fn: function (aString){
  59845. var self=this,$self=this;
  59846. return $core.withContext(function($ctx1) {
  59847. $self["@basePath"]=aString;
  59848. $self._validateBasePath();
  59849. return self;
  59850. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  59851. },
  59852. args: ["aString"],
  59853. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  59854. referencedClasses: [],
  59855. messageSends: ["validateBasePath"]
  59856. }),
  59857. $globals.FileServer);
  59858. $core.addMethod(
  59859. $core.method({
  59860. selector: "checkDirectoryLayout",
  59861. protocol: "initialization",
  59862. fn: function (){
  59863. var self=this,$self=this;
  59864. return $core.withContext(function($ctx1) {
  59865. var $1;
  59866. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  59867. if(!$core.assert($1)){
  59868. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  59869. $ctx1.sendIdx["warn:"]=1;
  59870. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  59871. $ctx1.sendIdx["warn:"]=2;
  59872. $recv(console)._warn_(" You can also specify a page to be served by default,");
  59873. $ctx1.sendIdx["warn:"]=3;
  59874. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  59875. }
  59876. return self;
  59877. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  59878. },
  59879. args: [],
  59880. source: "checkDirectoryLayout\x0a\x09(fs existsSync:\x09(self withBasePath: 'index.html')) ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html.'.\x0a\x09\x09console warn: ' You can specify the directory containing index.html with --base-path.'.\x0a\x09\x09console warn: ' You can also specify a page to be served by default,'.\x0a\x09\x09console warn: ' for all paths that do not map to a file, with --fallback-page.'].",
  59881. referencedClasses: [],
  59882. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  59883. }),
  59884. $globals.FileServer);
  59885. $core.addMethod(
  59886. $core.method({
  59887. selector: "fallbackPage",
  59888. protocol: "accessing",
  59889. fn: function (){
  59890. var self=this,$self=this;
  59891. return $self["@fallbackPage"];
  59892. },
  59893. args: [],
  59894. source: "fallbackPage\x0a\x09^ fallbackPage",
  59895. referencedClasses: [],
  59896. messageSends: []
  59897. }),
  59898. $globals.FileServer);
  59899. $core.addMethod(
  59900. $core.method({
  59901. selector: "fallbackPage:",
  59902. protocol: "accessing",
  59903. fn: function (aString){
  59904. var self=this,$self=this;
  59905. $self["@fallbackPage"]=aString;
  59906. return self;
  59907. },
  59908. args: ["aString"],
  59909. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  59910. referencedClasses: [],
  59911. messageSends: []
  59912. }),
  59913. $globals.FileServer);
  59914. $core.addMethod(
  59915. $core.method({
  59916. selector: "handleGETRequest:respondTo:",
  59917. protocol: "request handling",
  59918. fn: function (aRequest,aResponse){
  59919. var self=this,$self=this;
  59920. var uri,filename;
  59921. return $core.withContext(function($ctx1) {
  59922. var $1;
  59923. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  59924. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  59925. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  59926. return $core.withContext(function($ctx2) {
  59927. if($core.assert(aBoolean)){
  59928. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  59929. if($core.assert($1)){
  59930. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  59931. } else {
  59932. return $self._respondFileNamed_to_(filename,aResponse);
  59933. }
  59934. } else {
  59935. return $self._respondNotFoundTo_(aResponse);
  59936. }
  59937. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  59938. }));
  59939. return self;
  59940. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  59941. },
  59942. args: ["aRequest", "aResponse"],
  59943. source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := url parse: aRequest url.\x0a\x09filename := path join: self basePath with: uri pathname.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [(fs statSync: filename) isDirectory\x0a\x09\x09\x09\x09ifTrue: [self respondDirectoryNamed: filename from: uri to: aResponse]\x0a\x09\x09\x09\x09ifFalse: [self respondFileNamed: filename to: aResponse]]]",
  59944. referencedClasses: [],
  59945. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  59946. }),
  59947. $globals.FileServer);
  59948. $core.addMethod(
  59949. $core.method({
  59950. selector: "handleOPTIONSRequest:respondTo:",
  59951. protocol: "request handling",
  59952. fn: function (aRequest,aResponse){
  59953. var self=this,$self=this;
  59954. return $core.withContext(function($ctx1) {
  59955. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Access-Control-Allow-Origin","*","Access-Control-Allow-Methods","GET, PUT, POST, DELETE, OPTIONS","Access-Control-Allow-Headers","Content-Type, Accept","Content-Length",(0),"Access-Control-Max-Age",(10)]));
  59956. $recv(aResponse)._end();
  59957. return self;
  59958. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  59959. },
  59960. args: ["aRequest", "aResponse"],
  59961. 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",
  59962. referencedClasses: [],
  59963. messageSends: ["writeHead:options:", "end"]
  59964. }),
  59965. $globals.FileServer);
  59966. $core.addMethod(
  59967. $core.method({
  59968. selector: "handlePUTRequest:respondTo:",
  59969. protocol: "request handling",
  59970. fn: function (aRequest,aResponse){
  59971. var self=this,$self=this;
  59972. var file,stream;
  59973. return $core.withContext(function($ctx1) {
  59974. var $1,$2,$3,$4;
  59975. $1=$self._isAuthenticated_(aRequest);
  59976. if(!$core.assert($1)){
  59977. $self._respondAuthenticationRequiredTo_(aResponse);
  59978. return nil;
  59979. }
  59980. file=".".__comma($recv(aRequest)._url());
  59981. $ctx1.sendIdx[","]=1;
  59982. stream=$recv($self["@fs"])._createWriteStream_(file);
  59983. $recv(stream)._on_do_("error",(function(error){
  59984. return $core.withContext(function($ctx2) {
  59985. $2=console;
  59986. $3="Error creating WriteStream for file ".__comma(file);
  59987. $ctx2.sendIdx[","]=2;
  59988. $recv($2)._warn_($3);
  59989. $ctx2.sendIdx["warn:"]=1;
  59990. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  59991. $ctx2.sendIdx["warn:"]=2;
  59992. $recv(console)._warn_(" The exact error is: ".__comma(error));
  59993. return $self._respondNotCreatedTo_(aResponse);
  59994. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  59995. }));
  59996. $ctx1.sendIdx["on:do:"]=1;
  59997. $recv(stream)._on_do_("close",(function(){
  59998. return $core.withContext(function($ctx2) {
  59999. return $self._respondCreatedTo_(aResponse);
  60000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60001. }));
  60002. $ctx1.sendIdx["on:do:"]=2;
  60003. $recv(aRequest)._setEncoding_("utf8");
  60004. $recv(aRequest)._on_do_("data",(function(data){
  60005. return $core.withContext(function($ctx2) {
  60006. return $recv(stream)._write_(data);
  60007. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  60008. }));
  60009. $ctx1.sendIdx["on:do:"]=3;
  60010. $recv(aRequest)._on_do_("end",(function(){
  60011. return $core.withContext(function($ctx2) {
  60012. $4=$recv(stream)._writable();
  60013. if($core.assert($4)){
  60014. return $recv(stream)._end();
  60015. }
  60016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  60017. }));
  60018. return self;
  60019. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  60020. },
  60021. args: ["aRequest", "aResponse"],
  60022. 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 directory in your project (often /src)?'.\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]]",
  60023. referencedClasses: [],
  60024. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  60025. }),
  60026. $globals.FileServer);
  60027. $core.addMethod(
  60028. $core.method({
  60029. selector: "handleRequest:respondTo:",
  60030. protocol: "request handling",
  60031. fn: function (aRequest,aResponse){
  60032. var self=this,$self=this;
  60033. return $core.withContext(function($ctx1) {
  60034. var $2,$1,$4,$3,$5;
  60035. $2=$recv(aRequest)._method();
  60036. $ctx1.sendIdx["method"]=1;
  60037. $1=$recv($2).__eq("PUT");
  60038. $ctx1.sendIdx["="]=1;
  60039. if($core.assert($1)){
  60040. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  60041. }
  60042. $4=$recv(aRequest)._method();
  60043. $ctx1.sendIdx["method"]=2;
  60044. $3=$recv($4).__eq("GET");
  60045. $ctx1.sendIdx["="]=2;
  60046. if($core.assert($3)){
  60047. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  60048. }
  60049. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  60050. if($core.assert($5)){
  60051. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  60052. }
  60053. return self;
  60054. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  60055. },
  60056. args: ["aRequest", "aResponse"],
  60057. 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]",
  60058. referencedClasses: [],
  60059. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  60060. }),
  60061. $globals.FileServer);
  60062. $core.addMethod(
  60063. $core.method({
  60064. selector: "host",
  60065. protocol: "accessing",
  60066. fn: function (){
  60067. var self=this,$self=this;
  60068. return $self["@host"];
  60069. },
  60070. args: [],
  60071. source: "host\x0a\x09^ host",
  60072. referencedClasses: [],
  60073. messageSends: []
  60074. }),
  60075. $globals.FileServer);
  60076. $core.addMethod(
  60077. $core.method({
  60078. selector: "host:",
  60079. protocol: "accessing",
  60080. fn: function (hostname){
  60081. var self=this,$self=this;
  60082. $self["@host"]=hostname;
  60083. return self;
  60084. },
  60085. args: ["hostname"],
  60086. source: "host: hostname\x0a\x09host := hostname",
  60087. referencedClasses: [],
  60088. messageSends: []
  60089. }),
  60090. $globals.FileServer);
  60091. $core.addMethod(
  60092. $core.method({
  60093. selector: "initialize",
  60094. protocol: "initialization",
  60095. fn: function (){
  60096. var self=this,$self=this;
  60097. return $core.withContext(function($ctx1) {
  60098. var $1;
  60099. (
  60100. $ctx1.supercall = true,
  60101. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  60102. $ctx1.supercall = false;
  60103. $self["@http"]=$self._require_("http");
  60104. $ctx1.sendIdx["require:"]=1;
  60105. $self["@util"]=$self._require_("util");
  60106. $ctx1.sendIdx["require:"]=2;
  60107. $self["@url"]=$self._require_("url");
  60108. $1=$self._class();
  60109. $ctx1.sendIdx["class"]=1;
  60110. $self["@host"]=$recv($1)._defaultHost();
  60111. $self["@port"]=$recv($self._class())._defaultPort();
  60112. $self["@username"]=nil;
  60113. $self["@password"]=nil;
  60114. $self["@fallbackPage"]=nil;
  60115. return self;
  60116. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  60117. },
  60118. args: [],
  60119. source: "initialize\x0a\x09super initialize.\x0a\x09http := self require: 'http'.\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.",
  60120. referencedClasses: [],
  60121. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  60122. }),
  60123. $globals.FileServer);
  60124. $core.addMethod(
  60125. $core.method({
  60126. selector: "isAuthenticated:",
  60127. protocol: "private",
  60128. fn: function (aRequest){
  60129. var self=this,$self=this;
  60130. var header,token,auth,parts;
  60131. return $core.withContext(function($ctx1) {
  60132. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  60133. var $early={};
  60134. try {
  60135. $2=$recv($self["@username"])._isNil();
  60136. $ctx1.sendIdx["isNil"]=1;
  60137. $1=$recv($2)._and_((function(){
  60138. return $core.withContext(function($ctx2) {
  60139. return $recv($self["@password"])._isNil();
  60140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60141. }));
  60142. $ctx1.sendIdx["and:"]=1;
  60143. if($core.assert($1)){
  60144. return true;
  60145. }
  60146. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  60147. $ctx1.sendIdx["at:"]=1;
  60148. if(($receiver = $3) == null || $receiver.a$nil){
  60149. header="";
  60150. } else {
  60151. header=$3;
  60152. }
  60153. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  60154. throw $early=[false];
  60155. }),(function(){
  60156. return $core.withContext(function($ctx2) {
  60157. $4=$recv(header)._tokenize_(" ");
  60158. $ctx2.sendIdx["tokenize:"]=1;
  60159. if(($receiver = $4) == null || $receiver.a$nil){
  60160. token="";
  60161. } else {
  60162. token=$4;
  60163. }
  60164. token;
  60165. $5=$recv(token)._at_((2));
  60166. $ctx2.sendIdx["at:"]=2;
  60167. auth=$self._base64Decode_($5);
  60168. auth;
  60169. parts=$recv(auth)._tokenize_(":");
  60170. parts;
  60171. $8=$self["@username"];
  60172. $9=$recv(parts)._at_((1));
  60173. $ctx2.sendIdx["at:"]=3;
  60174. $7=$recv($8).__eq($9);
  60175. $ctx2.sendIdx["="]=1;
  60176. $6=$recv($7)._and_((function(){
  60177. return $core.withContext(function($ctx3) {
  60178. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  60179. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  60180. }));
  60181. if($core.assert($6)){
  60182. throw $early=[true];
  60183. } else {
  60184. throw $early=[false];
  60185. }
  60186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  60187. }));
  60188. return self;
  60189. }
  60190. catch(e) {if(e===$early)return e[0]; throw e}
  60191. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  60192. },
  60193. args: ["aRequest"],
  60194. 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\x09header\x0a\x09ifEmpty: [^ false]\x0a\x09ifNotEmpty: [\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].",
  60195. referencedClasses: [],
  60196. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  60197. }),
  60198. $globals.FileServer);
  60199. $core.addMethod(
  60200. $core.method({
  60201. selector: "password:",
  60202. protocol: "accessing",
  60203. fn: function (aPassword){
  60204. var self=this,$self=this;
  60205. $self["@password"]=aPassword;
  60206. return self;
  60207. },
  60208. args: ["aPassword"],
  60209. source: "password: aPassword\x0a\x09password := aPassword.",
  60210. referencedClasses: [],
  60211. messageSends: []
  60212. }),
  60213. $globals.FileServer);
  60214. $core.addMethod(
  60215. $core.method({
  60216. selector: "port",
  60217. protocol: "accessing",
  60218. fn: function (){
  60219. var self=this,$self=this;
  60220. return $self["@port"];
  60221. },
  60222. args: [],
  60223. source: "port\x0a\x09^ port",
  60224. referencedClasses: [],
  60225. messageSends: []
  60226. }),
  60227. $globals.FileServer);
  60228. $core.addMethod(
  60229. $core.method({
  60230. selector: "port:",
  60231. protocol: "accessing",
  60232. fn: function (aNumber){
  60233. var self=this,$self=this;
  60234. $self["@port"]=aNumber;
  60235. return self;
  60236. },
  60237. args: ["aNumber"],
  60238. source: "port: aNumber\x0a\x09port := aNumber",
  60239. referencedClasses: [],
  60240. messageSends: []
  60241. }),
  60242. $globals.FileServer);
  60243. $core.addMethod(
  60244. $core.method({
  60245. selector: "require:",
  60246. protocol: "private",
  60247. fn: function (aModuleString){
  60248. var self=this,$self=this;
  60249. return $core.withContext(function($ctx1) {
  60250. return $recv(require)._value_(aModuleString);
  60251. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  60252. },
  60253. args: ["aModuleString"],
  60254. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  60255. referencedClasses: [],
  60256. messageSends: ["value:"]
  60257. }),
  60258. $globals.FileServer);
  60259. $core.addMethod(
  60260. $core.method({
  60261. selector: "respondAuthenticationRequiredTo:",
  60262. protocol: "request handling",
  60263. fn: function (aResponse){
  60264. var self=this,$self=this;
  60265. return $core.withContext(function($ctx1) {
  60266. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  60267. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  60268. $recv(aResponse)._end();
  60269. return self;
  60270. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  60271. },
  60272. args: ["aResponse"],
  60273. 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.",
  60274. referencedClasses: [],
  60275. messageSends: ["writeHead:options:", "write:", "end"]
  60276. }),
  60277. $globals.FileServer);
  60278. $core.addMethod(
  60279. $core.method({
  60280. selector: "respondCreatedTo:",
  60281. protocol: "request handling",
  60282. fn: function (aResponse){
  60283. var self=this,$self=this;
  60284. return $core.withContext(function($ctx1) {
  60285. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  60286. $recv(aResponse)._end();
  60287. return self;
  60288. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  60289. },
  60290. args: ["aResponse"],
  60291. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  60292. referencedClasses: [],
  60293. messageSends: ["writeHead:options:", "end"]
  60294. }),
  60295. $globals.FileServer);
  60296. $core.addMethod(
  60297. $core.method({
  60298. selector: "respondDirectoryNamed:from:to:",
  60299. protocol: "request handling",
  60300. fn: function (aDirname,aUrl,aResponse){
  60301. var self=this,$self=this;
  60302. return $core.withContext(function($ctx1) {
  60303. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  60304. $2=$recv(aUrl)._pathname();
  60305. $ctx1.sendIdx["pathname"]=1;
  60306. $1=$recv($2)._endsWith_("/");
  60307. if($core.assert($1)){
  60308. $3=$recv(aDirname).__comma("index.html");
  60309. $ctx1.sendIdx[","]=1;
  60310. $self._respondFileNamed_to_($3,aResponse);
  60311. } else {
  60312. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  60313. $7=$recv(aUrl)._search();
  60314. if(($receiver = $7) == null || $receiver.a$nil){
  60315. $6="";
  60316. } else {
  60317. $6=$7;
  60318. }
  60319. $4=$recv($5).__comma($6);
  60320. $ctx1.sendIdx[","]=2;
  60321. $self._respondRedirect_to_($4,aResponse);
  60322. }
  60323. return self;
  60324. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  60325. },
  60326. args: ["aDirname", "aUrl", "aResponse"],
  60327. source: "respondDirectoryNamed: aDirname from: aUrl to: aResponse\x0a\x09(aUrl pathname endsWith: '/')\x0a\x09\x09ifTrue: [self respondFileNamed: aDirname, 'index.html' to: aResponse]\x0a\x09\x09ifFalse: [self respondRedirect: aUrl pathname, '/', (aUrl search ifNil: ['']) to: aResponse]",
  60328. referencedClasses: [],
  60329. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  60330. }),
  60331. $globals.FileServer);
  60332. $core.addMethod(
  60333. $core.method({
  60334. selector: "respondFileNamed:to:",
  60335. protocol: "request handling",
  60336. fn: function (aFilename,aResponse){
  60337. var self=this,$self=this;
  60338. var type,filename;
  60339. return $core.withContext(function($ctx1) {
  60340. var $1,$2,$3,$4;
  60341. filename=aFilename;
  60342. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  60343. return $core.withContext(function($ctx2) {
  60344. $1=$recv(ex)._notNil();
  60345. if($core.assert($1)){
  60346. $2=console;
  60347. $3=$recv(filename).__comma(" does not exist");
  60348. $ctx2.sendIdx[","]=1;
  60349. $recv($2)._log_($3);
  60350. return $self._respondNotFoundTo_(aResponse);
  60351. } else {
  60352. type=$recv($self._class())._mimeTypeFor_(filename);
  60353. type;
  60354. $4=$recv(type).__eq("application/javascript");
  60355. if($core.assert($4)){
  60356. type=$recv(type).__comma(";charset=utf-8");
  60357. type;
  60358. }
  60359. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  60360. $recv(aResponse)._write_encoding_(file,"binary");
  60361. return $recv(aResponse)._end();
  60362. }
  60363. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  60364. }));
  60365. return self;
  60366. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  60367. },
  60368. args: ["aFilename", "aResponse"],
  60369. source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\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 respondNotFoundTo: 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]]",
  60370. referencedClasses: [],
  60371. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  60372. }),
  60373. $globals.FileServer);
  60374. $core.addMethod(
  60375. $core.method({
  60376. selector: "respondInternalErrorTo:",
  60377. protocol: "request handling",
  60378. fn: function (aResponse){
  60379. var self=this,$self=this;
  60380. return $core.withContext(function($ctx1) {
  60381. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  60382. $recv(aResponse)._write_("500 Internal server error");
  60383. $recv(aResponse)._end();
  60384. return self;
  60385. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  60386. },
  60387. args: ["aResponse"],
  60388. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  60389. referencedClasses: [],
  60390. messageSends: ["writeHead:options:", "write:", "end"]
  60391. }),
  60392. $globals.FileServer);
  60393. $core.addMethod(
  60394. $core.method({
  60395. selector: "respondNotCreatedTo:",
  60396. protocol: "request handling",
  60397. fn: function (aResponse){
  60398. var self=this,$self=this;
  60399. return $core.withContext(function($ctx1) {
  60400. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  60401. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  60402. $recv(aResponse)._end();
  60403. return self;
  60404. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  60405. },
  60406. args: ["aResponse"],
  60407. 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 src directory on the server?';\x0a\x09\x09end.",
  60408. referencedClasses: [],
  60409. messageSends: ["writeHead:options:", "write:", "end"]
  60410. }),
  60411. $globals.FileServer);
  60412. $core.addMethod(
  60413. $core.method({
  60414. selector: "respondNotFoundTo:",
  60415. protocol: "request handling",
  60416. fn: function (aResponse){
  60417. var self=this,$self=this;
  60418. return $core.withContext(function($ctx1) {
  60419. var $2,$1;
  60420. $2=$self._fallbackPage();
  60421. $ctx1.sendIdx["fallbackPage"]=1;
  60422. $1=$recv($2)._isNil();
  60423. if(!$core.assert($1)){
  60424. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  60425. }
  60426. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  60427. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  60428. $ctx1.sendIdx["write:"]=1;
  60429. $recv(aResponse)._write_("<p>Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:<ul>");
  60430. $ctx1.sendIdx["write:"]=2;
  60431. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  60432. $ctx1.sendIdx["write:"]=3;
  60433. $recv(aResponse)._write_("<li>can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.</li>");
  60434. $ctx1.sendIdx["write:"]=4;
  60435. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  60436. $ctx1.sendIdx["write:"]=5;
  60437. $recv(aResponse)._write_("</ul></p></body></html>");
  60438. $recv(aResponse)._end();
  60439. return self;
  60440. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  60441. },
  60442. args: ["aResponse"],
  60443. source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/html'};\x0a\x09\x09write: '<html><body><p>404 Not found</p>';\x0a\x09\x09write: '<p>Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:<ul>';\x0a\x09\x09write: '<li>create an index.html in the served directory.</li>';\x0a\x09\x09write: '<li>can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.</li>';\x0a\x09\x09write: '<li>change the directory to be served with the \x22--base-path\x22 option.</li>';\x0a\x09\x09write: '</ul></p></body></html>';\x0a\x09\x09end",
  60444. referencedClasses: [],
  60445. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  60446. }),
  60447. $globals.FileServer);
  60448. $core.addMethod(
  60449. $core.method({
  60450. selector: "respondOKTo:",
  60451. protocol: "request handling",
  60452. fn: function (aResponse){
  60453. var self=this,$self=this;
  60454. return $core.withContext(function($ctx1) {
  60455. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  60456. $recv(aResponse)._end();
  60457. return self;
  60458. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  60459. },
  60460. args: ["aResponse"],
  60461. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  60462. referencedClasses: [],
  60463. messageSends: ["writeHead:options:", "end"]
  60464. }),
  60465. $globals.FileServer);
  60466. $core.addMethod(
  60467. $core.method({
  60468. selector: "respondRedirect:to:",
  60469. protocol: "request handling",
  60470. fn: function (aString,aResponse){
  60471. var self=this,$self=this;
  60472. return $core.withContext(function($ctx1) {
  60473. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  60474. $recv(aResponse)._end();
  60475. return self;
  60476. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  60477. },
  60478. args: ["aString", "aResponse"],
  60479. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  60480. referencedClasses: [],
  60481. messageSends: ["writeHead:options:", "end"]
  60482. }),
  60483. $globals.FileServer);
  60484. $core.addMethod(
  60485. $core.method({
  60486. selector: "start",
  60487. protocol: "starting",
  60488. fn: function (){
  60489. var self=this,$self=this;
  60490. return $core.withContext(function($ctx1) {
  60491. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  60492. $self._checkDirectoryLayout();
  60493. $1=$recv($self["@http"])._createServer_((function(request,response){
  60494. return $core.withContext(function($ctx2) {
  60495. return $self._handleRequest_respondTo_(request,response);
  60496. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  60497. }));
  60498. $recv($1)._on_do_("error",(function(error){
  60499. return $core.withContext(function($ctx2) {
  60500. $2=console;
  60501. $3="Error starting server: ".__comma(error);
  60502. $ctx2.sendIdx[","]=1;
  60503. return $recv($2)._log_($3);
  60504. $ctx2.sendIdx["log:"]=1;
  60505. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  60506. }));
  60507. $ctx1.sendIdx["on:do:"]=1;
  60508. $recv($1)._on_do_("listening",(function(){
  60509. return $core.withContext(function($ctx2) {
  60510. $4=console;
  60511. $8=$self._host();
  60512. $ctx2.sendIdx["host"]=1;
  60513. $7="Starting file server on http://".__comma($8);
  60514. $6=$recv($7).__comma(":");
  60515. $ctx2.sendIdx[","]=3;
  60516. $10=$self._port();
  60517. $ctx2.sendIdx["port"]=1;
  60518. $9=$recv($10)._asString();
  60519. $5=$recv($6).__comma($9);
  60520. $ctx2.sendIdx[","]=2;
  60521. return $recv($4)._log_($5);
  60522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60523. }));
  60524. $recv($1)._listen_host_($self._port(),$self._host());
  60525. return self;
  60526. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  60527. },
  60528. args: [],
  60529. 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.",
  60530. referencedClasses: [],
  60531. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  60532. }),
  60533. $globals.FileServer);
  60534. $core.addMethod(
  60535. $core.method({
  60536. selector: "startOn:",
  60537. protocol: "starting",
  60538. fn: function (aPort){
  60539. var self=this,$self=this;
  60540. return $core.withContext(function($ctx1) {
  60541. $self._port_(aPort);
  60542. $self._start();
  60543. return self;
  60544. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  60545. },
  60546. args: ["aPort"],
  60547. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  60548. referencedClasses: [],
  60549. messageSends: ["port:", "start"]
  60550. }),
  60551. $globals.FileServer);
  60552. $core.addMethod(
  60553. $core.method({
  60554. selector: "username:",
  60555. protocol: "accessing",
  60556. fn: function (aUsername){
  60557. var self=this,$self=this;
  60558. $self["@username"]=aUsername;
  60559. return self;
  60560. },
  60561. args: ["aUsername"],
  60562. source: "username: aUsername\x0a\x09username := aUsername.",
  60563. referencedClasses: [],
  60564. messageSends: []
  60565. }),
  60566. $globals.FileServer);
  60567. $core.addMethod(
  60568. $core.method({
  60569. selector: "validateBasePath",
  60570. protocol: "private",
  60571. fn: function (){
  60572. var self=this,$self=this;
  60573. return $core.withContext(function($ctx1) {
  60574. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  60575. $1=$self["@fs"];
  60576. $2=$self._basePath();
  60577. $ctx1.sendIdx["basePath"]=1;
  60578. $recv($1)._stat_then_($2,(function(err,stat){
  60579. return $core.withContext(function($ctx2) {
  60580. if(($receiver = err) == null || $receiver.a$nil){
  60581. $3=$recv(stat)._isDirectory();
  60582. if(!$core.assert($3)){
  60583. $4=console;
  60584. $7=$self._basePath();
  60585. $ctx2.sendIdx["basePath"]=2;
  60586. $6="Warning: --base-path parameter ".__comma($7);
  60587. $ctx2.sendIdx[","]=2;
  60588. $5=$recv($6).__comma(" is not a directory.");
  60589. $ctx2.sendIdx[","]=1;
  60590. return $recv($4)._warn_($5);
  60591. $ctx2.sendIdx["warn:"]=1;
  60592. }
  60593. } else {
  60594. $8=console;
  60595. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  60596. $ctx2.sendIdx[","]=3;
  60597. return $recv($8)._warn_($9);
  60598. }
  60599. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  60600. }));
  60601. return self;
  60602. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  60603. },
  60604. args: [],
  60605. source: "validateBasePath\x0a\x09\x22The basePath must be an existing directory. \x22\x0a\x09fs stat: self basePath then: [ :err :stat | err\x0a\x09\x09ifNil: [ stat isDirectory ifFalse: [ console warn: 'Warning: --base-path parameter ' , self basePath , ' is not a directory.' ]]\x0a\x09\x09ifNotNil: [ console warn: 'Warning: path at --base-path parameter ' , self basePath , ' does not exist.' ]].",
  60606. referencedClasses: [],
  60607. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  60608. }),
  60609. $globals.FileServer);
  60610. $core.addMethod(
  60611. $core.method({
  60612. selector: "withBasePath:",
  60613. protocol: "private",
  60614. fn: function (aBaseRelativePath){
  60615. var self=this,$self=this;
  60616. return $core.withContext(function($ctx1) {
  60617. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  60618. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  60619. },
  60620. args: ["aBaseRelativePath"],
  60621. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  60622. referencedClasses: [],
  60623. messageSends: ["join:with:", "basePath"]
  60624. }),
  60625. $globals.FileServer);
  60626. $core.addMethod(
  60627. $core.method({
  60628. selector: "writeData:toFileNamed:",
  60629. protocol: "private",
  60630. fn: function (data,aFilename){
  60631. var self=this,$self=this;
  60632. return $core.withContext(function($ctx1) {
  60633. $recv(console)._log_(aFilename);
  60634. return self;
  60635. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  60636. },
  60637. args: ["data", "aFilename"],
  60638. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  60639. referencedClasses: [],
  60640. messageSends: ["log:"]
  60641. }),
  60642. $globals.FileServer);
  60643. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  60644. $core.addMethod(
  60645. $core.method({
  60646. selector: "commandLineSwitches",
  60647. protocol: "accessing",
  60648. fn: function (){
  60649. var self=this,$self=this;
  60650. var switches;
  60651. return $core.withContext(function($ctx1) {
  60652. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  60653. return $core.withContext(function($ctx2) {
  60654. return $recv(each)._selector();
  60655. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60656. }));
  60657. $ctx1.sendIdx["collect:"]=1;
  60658. switches=$recv(switches)._select_((function(each){
  60659. return $core.withContext(function($ctx2) {
  60660. return $recv(each)._match_("^[^:]*:$");
  60661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  60662. }));
  60663. switches=$recv(switches)._collect_((function(each){
  60664. return $core.withContext(function($ctx2) {
  60665. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  60666. $ctx2.sendIdx["replace:with:"]=1;
  60667. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  60668. }));
  60669. return switches;
  60670. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  60671. },
  60672. args: [],
  60673. 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",
  60674. referencedClasses: [],
  60675. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  60676. }),
  60677. $globals.FileServer.a$cls);
  60678. $core.addMethod(
  60679. $core.method({
  60680. selector: "createServerWithArguments:",
  60681. protocol: "initialization",
  60682. fn: function (options){
  60683. var self=this,$self=this;
  60684. var server,popFront,front,optionName,optionValue,switches;
  60685. return $core.withContext(function($ctx1) {
  60686. var $1,$2,$3,$4,$5,$6,$7,$8;
  60687. var $early={};
  60688. try {
  60689. switches=$self._commandLineSwitches();
  60690. server=$self._new();
  60691. $recv(options)._ifEmpty_((function(){
  60692. throw $early=[server];
  60693. }));
  60694. $1=$recv($recv(options)._size())._even();
  60695. if(!$core.assert($1)){
  60696. $recv(console)._log_("Using default parameters.");
  60697. $ctx1.sendIdx["log:"]=1;
  60698. $2=console;
  60699. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  60700. $ctx1.sendIdx[","]=1;
  60701. $recv($2)._log_($3);
  60702. $ctx1.sendIdx["log:"]=2;
  60703. $4=console;
  60704. $5="Use any of the following ones: ".__comma(switches);
  60705. $ctx1.sendIdx[","]=2;
  60706. $recv($4)._log_($5);
  60707. $ctx1.sendIdx["log:"]=3;
  60708. return server;
  60709. }
  60710. popFront=(function(args){
  60711. return $core.withContext(function($ctx2) {
  60712. front=$recv(args)._first();
  60713. front;
  60714. $recv(args)._remove_(front);
  60715. return front;
  60716. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  60717. });
  60718. $recv((function(){
  60719. return $core.withContext(function($ctx2) {
  60720. return $recv(options)._notEmpty();
  60721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  60722. }))._whileTrue_((function(){
  60723. return $core.withContext(function($ctx2) {
  60724. optionName=$recv(popFront)._value_(options);
  60725. $ctx2.sendIdx["value:"]=1;
  60726. optionName;
  60727. optionValue=$recv(popFront)._value_(options);
  60728. optionValue;
  60729. $6=$recv(switches)._includes_(optionName);
  60730. if($core.assert($6)){
  60731. optionName=$self._selectorForCommandLineSwitch_(optionName);
  60732. optionName;
  60733. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  60734. } else {
  60735. $7=console;
  60736. $8=$recv(optionName).__comma(" is not a valid commandline option");
  60737. $ctx2.sendIdx[","]=3;
  60738. $recv($7)._log_($8);
  60739. $ctx2.sendIdx["log:"]=4;
  60740. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  60741. }
  60742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  60743. }));
  60744. return server;
  60745. }
  60746. catch(e) {if(e===$early)return e[0]; throw e}
  60747. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  60748. },
  60749. args: ["options"],
  60750. 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.",
  60751. referencedClasses: ["Array"],
  60752. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  60753. }),
  60754. $globals.FileServer.a$cls);
  60755. $core.addMethod(
  60756. $core.method({
  60757. selector: "defaultBasePath",
  60758. protocol: "accessing",
  60759. fn: function (){
  60760. var self=this,$self=this;
  60761. return "./";
  60762. },
  60763. args: [],
  60764. source: "defaultBasePath\x0a\x09^ './'",
  60765. referencedClasses: [],
  60766. messageSends: []
  60767. }),
  60768. $globals.FileServer.a$cls);
  60769. $core.addMethod(
  60770. $core.method({
  60771. selector: "defaultHost",
  60772. protocol: "accessing",
  60773. fn: function (){
  60774. var self=this,$self=this;
  60775. return "127.0.0.1";
  60776. },
  60777. args: [],
  60778. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  60779. referencedClasses: [],
  60780. messageSends: []
  60781. }),
  60782. $globals.FileServer.a$cls);
  60783. $core.addMethod(
  60784. $core.method({
  60785. selector: "defaultMimeTypes",
  60786. protocol: "accessing",
  60787. fn: function (){
  60788. var self=this,$self=this;
  60789. return $globals.HashedCollection._newFromPairs_(["%","application/x-trash","323","text/h323","abw","application/x-abiword","ai","application/postscript","aif","audio/x-aiff","aifc","audio/x-aiff","aiff","audio/x-aiff","alc","chemical/x-alchemy","art","image/x-jg","asc","text/plain","asf","video/x-ms-asf","asn","chemical/x-ncbi-asn1-spec","aso","chemical/x-ncbi-asn1-binary","asx","video/x-ms-asf","au","audio/basic","avi","video/x-msvideo","b","chemical/x-molconn-Z","bak","application/x-trash","bat","application/x-msdos-program","bcpio","application/x-bcpio","bib","text/x-bibtex","bin","application/octet-stream","bmp","image/x-ms-bmp","book","application/x-maker","bsd","chemical/x-crossfire","c","text/x-csrc","c++","text/x-c++src","c3d","chemical/x-chem3d","cac","chemical/x-cache","cache","chemical/x-cache","cascii","chemical/x-cactvs-binary","cat","application/vnd.ms-pki.seccat","cbin","chemical/x-cactvs-binary","cc","text/x-c++src","cdf","application/x-cdf","cdr","image/x-coreldraw","cdt","image/x-coreldrawtemplate","cdx","chemical/x-cdx","cdy","application/vnd.cinderella","cef","chemical/x-cxf","cer","chemical/x-cerius","chm","chemical/x-chemdraw","chrt","application/x-kchart","cif","chemical/x-cif","class","application/java-vm","cls","text/x-tex","cmdf","chemical/x-cmdf","cml","chemical/x-cml","cod","application/vnd.rim.cod","com","application/x-msdos-program","cpa","chemical/x-compass","cpio","application/x-cpio","cpp","text/x-c++src","cpt","image/x-corelphotopaint","crl","application/x-pkcs7-crl","crt","application/x-x509-ca-cert","csf","chemical/x-cache-csf","csh","text/x-csh","csm","chemical/x-csml","csml","chemical/x-csml","css","text/css","csv","text/comma-separated-values","ctab","chemical/x-cactvs-binary","ctx","chemical/x-ctx","cu","application/cu-seeme","cub","chemical/x-gaussian-cube","cxf","chemical/x-cxf","cxx","text/x-c++src","dat","chemical/x-mopac-input","dcr","application/x-director","deb","application/x-debian-package","dif","video/dv","diff","text/plain","dir","application/x-director","djv","image/vnd.djvu","djvu","image/vnd.djvu","dl","video/dl","dll","application/x-msdos-program","dmg","application/x-apple-diskimage","dms","application/x-dms","doc","application/msword","dot","application/msword","dv","video/dv","dvi","application/x-dvi","dx","chemical/x-jcamp-dx","dxr","application/x-director","emb","chemical/x-embl-dl-nucleotide","embl","chemical/x-embl-dl-nucleotide","ent","chemical/x-pdb","eps","application/postscript","etx","text/x-setext","exe","application/x-msdos-program","ez","application/andrew-inset","fb","application/x-maker","fbdoc","application/x-maker","fch","chemical/x-gaussian-checkpoint","fchk","chemical/x-gaussian-checkpoint","fig","application/x-xfig","flac","application/x-flac","fli","video/fli","fm","application/x-maker","frame","application/x-maker","frm","application/x-maker","gal","chemical/x-gaussian-log","gam","chemical/x-gamess-input","gamin","chemical/x-gamess-input","gau","chemical/x-gaussian-input","gcd","text/x-pcs-gcd","gcf","application/x-graphing-calculator","gcg","chemical/x-gcg8-sequence","gen","chemical/x-genbank","gf","application/x-tex-gf","gif","image/gif","gjc","chemical/x-gaussian-input","gjf","chemical/x-gaussian-input","gl","video/gl","gnumeric","application/x-gnumeric","gpt","chemical/x-mopac-graph","gsf","application/x-font","gsm","audio/x-gsm","gtar","application/x-gtar","h","text/x-chdr","h++","text/x-c++hdr","hdf","application/x-hdf","hh","text/x-c++hdr","hin","chemical/x-hin","hpp","text/x-c++hdr","hqx","application/mac-binhex40","hs","text/x-haskell","hta","application/hta","htc","text/x-component","htm","text/html","html","text/html","hxx","text/x-c++hdr","ica","application/x-ica","ice","x-conference/x-cooltalk","ico","image/x-icon","ics","text/calendar","icz","text/calendar","ief","image/ief","iges","model/iges","igs","model/iges","iii","application/x-iphone","inp","chemical/x-gamess-input","ins","application/x-internet-signup","iso","application/x-iso9660-image","isp","application/x-internet-signup","ist","chemical/x-isostar","istr","chemical/x-isostar","jad","text/vnd.sun.j2me.app-descriptor","jar","application/java-archive","java","text/x-java","jdx","chemical/x-jcamp-dx","jmz","application/x-jmol","jng","image/x-jng","jnlp","application/x-java-jnlp-file","jpe","image/jpeg","jpeg","image/jpeg","jpg","image/jpeg","js","application/javascript","kar","audio/midi","key","application/pgp-keys","kil","application/x-killustrator","kin","chemical/x-kinemage","kpr","application/x-kpresenter","kpt","application/x-kpresenter","ksp","application/x-kspread","kwd","application/x-kword","kwt","application/x-kword","latex","application/x-latex","lha","application/x-lha","lhs","text/x-literate-haskell","lsf","video/x-la-asf","lsx","video/x-la-asf","ltx","text/x-tex","lzh","application/x-lzh","lzx","application/x-lzx","m3u","audio/x-mpegurl","m4a","audio/mpeg","maker","application/x-maker","man","application/x-troff-man","mcif","chemical/x-mmcif","mcm","chemical/x-macmolecule","mdb","application/msaccess","me","application/x-troff-me","mesh","model/mesh","mid","audio/midi","midi","audio/midi","mif","application/x-mif","mm","application/x-freemind","mmd","chemical/x-macromodel-input","mmf","application/vnd.smaf","mml","text/mathml","mmod","chemical/x-macromodel-input","mng","video/x-mng","moc","text/x-moc","mol","chemical/x-mdl-molfile","mol2","chemical/x-mol2","moo","chemical/x-mopac-out","mop","chemical/x-mopac-input","mopcrt","chemical/x-mopac-input","mov","video/quicktime","movie","video/x-sgi-movie","mp2","audio/mpeg","mp3","audio/mpeg","mp4","video/mp4","mpc","chemical/x-mopac-input","mpe","video/mpeg","mpeg","video/mpeg","mpega","audio/mpeg","mpg","video/mpeg","mpga","audio/mpeg","ms","application/x-troff-ms","msh","model/mesh","msi","application/x-msi","mvb","chemical/x-mopac-vib","mxu","video/vnd.mpegurl","nb","application/mathematica","nc","application/x-netcdf","nwc","application/x-nwc","o","application/x-object","oda","application/oda","odb","application/vnd.oasis.opendocument.database","odc","application/vnd.oasis.opendocument.chart","odf","application/vnd.oasis.opendocument.formula","odg","application/vnd.oasis.opendocument.graphics","odi","application/vnd.oasis.opendocument.image","odm","application/vnd.oasis.opendocument.text-master","odp","application/vnd.oasis.opendocument.presentation","ods","application/vnd.oasis.opendocument.spreadsheet","odt","application/vnd.oasis.opendocument.text","ogg","application/ogg","old","application/x-trash","oth","application/vnd.oasis.opendocument.text-web","oza","application/x-oz-application","p","text/x-pascal","p7r","application/x-pkcs7-certreqresp","pac","application/x-ns-proxy-autoconfig","pas","text/x-pascal","pat","image/x-coreldrawpattern","pbm","image/x-portable-bitmap","pcf","application/x-font","pcf.Z","application/x-font","pcx","image/pcx","pdb","chemical/x-pdb","pdf","application/pdf","pfa","application/x-font","pfb","application/x-font","pgm","image/x-portable-graymap","pgn","application/x-chess-pgn","pgp","application/pgp-signature","pk","application/x-tex-pk","pl","text/x-perl","pls","audio/x-scpls","pm","text/x-perl","png","image/png","pnm","image/x-portable-anymap","pot","text/plain","ppm","image/x-portable-pixmap","pps","application/vnd.ms-powerpoint","ppt","application/vnd.ms-powerpoint","prf","application/pics-rules","prt","chemical/x-ncbi-asn1-ascii","ps","application/postscript","psd","image/x-photoshop","psp","text/x-psp","py","text/x-python","pyc","application/x-python-code","pyo","application/x-python-code","qt","video/quicktime","qtl","application/x-quicktimeplayer","ra","audio/x-realaudio","ram","audio/x-pn-realaudio","rar","application/rar","ras","image/x-cmu-raster","rd","chemical/x-mdl-rdfile","rdf","application/rdf+xml","rgb","image/x-rgb","rm","audio/x-pn-realaudio","roff","application/x-troff","ros","chemical/x-rosdal","rpm","application/x-redhat-package-manager","rss","application/rss+xml","rtf","text/rtf","rtx","text/richtext","rxn","chemical/x-mdl-rxnfile","sct","text/scriptlet","sd","chemical/x-mdl-sdfile","sd2","audio/x-sd2","sda","application/vnd.stardivision.draw","sdc","application/vnd.stardivision.calc","sdd","application/vnd.stardivision.impress","sdf","chemical/x-mdl-sdfile","sdp","application/vnd.stardivision.impress","sdw","application/vnd.stardivision.writer","ser","application/java-serialized-object","sgf","application/x-go-sgf","sgl","application/vnd.stardivision.writer-global","sh","text/x-sh","shar","application/x-shar","shtml","text/html","sid","audio/prs.sid","sik","application/x-trash","silo","model/mesh","sis","application/vnd.symbian.install","sit","application/x-stuffit","skd","application/x-koan","skm","application/x-koan","skp","application/x-koan","skt","application/x-koan","smf","application/vnd.stardivision.math","smi","application/smil","smil","application/smil","snd","audio/basic","spc","chemical/x-galactic-spc","spl","application/x-futuresplash","src","application/x-wais-source","stc","application/vnd.sun.xml.calc.template","std","application/vnd.sun.xml.draw.template","sti","application/vnd.sun.xml.impress.template","stl","application/vnd.ms-pki.stl","stw","application/vnd.sun.xml.writer.template","sty","text/x-tex","sv4cpio","application/x-sv4cpio","sv4crc","application/x-sv4crc","svg","image/svg+xml","svgz","image/svg+xml","sw","chemical/x-swissprot","swf","application/x-shockwave-flash","swfl","application/x-shockwave-flash","sxc","application/vnd.sun.xml.calc","sxd","application/vnd.sun.xml.draw","sxg","application/vnd.sun.xml.writer.global","sxi","application/vnd.sun.xml.impress","sxm","application/vnd.sun.xml.math","sxw","application/vnd.sun.xml.writer","t","application/x-troff","tar","application/x-tar","taz","application/x-gtar","tcl","text/x-tcl","tex","text/x-tex","texi","application/x-texinfo","texinfo","application/x-texinfo","text","text/plain","tgf","chemical/x-mdl-tgf","tgz","application/x-gtar","tif","image/tiff","tiff","image/tiff","tk","text/x-tcl","tm","text/texmacs","torrent","application/x-bittorrent","tr","application/x-troff","ts","text/texmacs","tsp","application/dsptype","tsv","text/tab-separated-values","txt","text/plain","udeb","application/x-debian-package","uls","text/iuls","ustar","application/x-ustar","val","chemical/x-ncbi-asn1-binary","vcd","application/x-cdlink","vcf","text/x-vcard","vcs","text/x-vcalendar","vmd","chemical/x-vmd","vms","chemical/x-vamas-iso14976","vor","application/vnd.stardivision.writer","vrm","x-world/x-vrml","vrml","x-world/x-vrml","vsd","application/vnd.visio","wad","application/x-doom","wav","audio/x-wav","wax","audio/x-ms-wax","wbmp","image/vnd.wap.wbmp","wbxml","application/vnd.wap.wbxml","wk","application/x-123","wm","video/x-ms-wm","wma","audio/x-ms-wma","wmd","application/x-ms-wmd","wml","text/vnd.wap.wml","wmlc","application/vnd.wap.wmlc","wmls","text/vnd.wap.wmlscript","wmlsc","application/vnd.wap.wmlscriptc","wmv","video/x-ms-wmv","wmx","video/x-ms-wmx","wmz","application/x-ms-wmz","wp5","application/wordperfect5.1","wpd","application/wordperfect","wrl","x-world/x-vrml","wsc","text/scriptlet","wvx","video/x-ms-wvx","wz","application/x-wingz","xbm","image/x-xbitmap","xcf","application/x-xcf","xht","application/xhtml+xml","xhtml","application/xhtml+xml","xlb","application/vnd.ms-excel","xls","application/vnd.ms-excel","xlt","application/vnd.ms-excel","xml","application/xml","xpi","application/x-xpinstall","xpm","image/x-xpixmap","xsl","application/xml","xtel","chemical/x-xtel","xul","application/vnd.mozilla.xul+xml","xwd","image/x-xwindowdump","xyz","chemical/x-xyz","zip","application/zip","zmt","chemical/x-mopac-input","~","application/x-trash"]);
  60790. },
  60791. args: [],
  60792. 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}",
  60793. referencedClasses: [],
  60794. messageSends: []
  60795. }),
  60796. $globals.FileServer.a$cls);
  60797. $core.addMethod(
  60798. $core.method({
  60799. selector: "defaultPort",
  60800. protocol: "accessing",
  60801. fn: function (){
  60802. var self=this,$self=this;
  60803. return (4000);
  60804. },
  60805. args: [],
  60806. source: "defaultPort\x0a\x09^ 4000",
  60807. referencedClasses: [],
  60808. messageSends: []
  60809. }),
  60810. $globals.FileServer.a$cls);
  60811. $core.addMethod(
  60812. $core.method({
  60813. selector: "main",
  60814. protocol: "initialization",
  60815. fn: function (){
  60816. var self=this,$self=this;
  60817. var fileServer,args;
  60818. return $core.withContext(function($ctx1) {
  60819. var $1;
  60820. var $early={};
  60821. try {
  60822. args=$recv(process)._argv();
  60823. $recv(args)._removeFrom_to_((1),(3));
  60824. $recv(args)._detect_ifNone_((function(each){
  60825. return $core.withContext(function($ctx2) {
  60826. $1=$recv(each).__eq("--help");
  60827. if($core.assert($1)){
  60828. return $recv($globals.FileServer)._printHelp();
  60829. }
  60830. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60831. }),(function(){
  60832. return $core.withContext(function($ctx2) {
  60833. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  60834. fileServer;
  60835. throw $early=[$recv(fileServer)._start()];
  60836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60837. }));
  60838. return self;
  60839. }
  60840. catch(e) {if(e===$early)return e[0]; throw e}
  60841. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  60842. },
  60843. args: [],
  60844. 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]",
  60845. referencedClasses: ["FileServer"],
  60846. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  60847. }),
  60848. $globals.FileServer.a$cls);
  60849. $core.addMethod(
  60850. $core.method({
  60851. selector: "mimeTypeFor:",
  60852. protocol: "accessing",
  60853. fn: function (aString){
  60854. var self=this,$self=this;
  60855. return $core.withContext(function($ctx1) {
  60856. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  60857. return "text/plain";
  60858. }));
  60859. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  60860. },
  60861. args: ["aString"],
  60862. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  60863. referencedClasses: [],
  60864. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  60865. }),
  60866. $globals.FileServer.a$cls);
  60867. $core.addMethod(
  60868. $core.method({
  60869. selector: "mimeTypes",
  60870. protocol: "accessing",
  60871. fn: function (){
  60872. var self=this,$self=this;
  60873. return $core.withContext(function($ctx1) {
  60874. var $1,$receiver;
  60875. $1=$self["@mimeTypes"];
  60876. if(($receiver = $1) == null || $receiver.a$nil){
  60877. $self["@mimeTypes"]=$self._defaultMimeTypes();
  60878. return $self["@mimeTypes"];
  60879. } else {
  60880. return $1;
  60881. }
  60882. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  60883. },
  60884. args: [],
  60885. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  60886. referencedClasses: [],
  60887. messageSends: ["ifNil:", "defaultMimeTypes"]
  60888. }),
  60889. $globals.FileServer.a$cls);
  60890. $core.addMethod(
  60891. $core.method({
  60892. selector: "printHelp",
  60893. protocol: "accessing",
  60894. fn: function (){
  60895. var self=this,$self=this;
  60896. return $core.withContext(function($ctx1) {
  60897. $recv(console)._log_("Available commandline options are:");
  60898. $ctx1.sendIdx["log:"]=1;
  60899. $recv(console)._log_("--help");
  60900. $ctx1.sendIdx["log:"]=2;
  60901. $recv($self._commandLineSwitches())._do_((function(each){
  60902. return $core.withContext(function($ctx2) {
  60903. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  60904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60905. }));
  60906. return self;
  60907. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  60908. },
  60909. args: [],
  60910. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  60911. referencedClasses: [],
  60912. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  60913. }),
  60914. $globals.FileServer.a$cls);
  60915. $core.addMethod(
  60916. $core.method({
  60917. selector: "selectorForCommandLineSwitch:",
  60918. protocol: "accessing",
  60919. fn: function (aSwitch){
  60920. var self=this,$self=this;
  60921. return $core.withContext(function($ctx1) {
  60922. var $1;
  60923. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  60924. return $core.withContext(function($ctx2) {
  60925. return $recv($recv(each)._second())._asUppercase();
  60926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60927. }));
  60928. $ctx1.sendIdx["replace:with:"]=1;
  60929. return $recv($1).__comma(":");
  60930. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  60931. },
  60932. args: ["aSwitch"],
  60933. 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 ]), ':'",
  60934. referencedClasses: [],
  60935. messageSends: [",", "replace:with:", "asUppercase", "second"]
  60936. }),
  60937. $globals.FileServer.a$cls);
  60938. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  60939. $core.addMethod(
  60940. $core.method({
  60941. selector: "bowerInstallThenDo:",
  60942. protocol: "action",
  60943. fn: function (aBlock){
  60944. var self=this,$self=this;
  60945. var child;
  60946. return $core.withContext(function($ctx1) {
  60947. var $1,$3,$2;
  60948. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("bower","bower"),["install"]);
  60949. $1=child;
  60950. $recv($1)._on_do_("error",aBlock);
  60951. $ctx1.sendIdx["on:do:"]=1;
  60952. $recv($1)._on_do_("close",(function(code){
  60953. return $core.withContext(function($ctx2) {
  60954. $3=$recv(code).__eq((0));
  60955. if($core.assert($3)){
  60956. $2=nil;
  60957. } else {
  60958. $2=code;
  60959. }
  60960. return $recv(aBlock)._value_($2);
  60961. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60962. }));
  60963. return self;
  60964. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60965. },
  60966. args: ["aBlock"],
  60967. source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'bower' named: 'bower')\x0a\x09\x09args: #('install').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  60968. referencedClasses: [],
  60969. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60970. }),
  60971. $globals.Initer);
  60972. $core.addMethod(
  60973. $core.method({
  60974. selector: "finishMessage",
  60975. protocol: "action",
  60976. fn: function (){
  60977. var self=this,$self=this;
  60978. return $core.withContext(function($ctx1) {
  60979. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  60980. $recv((function(){
  60981. }))._valueWithTimeout_((600));
  60982. return self;
  60983. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  60984. },
  60985. args: [],
  60986. source: "finishMessage\x0a\x09console log: (#(\x0a\x09\x09' '\x0a\x09\x09'The project should now be set up.'\x0a\x09\x09' '\x0a\x09\x09' '\x0a\x09) join: String lf).\x0a\x09[] valueWithTimeout: 600",
  60987. referencedClasses: ["String"],
  60988. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  60989. }),
  60990. $globals.Initer);
  60991. $core.addMethod(
  60992. $core.method({
  60993. selector: "gruntInitThenDo:",
  60994. protocol: "action",
  60995. fn: function (aBlock){
  60996. var self=this,$self=this;
  60997. var child,sanitizedTemplatePath;
  60998. return $core.withContext(function($ctx1) {
  60999. var $1,$3,$2;
  61000. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  61001. $ctx1.sendIdx["replace:with:"]=1;
  61002. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  61003. $1=child;
  61004. $recv($1)._on_do_("error",aBlock);
  61005. $ctx1.sendIdx["on:do:"]=1;
  61006. $recv($1)._on_do_("close",(function(code){
  61007. return $core.withContext(function($ctx2) {
  61008. $3=$recv(code).__eq((0));
  61009. if($core.assert($3)){
  61010. $2=nil;
  61011. } else {
  61012. $2=code;
  61013. }
  61014. return $recv(aBlock)._value_($2);
  61015. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  61016. }));
  61017. return self;
  61018. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  61019. },
  61020. args: ["aBlock"],
  61021. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  61022. referencedClasses: [],
  61023. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  61024. }),
  61025. $globals.Initer);
  61026. $core.addMethod(
  61027. $core.method({
  61028. selector: "gruntThenDo:",
  61029. protocol: "action",
  61030. fn: function (aBlock){
  61031. var self=this,$self=this;
  61032. var child;
  61033. return $core.withContext(function($ctx1) {
  61034. var $1,$3,$2;
  61035. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  61036. $1=child;
  61037. $recv($1)._on_do_("error",aBlock);
  61038. $ctx1.sendIdx["on:do:"]=1;
  61039. $recv($1)._on_do_("close",(function(code){
  61040. return $core.withContext(function($ctx2) {
  61041. $3=$recv(code).__eq((0));
  61042. if($core.assert($3)){
  61043. $2=nil;
  61044. } else {
  61045. $2=code;
  61046. }
  61047. return $recv(aBlock)._value_($2);
  61048. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  61049. }));
  61050. return self;
  61051. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  61052. },
  61053. args: ["aBlock"],
  61054. source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-cli' named: 'grunt')\x0a\x09\x09args: #('default' 'devel').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  61055. referencedClasses: [],
  61056. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  61057. }),
  61058. $globals.Initer);
  61059. $core.addMethod(
  61060. $core.method({
  61061. selector: "initialize",
  61062. protocol: "initialization",
  61063. fn: function (){
  61064. var self=this,$self=this;
  61065. return $core.withContext(function($ctx1) {
  61066. (
  61067. $ctx1.supercall = true,
  61068. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61069. $ctx1.supercall = false;
  61070. $self["@childProcess"]=$recv(require)._value_("child_process");
  61071. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  61072. return self;
  61073. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  61074. },
  61075. args: [],
  61076. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  61077. referencedClasses: [],
  61078. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  61079. }),
  61080. $globals.Initer);
  61081. $core.addMethod(
  61082. $core.method({
  61083. selector: "npmInstallThenDo:",
  61084. protocol: "action",
  61085. fn: function (aBlock){
  61086. var self=this,$self=this;
  61087. var child;
  61088. return $core.withContext(function($ctx1) {
  61089. var $1;
  61090. child=$recv($self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  61091. $1=$recv(child)._stdout();
  61092. $ctx1.sendIdx["stdout"]=1;
  61093. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  61094. return self;
  61095. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  61096. },
  61097. args: ["aBlock"],
  61098. source: "npmInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  61099. referencedClasses: [],
  61100. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  61101. }),
  61102. $globals.Initer);
  61103. $core.addMethod(
  61104. $core.method({
  61105. selector: "npmScriptForModule:named:",
  61106. protocol: "npm",
  61107. fn: function (aString,anotherString){
  61108. var self=this,$self=this;
  61109. var modulePath,packageJson,binSection,scriptPath;
  61110. return $core.withContext(function($ctx1) {
  61111. var $1,$3,$4,$2,$5;
  61112. $1=$self["@path"];
  61113. $3=$recv($globals.JSObjectProxy)._on_(require);
  61114. $4=$recv(aString).__comma("/package.json");
  61115. $ctx1.sendIdx[","]=1;
  61116. $2=$recv($3)._resolve_($4);
  61117. modulePath=$recv($1)._dirname_($2);
  61118. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  61119. binSection=$recv(packageJson)._at_("bin");
  61120. $ctx1.sendIdx["at:"]=1;
  61121. $5=$recv(binSection)._isString();
  61122. if($core.assert($5)){
  61123. scriptPath=binSection;
  61124. } else {
  61125. scriptPath=$recv(binSection)._at_(anotherString);
  61126. }
  61127. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  61128. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  61129. },
  61130. args: ["aString", "anotherString"],
  61131. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  61132. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  61133. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  61134. }),
  61135. $globals.Initer);
  61136. $core.addMethod(
  61137. $core.method({
  61138. selector: "start",
  61139. protocol: "action",
  61140. fn: function (){
  61141. var self=this,$self=this;
  61142. return $core.withContext(function($ctx1) {
  61143. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  61144. $self._gruntInitThenDo_((function(error){
  61145. return $core.withContext(function($ctx2) {
  61146. if(($receiver = error) == null || $receiver.a$nil){
  61147. return $self._bowerInstallThenDo_((function(error2){
  61148. return $core.withContext(function($ctx3) {
  61149. if(($receiver = error2) == null || $receiver.a$nil){
  61150. return $self._npmInstallThenDo_((function(error3){
  61151. return $core.withContext(function($ctx4) {
  61152. if(($receiver = error3) == null || $receiver.a$nil){
  61153. return $self._gruntThenDo_((function(error4){
  61154. return $core.withContext(function($ctx5) {
  61155. if(($receiver = error4) == null || $receiver.a$nil){
  61156. $self._finishMessage();
  61157. return $recv(process)._exit();
  61158. } else {
  61159. $7=console;
  61160. $recv($7)._log_("grunt exec error:");
  61161. $ctx5.sendIdx["log:"]=7;
  61162. $recv($7)._log_(error4);
  61163. return $recv(process)._exit_((104));
  61164. }
  61165. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  61166. }));
  61167. } else {
  61168. $5=console;
  61169. $recv($5)._log_("npm install exec error:");
  61170. $ctx4.sendIdx["log:"]=5;
  61171. $6=$recv($5)._log_(error3);
  61172. $ctx4.sendIdx["log:"]=6;
  61173. $6;
  61174. return $recv(process)._exit_((103));
  61175. $ctx4.sendIdx["exit:"]=3;
  61176. }
  61177. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  61178. }));
  61179. } else {
  61180. $3=console;
  61181. $recv($3)._log_("bower install exec error:");
  61182. $ctx3.sendIdx["log:"]=3;
  61183. $4=$recv($3)._log_(error2);
  61184. $ctx3.sendIdx["log:"]=4;
  61185. $4;
  61186. return $recv(process)._exit_((102));
  61187. $ctx3.sendIdx["exit:"]=2;
  61188. }
  61189. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  61190. }));
  61191. } else {
  61192. $1=console;
  61193. $recv($1)._log_("grunt-init exec error:");
  61194. $ctx2.sendIdx["log:"]=1;
  61195. $2=$recv($1)._log_(error);
  61196. $ctx2.sendIdx["log:"]=2;
  61197. $2;
  61198. return $recv(process)._exit_((101));
  61199. $ctx2.sendIdx["exit:"]=1;
  61200. }
  61201. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  61202. }));
  61203. return self;
  61204. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  61205. },
  61206. args: [],
  61207. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit: 102 ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit: 103 ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit: 104 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]",
  61208. referencedClasses: [],
  61209. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  61210. }),
  61211. $globals.Initer);
  61212. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  61213. $globals.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.";
  61214. $core.addMethod(
  61215. $core.method({
  61216. selector: "addVariableNamed:to:",
  61217. protocol: "private",
  61218. fn: function (aString,anObject){
  61219. var self=this,$self=this;
  61220. var newClass,newObject;
  61221. return $core.withContext(function($ctx1) {
  61222. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  61223. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  61224. newObject=$recv(newClass)._new();
  61225. $self._setPreviousVariablesFor_from_(newObject,anObject);
  61226. return newObject;
  61227. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  61228. },
  61229. args: ["aString", "anObject"],
  61230. 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",
  61231. referencedClasses: [],
  61232. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  61233. }),
  61234. $globals.Repl);
  61235. $core.addMethod(
  61236. $core.method({
  61237. selector: "assignNewVariable:do:",
  61238. protocol: "private",
  61239. fn: function (buffer,aBlock){
  61240. var self=this,$self=this;
  61241. return $core.withContext(function($ctx1) {
  61242. var $2,$3,$1,$receiver;
  61243. return $self._parseAssignment_do_(buffer,(function(name,expr){
  61244. var varName,value;
  61245. return $core.withContext(function($ctx2) {
  61246. if(($receiver = name) == null || $receiver.a$nil){
  61247. varName=$self._nextResultName();
  61248. } else {
  61249. varName=name;
  61250. }
  61251. varName;
  61252. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  61253. $self["@session"];
  61254. $recv((function(){
  61255. return $core.withContext(function($ctx3) {
  61256. $2=$recv(varName).__comma(" := ");
  61257. if(($receiver = expr) == null || $receiver.a$nil){
  61258. $3=buffer;
  61259. } else {
  61260. $3=expr;
  61261. }
  61262. $1=$recv($2).__comma($3);
  61263. $ctx3.sendIdx[","]=1;
  61264. value=$self._eval_on_($1,$self["@session"]);
  61265. return value;
  61266. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  61267. }))._on_do_($globals.Error,(function(e){
  61268. return $core.withContext(function($ctx3) {
  61269. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  61270. value=nil;
  61271. return value;
  61272. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  61273. }));
  61274. return $recv(aBlock)._value_value_(varName,value);
  61275. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  61276. }));
  61277. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  61278. },
  61279. args: ["buffer", "aBlock"],
  61280. 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\x09[ value := self eval: varName, ' := ', (expr ifNil: [buffer]) on: session ]\x0a\x09\x09\x09on: Error\x0a\x09\x09\x09do: [ :e | ConsoleErrorHandler new logError: e. value := nil].\x0a\x09\x09aBlock value: varName value: value]",
  61281. referencedClasses: ["Error", "ConsoleErrorHandler"],
  61282. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  61283. }),
  61284. $globals.Repl);
  61285. $core.addMethod(
  61286. $core.method({
  61287. selector: "clearScreen",
  61288. protocol: "actions",
  61289. fn: function (){
  61290. var self=this,$self=this;
  61291. var esc,cls;
  61292. return $core.withContext(function($ctx1) {
  61293. var $1;
  61294. esc=$recv($globals.String)._fromCharCode_((27));
  61295. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  61296. $ctx1.sendIdx[","]=2;
  61297. cls=$recv($1).__comma("[0;0f");
  61298. $ctx1.sendIdx[","]=1;
  61299. $recv($recv(process)._stdout())._write_(cls);
  61300. $recv($self["@interface"])._prompt();
  61301. return self;
  61302. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  61303. },
  61304. args: [],
  61305. 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",
  61306. referencedClasses: ["String"],
  61307. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  61308. }),
  61309. $globals.Repl);
  61310. $core.addMethod(
  61311. $core.method({
  61312. selector: "close",
  61313. protocol: "actions",
  61314. fn: function (){
  61315. var self=this,$self=this;
  61316. return $core.withContext(function($ctx1) {
  61317. $recv($recv(process)._stdin())._destroy();
  61318. return self;
  61319. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  61320. },
  61321. args: [],
  61322. source: "close\x0a\x09process stdin destroy",
  61323. referencedClasses: [],
  61324. messageSends: ["destroy", "stdin"]
  61325. }),
  61326. $globals.Repl);
  61327. $core.addMethod(
  61328. $core.method({
  61329. selector: "commands",
  61330. protocol: "accessing",
  61331. fn: function (){
  61332. var self=this,$self=this;
  61333. return $self["@commands"];
  61334. },
  61335. args: [],
  61336. source: "commands\x0a\x09^ commands",
  61337. referencedClasses: [],
  61338. messageSends: []
  61339. }),
  61340. $globals.Repl);
  61341. $core.addMethod(
  61342. $core.method({
  61343. selector: "createInterface",
  61344. protocol: "actions",
  61345. fn: function (){
  61346. var self=this,$self=this;
  61347. return $core.withContext(function($ctx1) {
  61348. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  61349. $recv($self["@interface"])._on_do_("line",(function(buffer){
  61350. return $core.withContext(function($ctx2) {
  61351. return $self._processLine_(buffer);
  61352. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  61353. }));
  61354. $ctx1.sendIdx["on:do:"]=1;
  61355. $recv($self["@interface"])._on_do_("close",(function(){
  61356. return $core.withContext(function($ctx2) {
  61357. return $self._close();
  61358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61359. }));
  61360. $self._printWelcome();
  61361. $self._setupHotkeys();
  61362. $self._setPrompt();
  61363. $recv($self["@interface"])._prompt();
  61364. return self;
  61365. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  61366. },
  61367. args: [],
  61368. 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",
  61369. referencedClasses: [],
  61370. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  61371. }),
  61372. $globals.Repl);
  61373. $core.addMethod(
  61374. $core.method({
  61375. selector: "encapsulateVariable:withValue:in:",
  61376. protocol: "private",
  61377. fn: function (aString,anObject,aClass){
  61378. var self=this,$self=this;
  61379. var compiler;
  61380. return $core.withContext(function($ctx1) {
  61381. var $1,$4,$3,$2,$5,$6;
  61382. compiler=$recv($globals.Compiler)._new();
  61383. $1=compiler;
  61384. $4=$recv(aString).__comma(": anObject ^ ");
  61385. $ctx1.sendIdx[","]=3;
  61386. $3=$recv($4).__comma(aString);
  61387. $ctx1.sendIdx[","]=2;
  61388. $2=$recv($3).__comma(" := anObject");
  61389. $ctx1.sendIdx[","]=1;
  61390. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  61391. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  61392. $5=compiler;
  61393. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  61394. $ctx1.sendIdx[","]=4;
  61395. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  61396. return self;
  61397. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  61398. },
  61399. args: ["aString", "anObject", "aClass"],
  61400. 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 protocol: 'session'.\x0a\x09compiler install: aString, ' ^ ', aString forClass: aClass protocol: 'session'.",
  61401. referencedClasses: ["Compiler"],
  61402. messageSends: ["new", "install:forClass:protocol:", ","]
  61403. }),
  61404. $globals.Repl);
  61405. $core.addMethod(
  61406. $core.method({
  61407. selector: "eval:",
  61408. protocol: "actions",
  61409. fn: function (buffer){
  61410. var self=this,$self=this;
  61411. return $core.withContext(function($ctx1) {
  61412. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  61413. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  61414. },
  61415. args: ["buffer"],
  61416. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  61417. referencedClasses: ["DoIt"],
  61418. messageSends: ["eval:on:", "new"]
  61419. }),
  61420. $globals.Repl);
  61421. $core.addMethod(
  61422. $core.method({
  61423. selector: "eval:on:",
  61424. protocol: "actions",
  61425. fn: function (buffer,anObject){
  61426. var self=this,$self=this;
  61427. var result;
  61428. return $core.withContext(function($ctx1) {
  61429. var $1;
  61430. $recv(buffer)._ifNotEmpty_((function(){
  61431. return $core.withContext(function($ctx2) {
  61432. return $recv((function(){
  61433. return $core.withContext(function($ctx3) {
  61434. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  61435. return result;
  61436. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61437. }))._tryCatch_((function(e){
  61438. return $core.withContext(function($ctx3) {
  61439. $1=$recv(e)._isSmalltalkError();
  61440. if($core.assert($1)){
  61441. return $recv(e)._resignal();
  61442. } else {
  61443. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  61444. }
  61445. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  61446. }));
  61447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61448. }));
  61449. return result;
  61450. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  61451. },
  61452. args: ["buffer", "anObject"],
  61453. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e resignal ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  61454. referencedClasses: ["Compiler"],
  61455. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  61456. }),
  61457. $globals.Repl);
  61458. $core.addMethod(
  61459. $core.method({
  61460. selector: "executeCommand:",
  61461. protocol: "private",
  61462. fn: function (aString){
  61463. var self=this,$self=this;
  61464. return $core.withContext(function($ctx1) {
  61465. var $1;
  61466. var $early={};
  61467. try {
  61468. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  61469. return $core.withContext(function($ctx2) {
  61470. $1=$recv(names)._includes_(aString);
  61471. if($core.assert($1)){
  61472. $recv(cmd)._value();
  61473. throw $early=[true];
  61474. }
  61475. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  61476. }));
  61477. return false;
  61478. }
  61479. catch(e) {if(e===$early)return e[0]; throw e}
  61480. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  61481. },
  61482. args: ["aString"],
  61483. 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",
  61484. referencedClasses: [],
  61485. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  61486. }),
  61487. $globals.Repl);
  61488. $core.addMethod(
  61489. $core.method({
  61490. selector: "initialize",
  61491. protocol: "initialization",
  61492. fn: function (){
  61493. var self=this,$self=this;
  61494. return $core.withContext(function($ctx1) {
  61495. (
  61496. $ctx1.supercall = true,
  61497. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61498. $ctx1.supercall = false;
  61499. $self["@session"]=$recv($globals.DoIt)._new();
  61500. $self["@readline"]=$recv(require)._value_("readline");
  61501. $ctx1.sendIdx["value:"]=1;
  61502. $self["@util"]=$recv(require)._value_("util");
  61503. $self._setupCommands();
  61504. return self;
  61505. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  61506. },
  61507. args: [],
  61508. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  61509. referencedClasses: ["DoIt"],
  61510. messageSends: ["initialize", "new", "value:", "setupCommands"]
  61511. }),
  61512. $globals.Repl);
  61513. $core.addMethod(
  61514. $core.method({
  61515. selector: "instanceVariableNamesFor:",
  61516. protocol: "private",
  61517. fn: function (aClass){
  61518. var self=this,$self=this;
  61519. return $core.withContext(function($ctx1) {
  61520. var $1,$2,$receiver;
  61521. $1=$recv(aClass)._superclass();
  61522. $ctx1.sendIdx["superclass"]=1;
  61523. if(($receiver = $1) == null || $receiver.a$nil){
  61524. return $recv(aClass)._instanceVariableNames();
  61525. } else {
  61526. $2=$recv(aClass)._instanceVariableNames();
  61527. $ctx1.sendIdx["instanceVariableNames"]=1;
  61528. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  61529. }
  61530. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  61531. },
  61532. args: ["aClass"],
  61533. 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]",
  61534. referencedClasses: [],
  61535. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  61536. }),
  61537. $globals.Repl);
  61538. $core.addMethod(
  61539. $core.method({
  61540. selector: "isIdentifier:",
  61541. protocol: "private",
  61542. fn: function (aString){
  61543. var self=this,$self=this;
  61544. return $core.withContext(function($ctx1) {
  61545. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  61546. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  61547. },
  61548. args: ["aString"],
  61549. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  61550. referencedClasses: [],
  61551. messageSends: ["match:", "asRegexp"]
  61552. }),
  61553. $globals.Repl);
  61554. $core.addMethod(
  61555. $core.method({
  61556. selector: "isVariableDefined:",
  61557. protocol: "private",
  61558. fn: function (aString){
  61559. var self=this,$self=this;
  61560. return $core.withContext(function($ctx1) {
  61561. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  61562. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  61563. },
  61564. args: ["aString"],
  61565. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  61566. referencedClasses: [],
  61567. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  61568. }),
  61569. $globals.Repl);
  61570. $core.addMethod(
  61571. $core.method({
  61572. selector: "nextResultName",
  61573. protocol: "private",
  61574. fn: function (){
  61575. var self=this,$self=this;
  61576. return $core.withContext(function($ctx1) {
  61577. var $1,$receiver;
  61578. $1=$self["@resultCount"];
  61579. if(($receiver = $1) == null || $receiver.a$nil){
  61580. $self["@resultCount"]=(1);
  61581. } else {
  61582. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  61583. }
  61584. return "res".__comma($recv($self["@resultCount"])._asString());
  61585. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  61586. },
  61587. args: [],
  61588. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  61589. referencedClasses: [],
  61590. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  61591. }),
  61592. $globals.Repl);
  61593. $core.addMethod(
  61594. $core.method({
  61595. selector: "onKeyPress:",
  61596. protocol: "private",
  61597. fn: function (key){
  61598. var self=this,$self=this;
  61599. return $core.withContext(function($ctx1) {
  61600. var $1;
  61601. $1=$recv($recv(key)._ctrl())._and_((function(){
  61602. return $core.withContext(function($ctx2) {
  61603. return $recv($recv(key)._name()).__eq("l");
  61604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61605. }));
  61606. if($core.assert($1)){
  61607. $self._clearScreen();
  61608. }
  61609. return self;
  61610. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  61611. },
  61612. args: ["key"],
  61613. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  61614. referencedClasses: [],
  61615. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  61616. }),
  61617. $globals.Repl);
  61618. $core.addMethod(
  61619. $core.method({
  61620. selector: "parseAssignment:do:",
  61621. protocol: "private",
  61622. fn: function (aString,aBlock){
  61623. var self=this,$self=this;
  61624. var assignment;
  61625. return $core.withContext(function($ctx1) {
  61626. var $2,$1;
  61627. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  61628. return $core.withContext(function($ctx2) {
  61629. return $recv(s)._trimBoth();
  61630. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  61631. }));
  61632. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  61633. return $core.withContext(function($ctx2) {
  61634. $2=$recv(assignment)._first();
  61635. $ctx2.sendIdx["first"]=1;
  61636. return $self._isIdentifier_($2);
  61637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61638. }));
  61639. if($core.assert($1)){
  61640. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  61641. $ctx1.sendIdx["value:value:"]=1;
  61642. } else {
  61643. return $recv(aBlock)._value_value_(nil,nil);
  61644. }
  61645. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  61646. },
  61647. args: ["aString", "aBlock"],
  61648. 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 ]",
  61649. referencedClasses: [],
  61650. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  61651. }),
  61652. $globals.Repl);
  61653. $core.addMethod(
  61654. $core.method({
  61655. selector: "presentResultNamed:withValue:",
  61656. protocol: "private",
  61657. fn: function (varName,value){
  61658. var self=this,$self=this;
  61659. return $core.withContext(function($ctx1) {
  61660. var $3,$2,$1;
  61661. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  61662. $ctx1.sendIdx[","]=3;
  61663. $2=$recv($3).__comma(" = ");
  61664. $ctx1.sendIdx[","]=2;
  61665. $1=$recv($2).__comma($recv(value)._asString());
  61666. $ctx1.sendIdx[","]=1;
  61667. $recv($globals.Transcript)._show_($1);
  61668. $recv($globals.Transcript)._cr();
  61669. $recv($self["@interface"])._prompt();
  61670. return self;
  61671. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  61672. },
  61673. args: ["varName", "value"],
  61674. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  61675. referencedClasses: ["Transcript"],
  61676. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  61677. }),
  61678. $globals.Repl);
  61679. $core.addMethod(
  61680. $core.method({
  61681. selector: "printWelcome",
  61682. protocol: "actions",
  61683. fn: function (){
  61684. var self=this,$self=this;
  61685. return $core.withContext(function($ctx1) {
  61686. $recv($globals.Transcript)._show_("Type :q to exit.");
  61687. $recv($globals.Transcript)._cr();
  61688. return self;
  61689. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  61690. },
  61691. args: [],
  61692. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  61693. referencedClasses: ["Transcript"],
  61694. messageSends: ["show:", "cr"]
  61695. }),
  61696. $globals.Repl);
  61697. $core.addMethod(
  61698. $core.method({
  61699. selector: "processLine:",
  61700. protocol: "private",
  61701. fn: function (buffer){
  61702. var self=this,$self=this;
  61703. var show;
  61704. return $core.withContext(function($ctx1) {
  61705. var $1,$2;
  61706. show=(function(varName,value){
  61707. return $core.withContext(function($ctx2) {
  61708. return $self._presentResultNamed_withValue_(varName,value);
  61709. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  61710. });
  61711. $1=$self._executeCommand_(buffer);
  61712. if(!$core.assert($1)){
  61713. $2=$self._isVariableDefined_(buffer);
  61714. if($core.assert($2)){
  61715. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  61716. } else {
  61717. $self._assignNewVariable_do_(buffer,show);
  61718. }
  61719. }
  61720. return self;
  61721. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  61722. },
  61723. args: ["buffer"],
  61724. 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]]",
  61725. referencedClasses: [],
  61726. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  61727. }),
  61728. $globals.Repl);
  61729. $core.addMethod(
  61730. $core.method({
  61731. selector: "prompt",
  61732. protocol: "accessing",
  61733. fn: function (){
  61734. var self=this,$self=this;
  61735. return "amber >> ";
  61736. },
  61737. args: [],
  61738. source: "prompt\x0a\x09^ 'amber >> '",
  61739. referencedClasses: [],
  61740. messageSends: []
  61741. }),
  61742. $globals.Repl);
  61743. $core.addMethod(
  61744. $core.method({
  61745. selector: "setPreviousVariablesFor:from:",
  61746. protocol: "private",
  61747. fn: function (newObject,oldObject){
  61748. var self=this,$self=this;
  61749. return $core.withContext(function($ctx1) {
  61750. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  61751. return $core.withContext(function($ctx2) {
  61752. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  61753. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61754. }));
  61755. return self;
  61756. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  61757. },
  61758. args: ["newObject", "oldObject"],
  61759. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  61760. referencedClasses: [],
  61761. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  61762. }),
  61763. $globals.Repl);
  61764. $core.addMethod(
  61765. $core.method({
  61766. selector: "setPrompt",
  61767. protocol: "actions",
  61768. fn: function (){
  61769. var self=this,$self=this;
  61770. return $core.withContext(function($ctx1) {
  61771. $recv($self["@interface"])._setPrompt_($self._prompt());
  61772. return self;
  61773. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  61774. },
  61775. args: [],
  61776. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  61777. referencedClasses: [],
  61778. messageSends: ["setPrompt:", "prompt"]
  61779. }),
  61780. $globals.Repl);
  61781. $core.addMethod(
  61782. $core.method({
  61783. selector: "setupCommands",
  61784. protocol: "initialization",
  61785. fn: function (){
  61786. var self=this,$self=this;
  61787. return $core.withContext(function($ctx1) {
  61788. var $2,$1;
  61789. $2=$recv([":q"]).__minus_gt((function(){
  61790. return $core.withContext(function($ctx2) {
  61791. return $recv(process)._exit();
  61792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61793. }));
  61794. $ctx1.sendIdx["->"]=1;
  61795. $1=[$2,$recv([""]).__minus_gt((function(){
  61796. return $core.withContext(function($ctx2) {
  61797. return $recv($self["@interface"])._prompt();
  61798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61799. }))];
  61800. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  61801. return self;
  61802. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  61803. },
  61804. args: [],
  61805. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  61806. referencedClasses: ["Dictionary"],
  61807. messageSends: ["from:", "->", "exit", "prompt"]
  61808. }),
  61809. $globals.Repl);
  61810. $core.addMethod(
  61811. $core.method({
  61812. selector: "setupHotkeys",
  61813. protocol: "initialization",
  61814. fn: function (){
  61815. var self=this,$self=this;
  61816. return $core.withContext(function($ctx1) {
  61817. var $receiver;
  61818. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  61819. return $core.withContext(function($ctx2) {
  61820. if(($receiver = key) == null || $receiver.a$nil){
  61821. return key;
  61822. } else {
  61823. return $self._onKeyPress_(key);
  61824. }
  61825. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  61826. }));
  61827. return self;
  61828. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  61829. },
  61830. args: [],
  61831. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  61832. referencedClasses: [],
  61833. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  61834. }),
  61835. $globals.Repl);
  61836. $core.addMethod(
  61837. $core.method({
  61838. selector: "subclass:withVariable:",
  61839. protocol: "private",
  61840. fn: function (aClass,varName){
  61841. var self=this,$self=this;
  61842. return $core.withContext(function($ctx1) {
  61843. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  61844. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  61845. },
  61846. args: ["aClass", "varName"],
  61847. 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'",
  61848. referencedClasses: ["ClassBuilder"],
  61849. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  61850. }),
  61851. $globals.Repl);
  61852. $core.addMethod(
  61853. $core.method({
  61854. selector: "subclassNameFor:",
  61855. protocol: "private",
  61856. fn: function (aClass){
  61857. var self=this,$self=this;
  61858. return $core.withContext(function($ctx1) {
  61859. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  61860. $2=$recv(aClass)._name();
  61861. $ctx1.sendIdx["name"]=1;
  61862. $1=$recv($2)._matchesOf_("\x5cd+$");
  61863. $ctx1.sendIdx["matchesOf:"]=1;
  61864. if(($receiver = $1) == null || $receiver.a$nil){
  61865. return $recv($recv(aClass)._name()).__comma("2");
  61866. } else {
  61867. var counter;
  61868. $6=$recv(aClass)._name();
  61869. $ctx1.sendIdx["name"]=2;
  61870. $5=$recv($6)._matchesOf_("\x5cd+$");
  61871. $4=$recv($5)._first();
  61872. $3=$recv($4)._asNumber();
  61873. counter=$recv($3).__plus((1));
  61874. counter;
  61875. $7=$recv(aClass)._name();
  61876. $ctx1.sendIdx["name"]=3;
  61877. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  61878. }
  61879. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  61880. },
  61881. args: ["aClass"],
  61882. 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'].",
  61883. referencedClasses: [],
  61884. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  61885. }),
  61886. $globals.Repl);
  61887. $core.addMethod(
  61888. $core.method({
  61889. selector: "main",
  61890. protocol: "initialization",
  61891. fn: function (){
  61892. var self=this,$self=this;
  61893. return $core.withContext(function($ctx1) {
  61894. $recv($self._new())._createInterface();
  61895. return self;
  61896. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  61897. },
  61898. args: [],
  61899. source: "main\x0a\x09self new createInterface",
  61900. referencedClasses: [],
  61901. messageSends: ["createInterface", "new"]
  61902. }),
  61903. $globals.Repl.a$cls);
  61904. });
  61905. (function () {
  61906. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  61907. amber.initialize().then(function () {
  61908. amber.globals.AmberCli._main();
  61909. });
  61910. });
  61911. }());
  61912. //jshint eqnull:true
  61913. define('amber/kernel-runtime',[],function () {
  61914. "use strict";
  61915. function defineMethod (klass, name, method) {
  61916. Object.defineProperty(klass.prototype, name, {
  61917. value: method,
  61918. enumerable: false, configurable: true, writable: true
  61919. });
  61920. }
  61921. DNUBrik.deps = ["selectors", "messageSend", "manipulation", "classes"];
  61922. function DNUBrik (brikz, st) {
  61923. var selectorsBrik = brikz.selectors;
  61924. var messageNotUnderstood = brikz.messageSend.messageNotUnderstood;
  61925. var installJSMethod = brikz.manipulation.installJSMethod;
  61926. var nilAsClass = brikz.classes.nilAsClass;
  61927. /* Method not implemented handlers */
  61928. function makeDnuHandler (pair, targetClasses) {
  61929. var jsSelector = pair.js;
  61930. var fn = createHandler(pair.st);
  61931. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  61932. targetClasses.forEach(function (target) {
  61933. installJSMethod(target.fn.prototype, jsSelector, fn);
  61934. });
  61935. }
  61936. this.makeDnuHandler = makeDnuHandler;
  61937. /* Dnu handler method */
  61938. function createHandler (stSelector) {
  61939. return function () {
  61940. return messageNotUnderstood(this, stSelector, arguments);
  61941. };
  61942. }
  61943. selectorsBrik.selectorPairs.forEach(function (pair) {
  61944. makeDnuHandler(pair, []);
  61945. });
  61946. }
  61947. function ManipulationBrik (brikz, st) {
  61948. function installJSMethod (obj, jsSelector, fn) {
  61949. Object.defineProperty(obj, jsSelector, {
  61950. value: fn,
  61951. enumerable: false, configurable: true, writable: true
  61952. });
  61953. }
  61954. function installMethod (method, klass) {
  61955. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  61956. }
  61957. this.installMethod = installMethod;
  61958. this.installJSMethod = installJSMethod;
  61959. }
  61960. RuntimeClassesBrik.deps = ["selectors", "dnu", "behaviors", "classes", "manipulation"];
  61961. function RuntimeClassesBrik (brikz, st) {
  61962. var selectors = brikz.selectors;
  61963. var classes = brikz.behaviors.classes;
  61964. var wireKlass = brikz.classes.wireKlass;
  61965. var installMethod = brikz.manipulation.installMethod;
  61966. var installJSMethod = brikz.manipulation.installJSMethod;
  61967. var detachedRootClasses = [];
  61968. function markClassDetachedRoot (klass) {
  61969. klass.detachedRoot = true;
  61970. detachedRootClasses = classes().filter(function (klass) {
  61971. return klass.detachedRoot;
  61972. });
  61973. }
  61974. this.detachedRootClasses = function () {
  61975. return detachedRootClasses;
  61976. };
  61977. /* Initialize a class in its class hierarchy. Handle both classes and
  61978. metaclasses. */
  61979. function initClassAndMetaclass (klass) {
  61980. initClass(klass);
  61981. if (klass.a$cls && !klass.meta) {
  61982. initClass(klass.a$cls);
  61983. }
  61984. }
  61985. classes().forEach(function (klass) {
  61986. if (!klass.trait) initClassAndMetaclass(klass);
  61987. });
  61988. st._classAdded = initClassAndMetaclass;
  61989. function initClass (klass) {
  61990. wireKlass(klass);
  61991. if (klass.detachedRoot) {
  61992. copySuperclass(klass);
  61993. }
  61994. installMethods(klass);
  61995. }
  61996. function copySuperclass (klass) {
  61997. var myproto = klass.fn.prototype,
  61998. superproto = klass.superclass.fn.prototype;
  61999. selectors.selectorPairs.forEach(function (selectorPair) {
  62000. var jsSelector = selectorPair.js;
  62001. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  62002. });
  62003. }
  62004. function installMethods (klass) {
  62005. var methods = klass.methods;
  62006. Object.keys(methods).forEach(function (selector) {
  62007. installMethod(methods[selector], klass);
  62008. });
  62009. }
  62010. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  62011. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  62012. markClassDetachedRoot(klass);
  62013. klass.fn = constructor;
  62014. initClass(klass);
  62015. };
  62016. }
  62017. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  62018. function FrameBindingBrik (brikz, st) {
  62019. var globals = brikz.smalltalkGlobals.globals;
  62020. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  62021. setClassConstructor(globals.Number, Number);
  62022. setClassConstructor(globals.BlockClosure, Function);
  62023. setClassConstructor(globals.Boolean, Boolean);
  62024. setClassConstructor(globals.Date, Date);
  62025. setClassConstructor(globals.String, String);
  62026. setClassConstructor(globals.Array, Array);
  62027. setClassConstructor(globals.RegularExpression, RegExp);
  62028. setClassConstructor(globals.Error, Error);
  62029. setClassConstructor(globals.Promise, Promise);
  62030. this.__init__ = function () {
  62031. st.alias(globals.Array, "OrderedCollection");
  62032. st.alias(globals.Date, "Time");
  62033. }
  62034. }
  62035. RuntimeMethodsBrik.deps = ["manipulation", "dnu", "runtimeClasses"];
  62036. function RuntimeMethodsBrik (brikz, st) {
  62037. var installMethod = brikz.manipulation.installMethod;
  62038. var installJSMethod = brikz.manipulation.installJSMethod;
  62039. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  62040. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  62041. st._methodAdded = function (method, klass) {
  62042. installMethod(method, klass);
  62043. propagateMethodChange(klass, method, klass);
  62044. };
  62045. st._selectorsAdded = function (newSelectors) {
  62046. var targetClasses = detachedRootClasses();
  62047. newSelectors.forEach(function (pair) {
  62048. makeDnuHandler(pair, targetClasses);
  62049. });
  62050. };
  62051. st._methodRemoved = function (method, klass) {
  62052. delete klass.fn.prototype[method.jsSelector];
  62053. propagateMethodChange(klass, method, null);
  62054. };
  62055. function propagateMethodChange (klass, method, exclude) {
  62056. var selector = method.selector;
  62057. var jsSelector = method.jsSelector;
  62058. st.traverseClassTree(klass, function (subclass, sentinel) {
  62059. if (subclass != exclude) {
  62060. if (initMethodInClass(subclass, selector, jsSelector)) return sentinel;
  62061. }
  62062. });
  62063. }
  62064. function initMethodInClass (klass, selector, jsSelector) {
  62065. if (klass.methods[selector]) return true;
  62066. if (klass.detachedRoot) {
  62067. installJSMethod(klass.fn.prototype, jsSelector, klass.superclass.fn.prototype[jsSelector]);
  62068. }
  62069. }
  62070. }
  62071. PrimitivesBrik.deps = ["smalltalkGlobals"];
  62072. function PrimitivesBrik (brikz, st) {
  62073. var globals = brikz.smalltalkGlobals.globals;
  62074. var oid = 0;
  62075. /* Unique ID number generator */
  62076. st.nextId = function () {
  62077. oid += 1;
  62078. return oid;
  62079. };
  62080. /* Converts a JavaScript object to valid Smalltalk Object */
  62081. st.readJSObject = function (js) {
  62082. if (js == null)
  62083. return null;
  62084. var readObject = js.constructor === Object;
  62085. var readArray = js.constructor === Array;
  62086. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  62087. for (var i in js) {
  62088. if (readObject) {
  62089. object._at_put_(i, st.readJSObject(js[i]));
  62090. }
  62091. if (readArray) {
  62092. object[i] = st.readJSObject(js[i]);
  62093. }
  62094. }
  62095. return object;
  62096. };
  62097. /* Boolean assertion */
  62098. st.assert = function (shouldBeBoolean) {
  62099. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  62100. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  62101. shouldBeBoolean = shouldBeBoolean.valueOf();
  62102. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  62103. }
  62104. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  62105. };
  62106. /* List of all reserved words in JavaScript. They may not be used as variables
  62107. in Smalltalk. */
  62108. // list of reserved JavaScript keywords as of
  62109. // http://es5.github.com/#x7.6.1.1
  62110. // and
  62111. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  62112. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  62113. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  62114. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  62115. 'try', 'typeof', 'var', 'void', 'while', 'with',
  62116. // Amber protected words: these should not be compiled as-is when in code
  62117. 'arguments',
  62118. // ES5: future use: http://es5.github.com/#x7.6.1.2
  62119. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  62120. // ES5: future use in strict mode
  62121. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  62122. 'public', 'static', 'yield'];
  62123. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  62124. }
  62125. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  62126. function RuntimeBrik (brikz, st) {
  62127. var globals = brikz.smalltalkGlobals.globals;
  62128. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  62129. function SmalltalkMethodContext (home, setup) {
  62130. this.sendIdx = {};
  62131. this.homeContext = home;
  62132. this.setup = setup || function () {
  62133. };
  62134. this.supercall = false;
  62135. }
  62136. // Fallbacks
  62137. SmalltalkMethodContext.prototype.locals = {};
  62138. SmalltalkMethodContext.prototype.receiver = null;
  62139. SmalltalkMethodContext.prototype.selector = null;
  62140. SmalltalkMethodContext.prototype.lookupClass = null;
  62141. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  62142. this.receiver = receiver;
  62143. this.selector = selector;
  62144. this.locals = locals || {};
  62145. this.lookupClass = lookupClass;
  62146. if (this.homeContext) {
  62147. this.homeContext.evaluatedSelector = selector;
  62148. }
  62149. });
  62150. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  62151. this.locals = locals || {};
  62152. this.outerContext = ctx;
  62153. this.index = index || 0;
  62154. });
  62155. defineMethod(SmalltalkMethodContext, "init", function () {
  62156. var home = this.homeContext;
  62157. if (home) {
  62158. home.init();
  62159. }
  62160. this.setup(this);
  62161. });
  62162. defineMethod(SmalltalkMethodContext, "method", function () {
  62163. var method;
  62164. var lookup = this.lookupClass || this.receiver.a$cls;
  62165. while (!method && lookup) {
  62166. method = lookup.methods[st.js2st(this.selector)];
  62167. lookup = lookup.superclass;
  62168. }
  62169. return method;
  62170. });
  62171. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  62172. /* This is the current call context object.
  62173. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  62174. In JS code, use api.getThisContext() (see below).
  62175. */
  62176. var thisContext = null;
  62177. st.withContext = function (worker, setup) {
  62178. if (thisContext) {
  62179. return inContext(worker, setup);
  62180. } else {
  62181. return inContextWithErrorHandling(worker, setup);
  62182. }
  62183. };
  62184. /*
  62185. Runs worker function so that error handler is not set up
  62186. if there isn't one. This is accomplished by unconditional
  62187. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  62188. which then stops error handler setup (see st.withContext above).
  62189. The effect is, $core.seamless(fn)'s exceptions are not
  62190. handed into ST error handler and caller should process them.
  62191. */
  62192. st.seamless = function (worker) {
  62193. return inContext(worker, function (ctx) {
  62194. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  62195. });
  62196. };
  62197. function inContextWithErrorHandling (worker, setup) {
  62198. try {
  62199. return inContext(worker, setup);
  62200. } catch (error) {
  62201. handleError(error);
  62202. thisContext = null;
  62203. // Rethrow the error in any case.
  62204. error.amberHandled = true;
  62205. throw error;
  62206. }
  62207. }
  62208. function inContext (worker, setup) {
  62209. var oldContext = thisContext;
  62210. thisContext = new SmalltalkMethodContext(thisContext, setup);
  62211. var result = worker(thisContext);
  62212. thisContext = oldContext;
  62213. return result;
  62214. }
  62215. /* Wrap a JavaScript exception in a Smalltalk Exception.
  62216. In case of a RangeError, stub the stack after 100 contexts to
  62217. avoid another RangeError later when the stack is manipulated. */
  62218. function wrappedError (error) {
  62219. var errorWrapper = globals.JavaScriptException._on_(error);
  62220. // Add the error to the context, so it is visible in the stack
  62221. try {
  62222. errorWrapper._signal();
  62223. } catch (ex) {
  62224. }
  62225. var context = st.getThisContext();
  62226. if (isRangeError(error)) {
  62227. stubContextStack(context);
  62228. }
  62229. errorWrapper._context_(context);
  62230. return errorWrapper;
  62231. }
  62232. /* Stub the context stack after 100 contexts */
  62233. function stubContextStack (context) {
  62234. var currentContext = context;
  62235. var contexts = 0;
  62236. while (contexts < 100) {
  62237. if (currentContext) {
  62238. currentContext = currentContext.homeContext;
  62239. }
  62240. contexts++;
  62241. }
  62242. if (currentContext) {
  62243. currentContext.homeContext = undefined;
  62244. }
  62245. }
  62246. function isRangeError (error) {
  62247. return error instanceof RangeError;
  62248. }
  62249. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  62250. (See the Smalltalk class ErrorHandler and its subclasses */
  62251. function handleError (error) {
  62252. if (!error.smalltalkError) {
  62253. error = wrappedError(error);
  62254. }
  62255. globals.ErrorHandler._handleError_(error);
  62256. }
  62257. /* Handle thisContext pseudo variable */
  62258. st.getThisContext = function () {
  62259. if (thisContext) {
  62260. thisContext.init();
  62261. return thisContext;
  62262. } else {
  62263. return null;
  62264. }
  62265. };
  62266. }
  62267. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  62268. function MessageSendBrik (brikz, st) {
  62269. var globals = brikz.smalltalkGlobals.globals;
  62270. var nilAsReceiver = brikz.root.nilAsReceiver;
  62271. /* Send message programmatically. Used to implement #perform: & Co. */
  62272. st.send2 = function (self, selector, args, klass) {
  62273. if (self == null) {
  62274. self = nilAsReceiver;
  62275. }
  62276. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  62277. if (method) {
  62278. return method.apply(self, args || []);
  62279. } else {
  62280. return messageNotUnderstood(self.a$cls ? self : wrapJavaScript(self), selector, args);
  62281. }
  62282. };
  62283. function wrapJavaScript (o) {
  62284. return globals.JSObjectProxy._on_(o);
  62285. }
  62286. st.wrapJavaScript = wrapJavaScript;
  62287. /* Handles #dnu:. Calls #doesNotUnderstand:. */
  62288. function messageNotUnderstood (receiver, stSelector, args) {
  62289. return receiver._doesNotUnderstand_(
  62290. globals.Message._new()
  62291. ._selector_(stSelector)
  62292. ._arguments_([].slice.call(args))
  62293. );
  62294. }
  62295. /* If the object property is a function, then call it, except if it starts with
  62296. an uppercase character (we probably want to answer the function itself in this
  62297. case and send it #new from Amber).
  62298. */
  62299. function accessJavaScript (self, propertyName, args) {
  62300. var propertyValue = self[propertyName];
  62301. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  62302. return propertyValue.apply(self, args || []);
  62303. } else if (args.length > 0) {
  62304. self[propertyName] = args[0];
  62305. return self;
  62306. } else {
  62307. return propertyValue;
  62308. }
  62309. }
  62310. st.accessJavaScript = accessJavaScript;
  62311. this.messageNotUnderstood = messageNotUnderstood;
  62312. }
  62313. StartImageBrik.deps = ["frameBinding", "runtimeMethods", "runtime", "primitives"];
  62314. function StartImageBrik (brikz, st) {
  62315. this.__init__ = function () {
  62316. var classes = brikz.behaviors.classes;
  62317. classes().forEach(function (klass) {
  62318. klass._initialize();
  62319. });
  62320. };
  62321. this.__init__.once = true;
  62322. }
  62323. /* Making smalltalk that can run */
  62324. function configureWithRuntime (brikz) {
  62325. brikz.dnu = DNUBrik;
  62326. brikz.manipulation = ManipulationBrik;
  62327. brikz.runtimeClasses = RuntimeClassesBrik;
  62328. brikz.frameBinding = FrameBindingBrik;
  62329. brikz.runtimeMethods = RuntimeMethodsBrik;
  62330. brikz.messageSend = MessageSendBrik;
  62331. brikz.runtime = RuntimeBrik;
  62332. brikz.primitives = PrimitivesBrik;
  62333. brikz.startImage = StartImageBrik;
  62334. brikz.rebuild();
  62335. }
  62336. return configureWithRuntime;
  62337. });
  62338. // Depend on each module that is loaded lazily.
  62339. // Add to packager tasks as dependency,
  62340. // so the lazy-loaded modules are included.
  62341. define('amber/lazypack',['./kernel-runtime'], {});
  62342. require(["app"]);
  62343. });
  62344. define.require('__wrap__');
  62345. }((function amdefine(module, requireFn) {
  62346. 'use strict';
  62347. var defineCache = {},
  62348. loaderCache = {},
  62349. alreadyCalled = false,
  62350. path = require('path'),
  62351. makeRequire, stringRequire;
  62352. /**
  62353. * Trims the . and .. from an array of path segments.
  62354. * It will keep a leading path segment if a .. will become
  62355. * the first path segment, to help with module name lookups,
  62356. * which act like paths, but can be remapped. But the end result,
  62357. * all paths that use this function should look normalized.
  62358. * NOTE: this method MODIFIES the input array.
  62359. * @param {Array} ary the array of path segments.
  62360. */
  62361. function trimDots(ary) {
  62362. var i, part;
  62363. for (i = 0; ary[i]; i+= 1) {
  62364. part = ary[i];
  62365. if (part === '.') {
  62366. ary.splice(i, 1);
  62367. i -= 1;
  62368. } else if (part === '..') {
  62369. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  62370. //End of the line. Keep at least one non-dot
  62371. //path segment at the front so it can be mapped
  62372. //correctly to disk. Otherwise, there is likely
  62373. //no path mapping for a path starting with '..'.
  62374. //This can still fail, but catches the most reasonable
  62375. //uses of ..
  62376. break;
  62377. } else if (i > 0) {
  62378. ary.splice(i - 1, 2);
  62379. i -= 2;
  62380. }
  62381. }
  62382. }
  62383. }
  62384. function normalize(name, baseName) {
  62385. var baseParts;
  62386. //Adjust any relative paths.
  62387. if (name && name.charAt(0) === '.') {
  62388. //If have a base name, try to normalize against it,
  62389. //otherwise, assume it is a top-level require that will
  62390. //be relative to baseUrl in the end.
  62391. if (baseName) {
  62392. baseParts = baseName.split('/');
  62393. baseParts = baseParts.slice(0, baseParts.length - 1);
  62394. baseParts = baseParts.concat(name.split('/'));
  62395. trimDots(baseParts);
  62396. name = baseParts.join('/');
  62397. }
  62398. }
  62399. return name;
  62400. }
  62401. /**
  62402. * Create the normalize() function passed to a loader plugin's
  62403. * normalize method.
  62404. */
  62405. function makeNormalize(relName) {
  62406. return function (name) {
  62407. return normalize(name, relName);
  62408. };
  62409. }
  62410. function makeLoad(id) {
  62411. function load(value) {
  62412. loaderCache[id] = value;
  62413. }
  62414. load.fromText = function (id, text) {
  62415. //This one is difficult because the text can/probably uses
  62416. //define, and any relative paths and requires should be relative
  62417. //to that id was it would be found on disk. But this would require
  62418. //bootstrapping a module/require fairly deeply from node core.
  62419. //Not sure how best to go about that yet.
  62420. throw new Error('amdefine does not implement load.fromText');
  62421. };
  62422. return load;
  62423. }
  62424. makeRequire = function (systemRequire, exports, module, relId) {
  62425. function amdRequire(deps, callback) {
  62426. if (typeof deps === 'string') {
  62427. //Synchronous, single module require('')
  62428. return stringRequire(systemRequire, exports, module, deps, relId);
  62429. } else {
  62430. //Array of dependencies with a callback.
  62431. //Convert the dependencies to modules.
  62432. deps = deps.map(function (depName) {
  62433. return stringRequire(systemRequire, exports, module, depName, relId);
  62434. });
  62435. //Wait for next tick to call back the require call.
  62436. if (callback) {
  62437. process.nextTick(function () {
  62438. callback.apply(null, deps);
  62439. });
  62440. }
  62441. }
  62442. }
  62443. amdRequire.toUrl = function (filePath) {
  62444. if (filePath.indexOf('.') === 0) {
  62445. return normalize(filePath, path.dirname(module.filename));
  62446. } else {
  62447. return filePath;
  62448. }
  62449. };
  62450. return amdRequire;
  62451. };
  62452. //Favor explicit value, passed in if the module wants to support Node 0.4.
  62453. requireFn = requireFn || function req() {
  62454. return module.require.apply(module, arguments);
  62455. };
  62456. function runFactory(id, deps, factory) {
  62457. var r, e, m, result;
  62458. if (id) {
  62459. e = loaderCache[id] = {};
  62460. m = {
  62461. id: id,
  62462. uri: __filename,
  62463. exports: e
  62464. };
  62465. r = makeRequire(requireFn, e, m, id);
  62466. } else {
  62467. //Only support one define call per file
  62468. if (alreadyCalled) {
  62469. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  62470. }
  62471. alreadyCalled = true;
  62472. //Use the real variables from node
  62473. //Use module.exports for exports, since
  62474. //the exports in here is amdefine exports.
  62475. e = module.exports;
  62476. m = module;
  62477. r = makeRequire(requireFn, e, m, module.id);
  62478. }
  62479. //If there are dependencies, they are strings, so need
  62480. //to convert them to dependency values.
  62481. if (deps) {
  62482. deps = deps.map(function (depName) {
  62483. return r(depName);
  62484. });
  62485. }
  62486. //Call the factory with the right dependencies.
  62487. if (typeof factory === 'function') {
  62488. result = factory.apply(m.exports, deps);
  62489. } else {
  62490. result = factory;
  62491. }
  62492. if (result !== undefined) {
  62493. m.exports = result;
  62494. if (id) {
  62495. loaderCache[id] = m.exports;
  62496. }
  62497. }
  62498. }
  62499. stringRequire = function (systemRequire, exports, module, id, relId) {
  62500. //Split the ID by a ! so that
  62501. var index = id.indexOf('!'),
  62502. originalId = id,
  62503. prefix, plugin;
  62504. if (index === -1) {
  62505. id = normalize(id, relId);
  62506. //Straight module lookup. If it is one of the special dependencies,
  62507. //deal with it, otherwise, delegate to node.
  62508. if (id === 'require') {
  62509. return makeRequire(systemRequire, exports, module, relId);
  62510. } else if (id === 'exports') {
  62511. return exports;
  62512. } else if (id === 'module') {
  62513. return module;
  62514. } else if (loaderCache.hasOwnProperty(id)) {
  62515. return loaderCache[id];
  62516. } else if (defineCache[id]) {
  62517. runFactory.apply(null, defineCache[id]);
  62518. return loaderCache[id];
  62519. } else {
  62520. if(systemRequire) {
  62521. return systemRequire(originalId);
  62522. } else {
  62523. throw new Error('No module with ID: ' + id);
  62524. }
  62525. }
  62526. } else {
  62527. //There is a plugin in play.
  62528. prefix = id.substring(0, index);
  62529. id = id.substring(index + 1, id.length);
  62530. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  62531. if (plugin.normalize) {
  62532. id = plugin.normalize(id, makeNormalize(relId));
  62533. } else {
  62534. //Normalize the ID normally.
  62535. id = normalize(id, relId);
  62536. }
  62537. if (loaderCache[id]) {
  62538. return loaderCache[id];
  62539. } else {
  62540. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  62541. return loaderCache[id];
  62542. }
  62543. }
  62544. };
  62545. //Create a define function specific to the module asking for amdefine.
  62546. function define(id, deps, factory) {
  62547. if (Array.isArray(id)) {
  62548. factory = deps;
  62549. deps = id;
  62550. id = undefined;
  62551. } else if (typeof id !== 'string') {
  62552. factory = id;
  62553. id = deps = undefined;
  62554. }
  62555. if (deps && !Array.isArray(deps)) {
  62556. factory = deps;
  62557. deps = undefined;
  62558. }
  62559. if (!deps) {
  62560. deps = ['require', 'exports', 'module'];
  62561. }
  62562. //Set up properties for this module. If an ID, then use
  62563. //internal cache. If no ID, then use the external variables
  62564. //for this node module.
  62565. if (id) {
  62566. //Put the module in deep freeze until there is a
  62567. //require call for it.
  62568. defineCache[id] = [id, deps, factory];
  62569. } else {
  62570. runFactory(id, deps, factory);
  62571. }
  62572. }
  62573. //define.require, which has access to all the values in the
  62574. //cache. Useful for AMD modules that all have IDs in the file,
  62575. //but need to finally export a value to node based on one of those
  62576. //IDs.
  62577. define.require = function (id) {
  62578. if (loaderCache[id]) {
  62579. return loaderCache[id];
  62580. }
  62581. if (defineCache[id]) {
  62582. runFactory.apply(null, defineCache[id]);
  62583. return loaderCache[id];
  62584. }
  62585. };
  62586. define.amd = {};
  62587. return define;
  62588. }(module)), require));